Hi 'Spam Cut'

In the org.dom4j.io package there is a DOMReader and DOMWriter to allow you
to read and write to a W3C DOM Document to/from a dom4j document.

If you're using JTidy there's also a sample program in
dom4j/src/samples/JTidyDemo.java that shows how to use JTidy together with
dom4j.

Pretty much the following code does the trick...

        Tidy tidy = new Tidy();
        tidy.setXmlOut(true);
        org.w3c.dom.Document domDocument = tidy.parseDOM( in, null );


        // now read a dom4j document from
        // JTidy's W3C DOM object
        DOMReader domReader = new DOMReader();
        Document document = domReader.read( domDocument );

James
----- Original Message -----
From: "Spam Cut" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 09, 2002 8:04 PM
Subject: [dom4j-dev] org.w3c.dom.Document


> How do I convert a org.w3c.dom.Document to a
> org.dom4j.Document?
>
> Perhaps the DocumentFactory and DocumentHelper classes
> should contain a method such as the following...
>
> public static org.dom4j.Document
> createDocument(org.w3c.dom.Document document);
>
> ...which would imply that implementations of
> org.dom4j.Document would have a constructor that
> accepts a org.w3c.dom.Document.
>
> In any case, if I am using another parser (such as
> JTidy) that returns a W3C Document, and then wish to
> initialize a DOM4J Document with the returned
> document, how do I do so? I only found methods to do
> DOM4J -> W3C conversions, contained in the
> DOMNodeHelper class.
>
> Thanks!
>
> =====
> --
> [EMAIL PROTECTED]
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
>
> _______________________________________________
> dom4j-dev mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-dev


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev

Reply via email to