Haha, I'm really sorry, but looking through the code, it looks like there are a lot of UnsupportedExceptions thrown, so I'm not sure things will work out as you planned.
If you are using DOM, I would just build the DOM tree in memory like this: public static Element convertToDOM(final OMElement axiom) { try { final DocumentBuilder domBuilder = DocumentBuilderFactory .newInstance().newDocumentBuilder(); final Document doc = domBuilder.newDocument(); return convertToDom(axiom, doc); } catch (Throwable error) { throw new RuntimeException(error.getMessage(), error); } } /** * Convert an OM element into a DOM element. * * @param element * the OM element. * @param doc * the DOM document to which DOM elements should belong. * @return the DOM representation of the OM element. */ private static Element convertToDom(final OMElement element, final Document doc) { final Element domElement = doc.createElementNS(element.getNamespace() .getNamespaceURI(), element.getLocalName()); domElement.setNodeValue(element.getText()); for (Iterator i = element.getAllAttributes(); i.hasNext();) { final OMAttribute attr = (OMAttribute) i.next(); domElement.setAttributeNS(attr.getNamespace().getNamespaceURI(), attr.getLocalName(), attr.getAttributeValue()); } for (Iterator i = element.getChildElements(); i.hasNext();) { final Element child = convertToDom((OMElement) i.next(), doc); domElement.appendChild(child); } return domElement; } Stole the code from somewhere online. However, I'm not sure if this will work perfectly, like I don't' think it does prefixes. Good luck. Roshan Punnoose Phone: 301-497-6039 -----Original Message----- From: Tammy Dugan [mailto:[EMAIL PROTECTED] Sent: Friday, March 23, 2007 11:08 AM To: axis-user@ws.apache.org Subject: Re: [AXIOM] Problem getting DocumentElement from DocumentImpl This is a fairly pressing issue so I would appreciate any help I can get. thanks, Tammy Tammy Dugan wrote: > I am using DocumentImpl so I can convert org.w3c.dom to the axiom dom. > I need to create a DocumentImpl dom from an input stream and get > access to the document element as an org.w3c.dom.Element. In the code > below, you can see that accessing ruleDocument.getDocumentElement() is > null but ruleDocument.builder.getDocumentElement is not null. Since > the later only returns OMElements I need access to the former. How do > I do this? My fundamental problem is that I need to be able to import > an OMDocument into an org.w3c.dom.Document. > > String fileName = "C://Documents and Settings/tdugan/Desktop/test.xml"; > XMLStreamReader parser = > XMLInputFactory.newInstance().createXMLStreamReader(new > FileInputStream(fileName)); > StAXOMBuilder builder = new StAXOMBuilder(parser); > OMFactory fac = new OMDOMFactory(); > DocumentImpl ruleDocument = new DocumentImpl(builder, fac); > if (ruleDocument != null) > { > if (ruleDocument.getDocumentElement() == null) > { > System.out.println("ruleDocument document element > is null"); > } > if (ruleDocument.builder.getDocumentElement() != null) > { > System.out.println("builder document element is not > null"); > } > } > > Tammy Dugan > -- Tammy Dugan Computer Programmer Regenstrief Institute, Inc. 1050 Wishard Blvd., RG5 Indianapolis, IN 46202 (317) 630 - 7346 Confidentiality Notice: The contents of this message and any files transmitted with it may contain confidential and/or privileged information and are intended solely for the use of the named addressee(s). Additionally, the information contained herein may have been disclosed to you from medical records with confidentiality protected by federal and state laws. Federal regulations and State laws prohibit you from making further disclosure of such information without the specific written consent of the person to whom the information pertains or as otherwise permitted by such regulations. A general authorization for the release of medical or other information is not sufficient for this purpose. If you have received this message in error, please notify the sender by return e-mail and delete the original message. Any retention, disclosure, copying, distribution or use of this information by anyone other than the intended recipient is strictly prohibited. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
BEGIN:VCARD VERSION:2.1 N:Punnoose;Roshan FN:Punnoose, Roshan ADR;WORK:;2115 LABEL;WORK:2115 EMAIL;PREF;INTERNET:[EMAIL PROTECTED] REV:20050413T183207Z END:VCARD
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]