• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Help needed in XML Parsing  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi -
I am using "com.ibm.xml.parser.Parser" for parsing XML which is in form of InputStream. The XML is well formed-ness but still it is giving parsing error as there is no DTD attach to the XML.
How can I make sure that Parser does not look for DTD.
Any help on this regarded will be greately appreciated.
Thank You
saroj_rout@hotmail.com
Here is the code I am deploying
-------------------------------
try {
Parser parser = new Parser("OrderRequest") ;
Document doc = parser.readStream(stream) ;
if (parser.getNumberOfErrors() > 0) {
System.exit(1) ; //If the documents has errors
}
}catch (Exception ioe)
{
System.err.println(ioe.toString());
}
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saroj, what is the exact error message that you get?? It will be easier to answer if you post the error message and also the XML document.
Cheers!
 
saroj rout
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error message I am getting is -
"Element, "key" is not declared in the DTD"
The XML I am passing in InputStream is as follows(If you , notice I am not mentioning any DTD in XML) -
<?xml version="1.0"?>
<keyval>
<key>URL</key>
<value>http://www.ibm.com/xml</value>;
<key>Owner</key>
<value>IBM</value>
</keyval>

Thank you,
Saroj

Originally posted by Ajith Kallambella:
Saroj, what is the exact error message that you get?? It will be easier to answer if you post the error message and also the XML document.
Cheers!


 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sure there is something you're doing wrong. I tried your example XML with Xerces and it worked fine! Can you try parsing with the sample programs ( SAXWriter/ DOMWriter) that comes with Xerces download??
Also, if you wish you can post the java code too..
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!