I suspect that JDOM will be quite happy handling
prefix "" = namespace "xyz"
to declare the default namespace (xmlns="xyz"), and
prefix "" = namespace ""
to undeclare the default namespace (xmlns=""). These are events that will be
routinely notified by an XML 1.0 SAX parser.
The problem is probably with undeclaring a non-default namespace
prefix "abc" = namespace ""
corresponding to (xmlns:abc="")
This is something that's newly allowed in XML Namespaces 1.1 and supported
in the XPath 2.0 data model, but is likely not to be accepted by existing
ContentHandler implementations. (It will be interesting to see what JAXP 1.3
says about this).
Although serialization options are normally ignored when writing to a
ContentHandler, I suspect the right thing to do is to notify the namespace
undeclaration only if the serialization property undeclare-namespaces is set
> -----Original Message-----
> From: saxon-help-admin@...
> [mailto:saxon-help-admin@...] On Behalf Of
> Keith M. Hughes
> Sent: 01 June 2004 12:59
> To: saxon-help@...
> Subject: [saxon] Errors When Using SAX to put XQuery output into JDOM
> I looked through the archives for Saxon-help and also on Google and
> couldn't find anyone else who had run into this problem.
> I have a program that is using the Saxon XQuery processor.
> Saxon XQuery
> creates its document, which is then serialized by
> QueryResult.serialize() into a stream of SAX events which are used to
> construct a JDOM document using JDOM facilities. I was getting the
> following exception:
> The name "" is not legal for JDOM/XML namespaces: Namespace
> URIs must be
> non-null and non-empty Strings.
> I checked the SAX events being created by Saxon's serialization and
> found that ContentHandler.startPrefixMapping() was being handed both
> zero length prefix names and zero length URIs, though never
> at the same
> time. I wrote a SAX filter which didn't pass any startPrefix messages
> with a 0 length value for either argument which made JDOM happy.
> Is it legal for ContentHandler.startPrefixMapping() to have 0 length
> arguments? Is this a Saxon issue or a JDOM issue?
> This SF.Net email is sponsored by the new InstallShield X.
> From Windows to Linux, servers to mobile, InstallShield X is the one
> installation-authoring solution that does it all. Learn more and
> evaluate today! http://www.installshield.com/Dev2Dev/0504
> saxon-help mailing list