• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Help needed in XML Parsing

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
[email protected]
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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
reply
    Bookmark Topic Watch Topic
  • New Topic