Converting a org.jdom DOC to org.w3c DOC

Discussion in 'XML' started by Praveen Chhangani, Aug 5, 2003.

  1. Folks,

    I was wondering if it were possible to convert an org.jdom.doc to an
    org.w3c.doc document.

    Essentially what I have is an already parsed document using jdom and I
    would like to use the document object in another application that is
    expecting a DOM (w3c) document.

    If someone could perhaps, show me an example that would be very much
    appreciated.

    Thanks
    Praveen
     
    Praveen Chhangani, Aug 5, 2003
    #1
    1. Advertising

  2. Praveen Chhangani wrote:
    > I was wondering if it were possible to convert an org.jdom.doc to an
    > org.w3c.doc document.


    Yes

    > Essentially what I have is an already parsed document using jdom and I
    > would like to use the document object in another application that is
    > expecting a DOM (w3c) document.


    Have a look at the JDOM Javadoc.

    import org.jdom.output.DOMOutputter;
    import org.jdom.Document;

    DOMOutputter outputter = new DOMOutputter();
    org.w3c.dom.Document document =
    outputter.output(Document jdocument);

    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)
     
    Johannes Koch, Aug 6, 2003
    #2
    1. Advertising

  3. Praveen Chhangani wrote:
    >
    > Johannes,
    >
    > Thanks for the quick response. I have been looking at the JDOM
    > documentation and so far what I see is conversion from DOM to JDOM,
    > but what I am really looking for is from JDOM to DOM conversion.
    >
    > Any ideas, or perhaps an example as to how this is done will be very
    > much appreciated. Thanks.


    Did you really read my post? I included an example for you.

    > Johannes Koch <> wrote in message

    news:<bgqdcl$qpu38$-berlin.de>...
    >>import org.jdom.output.DOMOutputter;
    >>import org.jdom.Document;
    >>
    >>DOMOutputter outputter = new DOMOutputter();
    >>org.w3c.dom.Document document =
    >> outputter.output(Document jdocument);

    --
    Johannes Koch
    In te domine speravi; non confundar in aeternum.
    (Te Deum, 4th cent.)
     
    Johannes Koch, Aug 7, 2003
    #3
    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. Wendy S
    Replies:
    1
    Views:
    6,458
    Darren Davison
    Aug 5, 2003
  2. Bernd Oninger
    Replies:
    4
    Views:
    12,691
    GIMME
    Jun 21, 2004
  3. Matt
    Replies:
    3
    Views:
    548
    Tor Iver Wilhelmsen
    Sep 17, 2004
  4. Tinker
    Replies:
    4
    Views:
    5,434
    Harry Bosch
    Oct 9, 2005
  5. Bernd Oninger
    Replies:
    3
    Views:
    2,924
    GIMME
    Jun 21, 2004
Loading...

Share This Page