xsl-list
[Top] [All Lists]

RE: JAXP: namespaces/namespace-prefixes features for SAXResult

2002-12-09 17:00:39
I think it's a reasonable assumption that as a provider of SAX events,
an XSLT transformer is expected to mimic an XMLReader with the default
settings of the namespace features: not just because these are the
defaults, but because XSLT is intrinsically namespace-aware.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Nikolai Grigoriev
Sent: 09 December 2002 22:24
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] JAXP: namespaces/namespace-prefixes features 
for SAXResult


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



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>