Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Problem using XERCES JAVA 2 DOM

Reply
Thread Tools

Problem using XERCES JAVA 2 DOM

 
 
dorin
Guest
Posts: n/a
 
      12-02-2004
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 ---------------
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      12-03-2004


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.

--

Martin Honnen
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
 
 
 
dorin
Guest
Posts: n/a
 
      12-07-2004
Martin Honnen <(E-Mail Removed)> wrote:
: 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 ---------------
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
java.lang.AbstractMethodError: at the org.apache.xerces.dom.DOMImplementationImpl.createLSOutput() poorichard@gmail.com Java 2 09-18-2006 02:08 AM
How to get an xml subtree using DOM using xerces? Anthony Mak XML 1 02-10-2005 09:11 AM
Upgrade of Xalan 1.2.2 and Xerces 1.4.4 to Xalan 2.6 and Xerces 2.6.2 cvissy XML 0 11-16-2004 07:06 AM
Unicode problem with Java Xerces DOM Dale Gerdemann XML 2 09-30-2004 06:40 PM
Validating XML using the Xerces DOM parser Helen Java 0 03-02-2004 12:37 AM



Advertisments