Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

appending foreign Nodes

Status
Not open for further replies.

lowbk

Technical User
Nov 26, 2001
162
SG
hi, i am stuck at this and hope to seek some suggestions.
i have a document with the following structure

<returndoc>
<doc>
...
</doc>
</returndoc>

and i got a Vector of Nodes. each node has the following structure

<section>
<caption>section name</caption>
...
</section>


my idea is to go through the whole vector and for each Node in the vector, append to the document. my code is

Element docelement = (Element) sendingdoc.getDocumentElement().getLastChild();

int sv=sectionnodesv.size();
for(int i=0;i<sv;i++)
{
Node sectionnode = (Node) sectionnodesv.elementAt(i);
docelement.appendChild(sectionnode);
}
but then i get the following error:
org.apache.crimson.tree.DomEx: WRONG_DOCUMENT_ERR: That node doesn't belong in this document.

and i'd traced it to the appendChild line.

pls advise what could have went wrong, or if there is any method to overcome it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top