On 09/01/2013 14:50, Jirka Kosek wrote:
On 9.1.2013 10:42, Michael Kay wrote:
I haven't confirmed this, but my suspicion is that Ant is supplying
Saxon with a SAXSource in which the XMLReader is already initialized, in
which case Saxon will use that XMLReader.
I even tried to understand the source code of XSLT task. It's calling
transform() method where source document is supplied as instance of File
class. So it seems that Saxon should be responsible for creating parser
for this file.
Yes, I looked at the source code too, but couldn't work out exactly when an XMLReader was being allocated and when not.

The jaxp.debug trace shows SAXParserFactory being invoked but it doesn't tell us whether Ant or Saxon is doing the invoking. I'll try a bit more digging.

Michael Kay
Saxonica

Is it possible to investigate this by setting the system property
jaxp.debug=1? This will show whether the parser is being located using
the JAXP search mechanism. If this is the case, it almost certainly
means that Ant rather than Saxon is loading the XML parser.
e:\proj\amu\kosi-help\build>ant
Buildfile: e:\proj\amu\kosi-help\build\build.xml
JAXP: find factoryId =javax.xml.parsers.SAXParserFactory
JAXP: loaded from fallback value:
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
JAXP: created new instance of class
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl using
ClassLoader: null

xslt:
     [xslt] Processing e:\proj\amu\kosi-help\data\AMU_KOSI_manual 3b.htm
to e:\proj\amu\kosi-help\build\out.xml
     [xslt] Loading stylesheet e:\proj\amu\kosi-help\xsl\test.xsl
     [xslt] JAXP: find factoryId =javax.xml.parsers.SAXParserFactory
     [xslt] JAXP: loaded from fallback value:
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
     [xslt] JAXP: created new instance of class
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl using
ClassLoader: null

     [xslt] JAXP: find factoryId =javax.xml.parsers.SAXParserFactory
     [xslt] JAXP: loaded from fallback value:
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
     [xslt] JAXP: created new instance of class
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl using
ClassLoader: null

     [xslt] JAXP: find factoryId =javax.xml.parsers.SAXParserFactory
     [xslt] JAXP: loaded from fallback value:
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
     [xslt] JAXP: created new instance of class
com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl using
ClassLoader: null

     [xslt] e:\proj\amu\kosi-help\data\AMU_KOSI_manual 3b.htm:9:18:
Fatal Error! Error reported by XML parser Cause: org.xml.sax.SAX
ParseException: Open quote is expected for attribute "{1}" associated
with an  element type  "http-equiv".
     [xslt] Failed to process e:\proj\amu\kosi-help\data\AMU_KOSI_manual
3b.htm

BUILD FAILED

Another useful experiment would be to see whether other Saxon
configuration properties work, e.g. set
http://saxon.sf.net/feature/timing to "true".
Yes, this is working.

A workaround would probably be to use the exec task to run Saxon, rather
than the xslt task.
Yes, thanks, that's reasonoble workaround. I just thought that XSLT task
is more "proper" way to invoke XSLT from the Ant. :-)

Thanks,

				Jirka



------------------------------------------------------------------------------
Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery
and much more. Keep your Java skills current with LearnJavaNow -
200+ hours of step-by-step video tutorials by Java experts.
SALE $49.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122612 


_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
saxon-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/saxon-help