for (int el = 0; el < numberOfNewElements; el++) {
Node anElement = doc2Elements.item(el);
Node copyNode = doc1.importNode(anElement, true);
// doc1Root.appendChild(copyNode);
doc1.getElementById("group1").appendChild(copyNode);
}
On Mon, Aug 13, 2012 at 3:29 PM, fireball <[email protected]> wrote:
> 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
> <g id="group1"
> ...
> <g id="group2"
> ...
> </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: [email protected]
> For additional commands, e-mail: [email protected]
>
>