M
Martin Schlatter
I'm parsing an XML document with a SAX parser.
I initialise it in the following way:
javax.xml.parsers.DocumentBuilderFactory docBuilderFactory =
javax.xml.parsers.DocumentBuilderFactory.newInstance();
docBuilder = docBuilderFactory.newDocumentBuilder();
doc = docBuilder.parse(new File(fname));
But while parsing, I get an exception because their are characters
which are not valid utf-8 chars. I cannot change the input file. Is
there any way to skip over the invalid characters? Is there a chance
to use docBuilder.parse(InputStream) and then skip the invalid
characters?
Jens Martin Schlatter
I initialise it in the following way:
javax.xml.parsers.DocumentBuilderFactory docBuilderFactory =
javax.xml.parsers.DocumentBuilderFactory.newInstance();
docBuilder = docBuilderFactory.newDocumentBuilder();
doc = docBuilder.parse(new File(fname));
But while parsing, I get an exception because their are characters
which are not valid utf-8 chars. I cannot change the input file. Is
there any way to skip over the invalid characters? Is there a chance
to use docBuilder.parse(InputStream) and then skip the invalid
characters?
Jens Martin Schlatter