[XOM-interest] nu.xom.IllegalNameException with some specific sort of XML documents
Ondřej Černoš
cernoso at gmail.com
Fri Apr 11 11:41:30 EDT 2008
Hello all,
I use XOM in Spring-WS as the DOM of choice. I run into an exception
mentioned in the subject. The offending XML looks like this:
<env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<env:Body>
<n1:PAYLOAD_ROOT
xmlns:n1="http://www.company.com/namespace">
<n1:something1
xmlns:n1="http://www.company.com/namespace">
value1
</n1:something1>
<n1:something2
xmlns:n1="http://www.company.com/namespace">
value2
</n1:something2>
<n1:something3
xmlns:n1="http://www.company.com/namespace">
value3
</n1:something3>
</n1:PAYLOAD_ROOT>
</env:Body>
</env:Envelope>
And the stacktrace like this:
nu.xom.IllegalNameException: Attribute objects are not used to
represent namespace declarations
at nu.xom.Attribute._setNamespace(Attribute.java:489)
at nu.xom.Attribute.<init>(Attribute.java:168)
at nu.xom.Attribute.<init>(Attribute.java:122)
at nu.xom.converters.DOMConverter.makeElement(DOMConverter.java:388)
at nu.xom.converters.DOMConverter.convert(DOMConverter.java:349)
at org.springframework.ws.server.endpoint.AbstractXomPayloadEndpoint.handleDomSource(AbstractXomPayloadEndpoint.java:97)
at org.springframework.ws.server.endpoint.AbstractXomPayloadEndpoint.invoke(AbstractXomPayloadEndpoint.java:56)
at org.springframework.ws.server.endpoint.adapter.PayloadEndpointAdapter.invoke(PayloadEndpointAdapter.java:48)
...etc...
AbstractXomPayloadEndpoint. is trying to create the Document object
from the payload part of the document - with PAYLOAD_ROOT as the root
element of the Document.
The problem with the XML document is the redefinition of the namespace
in the payload root subelements. That is the thing that triggers the
exception.
Is it XOM bug or spring's incorrect XOM usage?
All run on Java 1.6 and XOM 1.1.
Thanks for tips,
Ondrej Cernos
More information about the XOM-interest
mailing list