If you use the DOMDocumentFactory, you can cast the created dom4j documents to w3c documents as shown in the example!

That's the advantage of using interfaces: you can implement as many interfaces as you want. The DOMDocumentFactory produces documents that implements both the org.dom4j.Document and org.w3c.dom.Document interface.

regards,
Maarten

Ben Munat schreef:

Maarten Coene wrote:

DOMDocumentFactory factory = new DOMDocumentFactory();
SAXReader reader = new SAXReader(factory);
InputStream in = [...] // your XML file for instance
org.dom4j.Document dom4jDoc = reader.read(in);
org.w3c.dom.Document w3cDoc = (org.w3c.dom.Document) dom4jDoc;


Did you mean to use the factory on the last line? We can't simply cast a Dom4J Document
into a w3c Document, right?


Ben


PS: sent this at first from the wrong address... apologies if it shows up twice.



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user






-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to