Regression Apache Xerces ? DOCTYPE and XMLSchema

Discussion in 'XML' started by BODIN, Dec 8, 2003.

  1. BODIN

    BODIN Guest

    I have an XML document, which is actually physically stored in 2
    separated files.

    doc1.xml and doc2.xml

    I NEED a WAY FOR THIS SIMPLE NEED : XML file splitted into two
    physical files,
    and use of XML Schema.


    USING DTD : OK.
    ---------------
    doc2.xml is included within doc1.xml with an external ENTITY when
    using a DTD, and this works fine.

    <!DOCTYPE PROJECT SYSTEM "leon/conf/dtd/leon.dtd"
    [
    <!-- Inclusion des actions standard -->
    <!ENTITY DOC2 SYSTEM 'leon/conf/xml/leon.xml'>
    ]>

    <PROJECT id="compta" rootAction="compta_dashboard">
    &DOC2;
    </PROJECT>

    USING XML Schema : OK if no Entities
    ------------------------------------
    <PROJECT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="leon/conf/xml/leon.xsd" id="compta"
    rootAction="compta_dashboard">

    <!-- . . . -->
    </PROJECT>

    But here I need to COPY PASTE the DOC2.XML file content which is ugly
    since I have actually many files like doc2.xml to include

    ********************************************
    *** Here come troubles with Xerces parsers :
    ********************************************
    1) I tried to add the DOCTYPE with no DTD (supported by an old
    version of xerces Parser)

    <!DOCTYPE PROJECT
    [
    <!-- Inclusion des actions standard -->
    <!ENTITY DOC2 SYSTEM 'leon/conf/xml/leon.xml'>
    ]>

    <PROJECT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="leon/conf/xml/leon.xsd" id="compta"
    rootAction="compta_dashboard">

    &DOC2;
    </PROJECT>

    This is *NOT* working since DOCTYPE is PREFERRED to the XMLSchema and
    it says that my root element PROJECT is undefined :-(

    2) I tried to play with features :
    parser.setFeature("http://xml.org/sax/features/validation", true);
    parser.setFeature("http://apache.org/xml/features/validation/schema",
    true);

    It did'nt worked either

    3) I tried to get rid of the DOCTYPE, got xerces 2.6 (recent) and use
    the new XInclude syntax :
    <PROJECT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="leon/conf/xml/leon.xsd" id="compta"
    rootAction="compta_dashboard">

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="doc2.xml" parse='xml' encoding="ISO-8859-1"/>
    </PROJECT>

    This SEEMS to include the doc2.xml file, but how stupid ! It says that
    no grammar (DTD) is found for doc2.xml !
    Of course because it is an XML Schema.

    I also tried :
    <PROJECT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="leon/conf/xml/leon.xsd" id="compta"
    rootAction="compta_dashboard">

    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
    href="doc2.xml" parse='text' encoding="ISO-8859-1"/>
    </PROJECT>

    But this is not validating : doc2.xml is considered as a String and
    not as a NodeSet ...

    -----------------------------------------------------

    Did anyone succeed in using Xerces and XMLSchema + entities ?
    The only solution I see is to have my own Reader for the XML source
    for xerces
    and replace the entities of my own before the parsers gets it, but
    this what the parser is expected to do ???

    Thanks a lot for your help/support
    Nicolas BODIN
     
    BODIN, Dec 8, 2003
    #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. Bob
    Replies:
    0
    Views:
    392
  2. Robert Ludewig

    XMLSchema and XML Validation problem

    Robert Ludewig, Jun 28, 2004, in forum: XML
    Replies:
    4
    Views:
    590
    Martin Honnen
    Jun 28, 2004
  3. cvissy
    Replies:
    0
    Views:
    609
    cvissy
    Nov 16, 2004
  4. __PPS__
    Replies:
    2
    Views:
    568
    __PPS__
    Sep 27, 2005
  5. Larry Lindstrom
    Replies:
    19
    Views:
    1,307
    Jonathan N. Little
    Jun 12, 2012
Loading...

Share This Page