Xml and DTD validation

Discussion in 'XML' started by asaf.galili@gmail.com, Jan 25, 2006.

  1. Guest

    Hello,
    I am facing a problem, which I can't find the answer to it.
    I have a xml, which I am parsing using xerces.
    The problem is with the DTD validation, I want to give the DTD file
    path to the parser in my code (hardcoded or using environment
    parameter) and not to write the path in the xml file.
    is it possible?
    Thank you,
    Asaf
     
    , Jan 25, 2006
    #1
    1. Advertisements

  2. George Bina Guest

    Hello Asaf,

    If your document does not contain a reference to a DTD then you can
    provide one if you register an entity resolver implementing the SAX
    2.0.2 EntityResolver2 interface
    http://xerces.apache.org/xerces2-j/javadocs/api/org/xml/sax/ext/EntityResolver2.html

    If your document contains a reference to a DTD then you should be able
    to get a callback in the entity resolver resolveEntity method and from
    there you can return an InputSource with your desired DTD.

    Best Regards,
    George
    ---------------------------------------------------------------------
    George Cristian Bina
    <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
    http://www.oxygenxml.com
     
    George Bina, Jan 25, 2006
    #2
    1. Advertisements

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. Mark McKay
    Replies:
    0
    Views:
    1,309
    Mark McKay
    Sep 22, 2004
  2. Replies:
    1
    Views:
    381
    George Bina
    Jan 25, 2006
  3. Replies:
    1
    Views:
    536
    Dave Mandelin
    Mar 21, 2006
  4. Michael TEpperis
    Replies:
    1
    Views:
    493
  5. PJ

    Validation of XML DTD

    PJ, Sep 20, 2005, in forum: XML
    Replies:
    2
    Views:
    744
  6. Replies:
    1
    Views:
    952
    Richard Tobin
    Nov 2, 2005
  7. sush
    Replies:
    1
    Views:
    1,057
    Martin Honnen
    Feb 24, 2006
  8. test
    Replies:
    2
    Views:
    3,243
    Oliver Wong
    Jul 28, 2006
Loading...