As I said before, Saxon is only the messenger. This appears to be a bug in
the version of Xerces bundled with JDK 1.5. You can reproduce it very easily
without involving Saxon at all:
public static void main(String[] args) throws Exception {
SAXParserFactory factory = SAXParserFactory.newInstance();
XMLReader parser = factory.newSAXParser().getXMLReader();
System.err.println("Parser: " + parser.getClass().getName());
parser.setFeature("http://xml.org/sax/features/namespaces", true);
parser.setFeature("http://xml.org/sax/features/namespace-prefixes",
false);
parser.setFeature("http://apache.org/xml/features/xinclude-aware",
true);
parser.setContentHandler(new ExampleContentHandler());
parser.parse("file:///c:/temp/test.xml");
}
The same program succeeds (with a minor change, see below) if you download
Xerces 2.9.0 and run it with a system property setting such as
-Djava.endorsed.dirs=c:\javalib\xerces-2_9_0
However, there's a complication, which is that the JDK version seems to
expect the feature setting
"http://apache.org/xml/features/xinclude-aware"
whereas Xerces 2.9.0 expects
"http://apache.org/xml/features/xinclude"
(and neither version of the parser accepts the alternative spelling). Heaven
only knows how that incompatibility occurred - perhaps one of your
colleagues in Sun will know. Saxon 8.9 as issued is using the
"xinclude-aware" spelling, which doen't work with Xerces 2.9.0. I can issue
a patch that sets both features and catches the exceptions - but it would be
nice to find out more about what's going on before we resort to that.
Perhaps you can help with the research.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Wayne Chan [mailto:Wayne.Chan@...]
> Sent: 18 March 2007 23:38
> To: Michael Kay
> Cc: 'Mailing list for SAXON XSLT queries'; 'Wayne Chan'
> Subject: RE: [saxon] saxon xinclude strange failure/help
>
>
> hi michael,
>
> here is the complete files for the xinclude not working example:
>
> --------------------------
> > more xi_saxon.xml
> <abc>
> <test>
> <xi:include href="lt/dat/uplt_fog_weekfile.xml"
> xmlns:xi="http://www.w3.org/2001/XInclude"/>
> </test>
> </abc>
> > more lt/dat/uplt_fog_weekfile.xml
> <fogs>
> <fog_stats name="sg-uplt01">
> <xi:include parse="xml" href="sg-uplt01_weekfile.xml"
> xmlns:xi="http://www.w3.org/2001/XInclude"/>
> </fog_stats>
> </fogs>
> > ./saxon.sh xi_saxon.xml xi.xsl
> Error on line 3 column 101 of
> file:/worktone/20079999/lt/dat/uplt_fog_weekfile.xml:
> SXXP0003: Error reported by XML parser: The prefix "xi" for
> element "xi:include" is not bound.
> Error on line 3 column 93 of file:/worktone/20079999/xi_saxon.xml:
> SXXP0003: Error reported by XML parser: Error attempting to
> parse XML file
> (href='lt/dat/uplt_fog_weekfile.xml').
> Transformation failed: Run-time errors were reported
> >
> ----------------------
>
> btw, i have both your xslt books (xslt 1.0 and xslt 2.0). it
> has been a must-have desk side reference for me..
>
> thanks,
>
> Wayne Chan ( X-81270 / 408-404-8588)
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> NOTICE: This email message is for the sole use of the intended
> recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or
> distribution is prohibited. If you are not the intended
> recipient, please contact the sender by reply email and
> destroy all copies of the original message.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> On Sat, 17 Mar 2007, Michael Kay wrote:
>
> < MK >> the xi_saxon.xml file is added a top level elemnts <abc> ..
> < MK >> </abc> above <test> .. </test> then xinclude failed
> with the < MK >> following error message! not sure it is
> saxon problem or xml < MK >> xinclude problem..
> < MK >
> < MK >Saxon is just reporting the error message that comes
> from the XML parser.
> < MK >(Don't blame the messenger!)
> < MK >
> < MK >In this case the error message
> < MK >
> < MK >> Error on line 3 column 101 of
> < MK >> file:/worktone/20079999/lt/dat/uplt_fog_weekfile.xml:
> < MK >> SXXP0003: Error reported by XML parser: The prefix "xi" for
> < MK >> element "xi:include" is not bound.
> < MK >
> < MK >relates to the file being included, which you haven't
> actually shown us.
> < MK >
> < MK >Michael Kay
> < MK >http://www.saxonica.com/
> < MK >
> < MK >
>
|