You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Elena Veksler <el...@amplexor.com> on 2001/12/14 17:15:18 UTC

importNode error

I am trying to make a new Document objects with a root and some nodes.
The nodes are the result of the xpath query over some documents in the
database. I get a list with following nodes as result of the query:
	<?xml version="1.0"?>
	<Provincie Id="21" xmlns:src="http://www.dbxml.org/Query"
src:col="/db/webs" src:key="12_243">
		<Pictures Id="285" Link="No">
			<Location>somewhere</Location>
		</Pictures>
	</Provincie>

	<?xml version="1.0"?>
	<Provincie Id="22" xmlns:src="http://www.dbxml.org/Query"
src:col="/db/webs" src:key="12_243">
		<Pictures Id="286" Link="Yes">
			<Location>here</Location>
		</Pictures>
	</Provincie>

To make a document i have the following code where the instances are the
Node list that are result of the query. I use Java and Xerces 1.4.3

	DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
      DocumentBuilder db = factory.newDocumentBuilder();
      doc = db.newDocument();
      //create the root element
      Element e = doc.createElement("root");
      doc.appendChild(e);
      for(i=0; i < instances.size(); i++ ){
        Node n = (Node)instances.get(i);
        Node n1 = doc.importNode(n.getFirstChild(),true);
        e.appendChild(n1);
      }

I get the exception when the importNode has to be done
The following exception occurs:

org.w3c.dom.DOMException: DOM003 Namespace error 	
at org.apache.xerces.dom.AttrNSImpl.<init>(AttrNSImpl.java:127) 	
at
org.apache.xerces.dom.DocumentImpl.createAttributeNS(DocumentImpl.java:1
187) 	
at org.apache.xerces.dom.DocumentImpl.importNode(DocumentImpl.java:861)

at org.apache.xerces.dom.DocumentImpl.importNode(DocumentImpl.java:828)

at org.apache.xerces.dom.DocumentImpl.importNode(DocumentImpl.java:770)


Can someone tell me please what am i doing wrong???

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org