File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML Parsing issuse

 
Sireesh Ganagam
Ranch Hand
Posts: 38
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

How you doing. I have xml file generated i want to read rc , rm values in that but i am getting exceptions. How can i achieve this. Appreciate your help








Exceptions :



[Fatal Error] :7:46: Character reference "&x2" is an invalid XML character.
org.xml.sax.SAXParseException: Character reference "" is an invalid XML character.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:246)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
at VBSexe.convertXMLFileToString(VBSexe.java:146)
at VBSexe.main(VBSexe.java:61)
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Obviously the first step will be to get a readable XML document by locating and fixing all those illegal characters.

How was this document generated? If it got anywhere near Microsoft word it may be contaminated with those accursed "smart punctuation" characters.

If you catch the SAXParseException try extracting the line and column number to help locate the bad character in the text.

A programmer's editor that can show and patch HEX values will be a big help too.

Bill
 
Mark E Hansen
Ranch Hand
Posts: 650
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's just a guess, but it looks like there is strange data in the <samplerData> element
 
david fields
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If youre still struggling there is afree online xml validator http://www.liquid-technologies.com/FreeXmlTools/FreeXmlValidator.aspx that will check your xml for you, you wont need to download anything.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic