Problem using XERCES JAVA 2 DOM

D

dorin

I wonder if anyone can help me with a problem using the DOM
getElementById method.

I am using the Xerces Java 2 library to parse an XML file and create and
validate the DOM Document. I am able to access the Node objects using
the getElementsByTagName method but whenever I try to us getElementsById
the method just returns null.

I'm trying to get a project working quickily for a paper and this is
slowing me down greatly. Any advice would be greatly appreciated.

cheers,
Dorin

--------------"Que sera, sera."-------------

email: dorin-at-engsoc-dot-org

--------------- Dorin Petriu ---------------
 
M

Martin Honnen

dorin said:
I wonder if anyone can help me with a problem using the DOM
getElementById method.

I am using the Xerces Java 2 library to parse an XML file and create and
validate the DOM Document. I am able to access the Node objects using
the getElementsByTagName method but whenever I try to us getElementsById
the method just returns null.

You need to have a DTD for the XML which declares attributes of type ID
to be able to use getElementById successfully.
 
D

dorin

: dorin wrote:

: > I wonder if anyone can help me with a problem using the DOM
: > getElementById method.
: >
: > I am using the Xerces Java 2 library to parse an XML file and create and
: > validate the DOM Document. I am able to access the Node objects using
: > the getElementsByTagName method but whenever I try to us getElementsById
: > the method just returns null.

: You need to have a DTD for the XML which declares attributes of type ID
: to be able to use getElementById successfully.


I do have an XML Schema which declares attributes of type ID. Is a
schema not good enough? It seems silly that I should need a DTD when I
already have a Schema. Does getElementById not work with Schemas?

cheers,
Dorin

--------------"Que sera, sera."-------------

email: dorin-at-engsoc-dot-org

--------------- Dorin Petriu ---------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top