Hi out there, I need to parse an xmlstream. I am using the Documentbuilderfactory for this and normaly all works fine. In some Tags sometimes a "&" occurs. I do not have the possibility to encode this data before creating the xmlstream. If the parser finds this symbol it throws a sax-parser-exception. Is there any way to parse this symbol without encoding it in the right way? Thx. Bye Mark
SAX Parser or any parser can only parse Well-formed XMLs. If any XMLs contain any & inside the element, then it is not a well-formed xml. Ideally it should be replaced with & You need to check for wellformedness of xml and then parse.
SCJP 1.4, SCDJWS , SCJA<br />I can do ALL things through CHRIST who strengthens me.
Joined: Oct 25, 2004
The problem is that the xml isnt generated by me but by another software. So I am not able to encode the "&" before parsing. I could convert the stream to a string and replace all "&" by the correct encoding and after that run the parser. But isnt there an easier way? Bye Mark