Project

Profile

Help

-expand:on|off

Added by Anonymous over 15 years ago

Legacy ID: #5777999 Legacy Poster: Jesper Tverskov (jesper_tverskov)

Testing XQuery Update Facility in Saxon SA 9.1.0.3n at the command line, I thought expand:off would work, preventing e.g. defaulted attributes from being copied out of the DTD. But is doesn't seem to be the case for the XHTML file I use for testing. Is expand:off only working for validation?, or what is the likely answer to my problem? Cheers, Jesper Tverskov


Replies (4)

Please register to reply

RE: -expand:on|off - Added by Anonymous over 15 years ago

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

-expand:off, in the case of DTD-defined attribute defaults, only works with some XML parsers. It doesn't work with the Microsoft XML parser, because that doesn't notify the application whether an attribute was explicit in the source or generated to expand a default.

RE: -expand:on|off - Added by Anonymous over 15 years ago

Legacy ID: #5780835 Legacy Poster: Jesper Tverskov (jesper_tverskov)

When re-reading documentation for XQuery at the command line, http://www.saxonica.com/documentation/using-xquery/commandline.html, I can't find information about how to choose between different XML parsers. How can I do it from the command line when doing transformation or query? Cheers, Jesper

RE: -expand:on|off - Added by Anonymous over 15 years ago

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

On your original point, I'm afraid I misinformed you: the Microsoft TextReader interface does provide a method (IsDefault) to determine whether an attribute has been generated by expanding defaults in the DTD. I've now changed the code to look at this property and the -expand:off option is now working. The change is sufficiently small and low-risk that I think I can treat this as a bug clearance in a maintenance release. On the second point, the -x option on the command line is recognized, but I haven't found a way of making it work, that is, setting up a configuration that is capable of dynamically loading a Java SAX parser. There is a switch at the API level: processor.setProperty("http://saxon.sf.net/feature/preferJaxpParser", "true"); which causes Saxon to attempt to load a SAX parser (using the JAXP ParserFactory) in preference to the Microsoft parser - but I'm not sure I've tried it since the switchover from GNU Classpath to OpenJDK. I'll do some experiments. The main reason for using it is that the Microsoft parser doesn't report whether an attribute is an ID, so the XPath id() function doesn't work.

RE: -expand:on|off - Added by Anonymous over 15 years ago

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

I've done a bit of experimenting. I don't think the -x option on the .NET command line does anything, because it's only used when looking for a JAXP parser and the code doesn't go down that path. The Configuration option FeatureKeys.PREFER_JAXP_PARSER does appear to work, but it's not available from the command line (I'll fix that for the next release). It's useful if your stylesheet using the id() function, because the Microsoft parser doesn't report IDs. I haven't tried to load a JAXP parser other than the default one, which is com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser

    (1-4/4)

    Please register to reply