Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using getElementById

Mchowta-OracleMay 16 2005 — edited Jun 26 2007
Hi ,
I am trying to use the document.getElementById() method to obtain a value from the XML. I have done the following:
1. Defined the attribute as type ID [ <xsd:attribute name="id" type="xsd:ID" use="required" /> ]

2. Provided the schema location in the XML.

However in the code when I do a getElementById, I get a null.

Code snippet that I use is:

File capabilityfile = new Fiile("capabilities.xml");
URL capfile = capabilityfile.toURL();
oracle.xml.parser.v2.DOMParser parser = new oracle.xml.parser.v2.DOMParser();
parser.setValidationMode( XMLParser.SCHEMA_VALIDATION );
parser.parse( capfile );
Document capFileRoot = parser.getDocument();
System.out.println(capFileRoot.getElementById( "ASYNC"));


Am I missing something here?

Thanks,
Mridhula
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 24 2007
Added on May 16 2005
15 comments
6,210 views