"Nesting" XML documents using DOM

P

Paul Lee

Hi everyone,
I'm trying to nest one XML document inside another, but the only
method I can think of (not being familiar with Java and DOM!) would
involve nested while loops.

Basically, I have something like this:

<Book>
<Title>blob</Title>
<Author>blobby</Author>
.... etc ...
</Book>

What I'm trying to do is import another XML doc. where the Author tag
is located, so it becomes
<Author>
<First Author>a</First Author>
<Second Author>b</Second Author>
</Author>

There must be a very simple way to do it in DOM but my head hurts!

(by the way, how do I export the resultant Document into String
format? I've looked at obvious solutions such as any "getText()"
functions, but help
pages refer to traversing each node in turn and parsing them into
text)

TIA

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Nesting 1
XML Question 7
dynmaic recursive nesting in xsl? 0
xml parsing using dom 1
Java Web Services/DOM question 3
Nesting XML Elements in Java 10
java + XML + dom4j 0
XSLT help 3

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top