java - Sax Parser: processingInstruction() not called -


Maybe this is a n00b-question.

I try to parse an XML file like this:

  & lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Test & gt; & Lt; A & gt; & Lt; / A & gt; & Lt; / Test & gt;  

with the following code:

  public static zero parsing (file f) {end default handler handler = new default handler () {@Override Public Zero Processing ( String targets, string data) throws SAXException {System.out.println ("processing instructions"); }}; SAXParserFactory.newInstance () NewSAXParser () Pars (f, handler); }  

I hope the output "processing instructions" should be printed on stdout. But does not it happen that someone can tell me?

From the Java Doc:

A SAX Parser Any XML declaration (XML 1.0, section 2.8) or a text declaration (XML 1.0, section 4.3.1) should never be reported using.

As I understand it, & lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; Line will not be reported / catered by this method Try adding another processing instructions to the XML code and feed it to parset again.


Comments