Project

Profile

Help

B 9.0.0.2J demands optional XMLReader prop

Added by Anonymous over 16 years ago

Legacy ID: #4672621 Legacy Poster: Chapman Flack (jcflack)

Hi, I just upgraded to Saxon-B 9.0.0.2J and straightaway an application blew up that synthesizes a document via a SAXSource with a custom XMLReader. net.sf.saxon.event.Sender (around line 336) throws exceptions if it is handed an XMLReader that does not recognize or does not support the http://xml.org/sax/properties/lexical-handler property. But according to both http://sax.sourceforge.net/apidoc/org/xml/sax/package-summary.html#package_description and http://java.sun.com/javase/6/docs/api/org/xml/sax/XMLReader.html#setProperty(java.lang.String,%20java.lang.Object) all such properties are optional; an XMLReader need not recognize or support any at all. I can work around the problem by adding the logic below to every custom XMLReader given to Saxon. But that should not be necessary, and technically makes the XMLReader less strictly compliant (as, if it does nothing with the lh property, it really should report that by throwing the specified exception). Chapman Flack private static final String propertyLexicalHandler //add = "http://xml.org/sax/properties/lexical-handler"; //add Object lh; //add public Object getProperty( String name) throws SAXNotRecognizedException, SAXNotSupportedException { if ( propertyLexicalHandler == name ) //add return lh; //add else //add throw new SAXNotRecognizedException( name); } public void setProperty( String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { if ( propertyLexicalHandler == name ) //add lh = value; //add else //add throw new SAXNotRecognizedException( name); }


Replies (1)

RE: B 9.0.0.2J demands optional XMLReader pro - Added by Anonymous over 16 years ago

Legacy ID: #4672673 Legacy Poster: Michael Kay (mhkay)

I'm afraid I have no recollection of why this change was made. While it's true that discarding comments is not conformant with the XSLT specification, and the XSLT processor is therefore entitled to insist that the parser you supply is one that is able to report comments, I don't think I would have done this for that reason. More likely I unthinkingly confused this code with the code that requires the namespace properties to be set correctly. I'll restore it to the way it was in 8.9. Michael Kay

    (1-1/1)

    Please register to reply