Validating using external DTD

Discussion in 'XML' started by Anand, Feb 10, 2004.

  1. Anand

    Anand Guest

    Hi all,
    I have an XML which comes through a HTTP request. I want to
    validate that
    XML with a DTD in the local machine. That XML does not have a DOCTYPE
    element by itself. Can someone tell me how this can be accomplished
    using
    xerces java.

    I had tried the sample "XMLGrammarBuilder.java" which comes with the
    xerces
    package. But this one seems to validate the XML only if it had the
    DOCTYPE
    element referencing the DTD. If I removed the DOCTYPE from the XML and
    ran
    the program, it gives an error such as "[Error] test.xml:2:12:
    cvc-elt.1: Cannot find the declaration of element
    '<the_root_element>'". But the XML is valid.

    If someone has a sample, it would be of great help if you can share it
    with
    me.

    Thanks,
    Anand
     
    Anand, Feb 10, 2004
    #1
    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. Stefan Ram

    Validating a DOM against a DTD?

    Stefan Ram, Jul 25, 2004, in forum: Java
    Replies:
    0
    Views:
    474
    Stefan Ram
    Jul 25, 2004
  2. Ben Jessel
    Replies:
    0
    Views:
    443
    Ben Jessel
    Aug 5, 2004
  3. Joseph Tilian
    Replies:
    0
    Views:
    379
    Joseph Tilian
    Dec 21, 2004
  4. bugbear
    Replies:
    0
    Views:
    1,069
    bugbear
    Aug 28, 2003
  5. salimk786
    Replies:
    8
    Views:
    1,693
    Roedy Green
    Aug 4, 2007
Loading...

Share This Page