Hi, I'm not sure what you are trying to do, but if you want a W3C DOM Document, you should use the org.dom4j.dom.DOMDocumentFactory.
I didn't try it out, but I think the following should work: org.dom4j.io.SAXReader reader = new org.dom4j.io.SAXReader(); reader.setDocumentFactory(new org.dom4j.dom.DOMDocumentFactory()); org.dom4j.Document dom4jDocument = reader.read(new File("record.xml")); org.w3c.dom.Document domDocument = (org.w3c.dom.Document) dom4jDocument; org.dom4j.Node dom4jBookNode = xpathSelector.selectSingleNode(dom4jDocument); org.w3c.dom.Node domBookNode = (org.w3c.Node) dom4jBookNode; regards, Maarten At 13:17 12/07/2002 +0200, Bram Huenaerts wrote: >Dear readers & problemsolvers, > >while programming i had the next error: > ><ERROR> >Cannot convert: org.dom4j.tree.DefaultElement@9fd93 [Element: <book att >ributes: []/>] into a W3C DOM Node >Exception in thread "main" org.w3c.dom.DOMException: Not supported yet > at org.dom4j.dom.DOMNodeHelper.notSupported(DOMNodeHelper.java:429) > at org.dom4j.dom.DOMNodeHelper.asDOMNode(DOMNodeHelper.java:366) > at dom4jTest.main(dom4jTest.java:84) ></ERROR> > >The problem is that i can't cast a dom4j.Node to a w3cNode! > ><CODE> > import org.dom4j.*; > .... > // parse a document into a DOMDocument. > org.w3c.dom.Document domDocument = builder.parse(new >File("record.xml")); > DOMReader reader = new DOMReader(); > > // Convert the DOMDocument to a DOM4J-Document > Document dom4JDocument = reader.read(domDocument); > > // Casting the Object > Node dom4jBookNode = >xpathSelector.selectSingleNode(dom4jDocument); > org.w3c.dom.Node BookNode = >DOMNodeHelper.asDOMNode(dom4jBookNode); > > domDocument = (org.w3c.dom.Document) dom4jDocument; > ... ></CODE> > >None of the conversions are working. >When i use DOMWriter i can get a valid W3C Document. >The problem is I should be able to convert the Nodes! >Any help is welcome... > >Regards >-- >Huenaerts Bram -- Maarten Coene Katholieke Universiteit Leuven Dept. Computerwetenschappen Tel: ++32 (0)16/32 78 25 Celestijnenlaan 200A B-3001 Heverlee ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ dom4j-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-dev