[xml] xinclude vs. DTDs?

Date view Thread view Subject view Author view

From: Paul D. Smith (pausmith@nortelnetworks.com)
Date: Mon Nov 27 2000 - 17:46:48 EST


So far I haven't seen any of my email today back on the list (I just
subscribed this morning) nor has it shown up on the archives web site,
so I hope it's getting through...

Anyway, I fixed the previous bug regarding use with DTD's, but either I
didn't fix it correctly, or there's another problem (this one doesn't
seem, to me, to be related to the code I fixed but I'm pretty unfamiliar
with the code). The problem could be that I'm just doing this
completely wrong.

I have this testing DTD:

  <?xml version="1.0" encoding="US-ASCII"?>

  <!ELEMENT TESTDOC (One | Two)*>

  <!ELEMENT One EMPTY>
  <!ATTLIST One Name CDATA #REQUIRED >

  <!ELEMENT Two EMPTY>
  <!ATTLIST Two Name CDATA #REQUIRED >

Now I write an XML file to be included:

  <One Name="Just A"/>

Now I write an XML file including that one:

  <?xml version="1.0" encoding="US-ASCII"?>
  <!DOCTYPE TESTDOC SYSTEM "test.dtd">

  <TESTDOC>

    <xinclude:include xmlns:xinclude="http://www.w3.org/1999/XML/xinclude"
      href="incl.xml"/>

    <Two Name="Demo"/>

  </TESTDOC>

Now when I run "xmllint -xinclude -dtdvalid test.dtd test.xml" it
_looks_ like I got the right output:

  <?xml version="1.0" encoding="US-ASCII"?>
  <!DOCTYPE TESTDOC SYSTEM "test.dtd">
  <TESTDOC>

    <One Name="Just A"/>

    <Two Name="Demo"/>

  </TESTDOC>

But, I get errors on the validate:

  Element TESTDOC content doesn't follow the Dtd
  Expecting (One | Two)*, got (One Two )
  unknown element type 19
  No declaration for attribute href on element include
  unknown element type 20
  Document test.xml does not validate against test.dtd

I find the "Expecting ..." line very strange; why is this treated as one
item, rather than two?

I assume the "unknown element type 19" and "... type 20" are the
"INCLUDE START" and "INCLUDE END" nodes; how do I specify, in my DTD,
that these are OK and shouldn't cause concern?

If I run with -debug I also get some weird output that doesn't appear on
the test cases:

  DOCUMENT
  version=1.0
  encoding=US-ASCII
  URL=test.xml
  standalone=true
    DTD(TESTDOC), SYSTEM test.dtd
    ELEMENT TESTDOC
      TEXT
        content=
      INCLUDE START
      ELEMENT One
        ATTRIBUTE Name
          TEXT
          doc == NULL !!!
            content=Just A
  PBM: Node has no doc
  PBM: Node doc differs from parent's one
  PBM: Attr doc differs from parent's one
      INCLUDE END
      TEXT
        content=
      ELEMENT Two
        ATTRIBUTE Name
          TEXT
            content=Demo
      TEXT
        content=

I don't understand the "doc == NULL !!!" and the three PBM lines.

Anyone have any hints for me?

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@baynetworks.com>    HASMAT--HA Software Methods & Tools
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Nov 27 2000 - 18:44:02 EST