Problem using XERCES JAVA 2 DOM

Discussion in 'XML' started by dorin, Dec 2, 2004.

  1. dorin

    dorin Guest

    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 ---------------
     
    dorin, Dec 2, 2004
    #1
    1. Advertising

  2. 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/
     
    Martin Honnen, Dec 3, 2004
    #2
    1. Advertising

  3. dorin

    dorin Guest

    Martin Honnen <> 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 ---------------
     
    dorin, Dec 7, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Helen
    Replies:
    0
    Views:
    847
    Helen
    Mar 2, 2004
  2. Dale Gerdemann

    Unicode problem with Java Xerces DOM

    Dale Gerdemann, Sep 28, 2004, in forum: XML
    Replies:
    2
    Views:
    1,657
    Steve W. Jackson
    Sep 30, 2004
  3. cvissy
    Replies:
    0
    Views:
    639
    cvissy
    Nov 16, 2004
  4. Anthony Mak
    Replies:
    1
    Views:
    637
    Johannes Koch
    Feb 10, 2005
  5. Replies:
    2
    Views:
    5,617
Loading...

Share This Page