Skip to main content

FastInfosetException: org.w3c.dom.DOMException: NAMESPACE_ERR

1 reply [Last post]
sambhav_chhajed
Offline
Joined: 2008-10-17

Hi,

I have a small java code which does a round trip with fast Infoset. Basically program takes a XML document as input and converts it to Fast Infoset and then reverse way Fast Infoset to XML. I am using DOMDocumentSerializer and DomDocumentParser for the same.

Facing following exception while converting Fast Infoset to XML

org.jvnet.fastinfoset.FastInfosetException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
at com.sun.xml.fastinfoset.dom.DOMDocumentParser.parse(DOMDocumentParser.java:120)
at com.sun.xml.fastinfoset.dom.DOMDocumentParser.parse(DOMDocumentParser.java:100)
at com.sun.xml.fastinfoset.dom.DOMDocumentParser.parse(DOMDocumentParser.java:95)
at test.fiToDom(test.java:59)
at test.main(test.java:17)
Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
at org.apache.xerces.dom.AttrNSImpl.setName(Unknown Source)
at org.apache.xerces.dom.AttrNSImpl.(Unknown Source)
at org.apache.xerces.dom.CoreDocumentImpl.createAttributeNS(Unknown Source)
at com.sun.xml.fastinfoset.dom.DOMDocumentParser.createAttribute(DOMDocumentParser.java:1030)
at com.sun.xml.fastinfoset.dom.DOMDocumentParser.processAIIs(DOMDocumentParser.java:796)
at com.sun.xml.fastinfoset.dom.DOMDocumentParser.processEII(DOMDocumentParser.java:327)
at com.sun.xml.fastinfoset.dom.DOMDocumentParser.processDII(DOMDocumentParser.java:164)
at com.sun.xml.fastinfoset.dom.DOMDocumentParser.parse(DOMDocumentParser.java:116)
... 4 more

After debugging seems like some problem with DOMDocumentParser, is it a bug or I am doing something wrong here??

I don

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
oleksiys
Offline
Joined: 2006-01-25

Please set namespace aware for DOM builder factory to true... like:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();

Hope this will help.