You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Tammy Dugan <td...@regenstrief.org> on 2007/03/22 16:32:38 UTC

[AXIOM] Problem getting DocumentElement from DocumentImpl

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: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [AXIOM] Problem getting DocumentElement from DocumentImpl

Posted by Tammy Dugan <td...@regenstrief.org>.
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: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org