Note that there are some explanatory texts on larger screens.

plurals
  1. POImport Node into new Document
    primarykey
    data
    text
    <p>I'm trying to import a node from a base-document into a new document but when I use the Document.importNode() method, it generates an exception. The funny part is that this exception does not contain a message so I'm pretty much blind except for the stack-trace. (I'm new to java)</p> <p>Here is my method that will create a new document and import the node:</p> <ul> <li>this.Builder = DocumentBuilder</li> <li>this.Element = Node</li> </ul> <p>Code:</p> <pre><code>public XMLSelection extract () { if (this.Element != null) { try { Document newDoc = this.Builder.newDocument(); Node node = newDoc.importNode(this.Element, true); newDoc.appendChild(node); return new XMLSelection(newDoc); } catch(Exception e) { Debug.error("XMLSelection::extract", e); } } return null; } </code></pre> <p>And the stack-trace:</p> <pre><code>02-06 14:27:53.328: W/System.err(9082): org.w3c.dom.DOMException 02-06 14:27:53.328: W/System.err(9082): at org.apache.harmony.xml.dom.NodeImpl.setNameNS(NodeImpl.java:227) 02-06 14:27:53.328: W/System.err(9082): at org.apache.harmony.xml.dom.ElementImpl.(ElementImpl.java:50) 02-06 14:27:53.328: W/System.err(9082): at org.apache.harmony.xml.dom.DocumentImpl.createElementNS(DocumentImpl.java:336) 02-06 14:27:53.328: W/System.err(9082): at org.apache.harmony.xml.dom.DocumentImpl.shallowCopy(DocumentImpl.java:156) 02-06 14:27:53.328: W/System.err(9082): at org.apache.harmony.xml.dom.DocumentImpl.cloneOrImportNode(DocumentImpl.java:208) 02-06 14:27:53.328: W/System.err(9082): at org.apache.harmony.xml.dom.DocumentImpl.importNode(DocumentImpl.java:222) 02-06 14:27:53.328: W/System.err(9082): at com.xxxx.xxxx.XMLSelection.extract(XMLSelection.java:57) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload