Let's say I have two documents:

document 1:
<svg
  <g id="group1"
     ...
  </g>
</svg>

and 

document 2:
<svg
  <g id="group2"
     ...
  </g>
</svg>

If I want to import doc 2 into doc 1 I do something like this:

Element doc1Root = doc1.getDocumentElement();
Element doc2Root = doc2.getDocumentElement();

NodeList doc2Elements = doc2Root.getChildNodes();
int numberOfNewElements = doc2Elements.getLength();
for (int el = 0; el < numberOfNewElements; el++) {
    Node anElement = doc2Elements.item(el);
    Node copyNode = doc1.importNode(anElement, true);
    doc1Root.appendChild(copyNode);
}


This results in two groups within doc1:
<svg
  <g id="group1"
     ...
  </g>
  <g id="group2"
     ...
  </g>
</svg>

Now my question is, how do we import this doc2 into group1 of doc1. I.e.
something like:
<svg
  &lt;g id=&quot;group1&quot;
     ...
     &lt;g id=&quot;group2&quot;
     ...
     &lt;/g>
  </g>
</svg>



--
View this message in context: 
http://batik.2283329.n4.nabble.com/Importing-nodes-tp4655201.html
Sent from the Batik - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org

Reply via email to