Hi all,
I am reading output of an XSLT transformation through
javax.xml.transform.sax.SAXResult. It looks very similar
to using an XMLReader: I set a ContentHandler and
get information through its callbacks. However, an
XMLReader can deliver parse results in a variety
of ways. In particular:
- qNames can be present or null;
- start/endPrefixMapping() events may be fired or skipped;
- xmlns:* attributes may be present or absent in the attribute lists.
For an XMLReader, I can tame this zoo through setFeature() method, using
two features http://xml.org/sax/features/namespaces and
http://xml.org/sax/features/namespace-prefixes
(a table at http://www.saxproject.org/?selected=namespaces,
"Configuring Namespace Support" unambiguously defines behaviour
for each feature combination). Even if the parser does not support
a particular pairing, I can at least query its capabilities, and adjust
my ContentHandler accordingly.
Now I pass to JAXP. The same ContentHandler is fed to a Transformer
(wrapped into a SAXResult); so I would expect either the Transformer
or its mother TransformerFactory to recognize SAX2 features. I have
browsed the whole JAXP 1.1 specification looking for a way to set
(or at least to query) the features, but in vain. I could not even find
the exact description of the default behaviour. Looks like the choice
of values for SAX properties is implementation-dependent - but this
would undermine the whole idea of pluggability, so I am definitely
missing some important piece of the puzzle.
In view of the above, my questions are:
1) What is the default behaviour of Transformer wrt
namespaces/namespace-prefixes? Where in the JAXP spec
is it defined?
2) Can I query or modify SAX2 parser features for a JAXP Transformer
object? If yes, how?
Thanks to anyone willing to get me out of the impasse.
Regards,
Nikolai Grigoriev
RenderX
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list