"Nesting" XML documents using DOM

Discussion in 'XML' started by Paul Lee, Jan 23, 2004.

  1. Paul Lee

    Paul Lee Guest

    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
     
    Paul Lee, Jan 23, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    734
  2. Replies:
    1
    Views:
    427
    Peter Flynn
    Jul 6, 2005
  3. Replies:
    1
    Views:
    520
    Juan T. Llibre
    Oct 18, 2006
  4. Simon Willison
    Replies:
    10
    Views:
    591
    Paul Boddie
    Jul 31, 2008
  5. Trans
    Replies:
    10
    Views:
    327
    Sean O'Halpin
    Sep 16, 2005
Loading...

Share This Page