You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Thomas Conradi <co...@prostep.de> on 2000/02/21 09:14:30 UTC

Question: Namespaces/DTD

Hello!

I`m trying to include Elements of another Namespace (another DTD) in my
current DTD.
I also would like the XML-Parser to validate this element (including its
successors).

Can anyone help me out with a piece of simple code?
Or perhaps my understanding of Namespaces is simply wrong?

Thanks in advance, Thomas

test.dtd:
-----------
<?xml encoding="UTF-8"?>

<!ELEMENT test (elem*)>
<!ELEMENT elem EMPTY>
<!ATTLIST elem id ID #REQUIRED
                      name CDATA #IMPLIED>

testNS.dtd
-------------
<?xml encoding="UTF-8"?>

<!ELEMENT testNS (elem1*)>
<!ELEMENT elem1 (test:test*,test:elem*)>
<!ATTLIST elem1 xmlns:test CDATA 'test.dtd'  <!-- here is the reference
to the other namespace-->
            id ID #REQUIRED
                        xxx CDATA #IMPLIED>

testNS.xml
-------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE testNS SYSTEM "testNS.dtd">

<testNS>
  <elem1 id="#id1" xxx="hallo">
    <test:elem id="id1" name="#1"/>
    <test:elem id="id2" name="#2"/>
    <test:elem id="id3" name="#3"/>
  </elem1>
</testNS>


--
___________________________________________________________________________

ProSTEP GmbH                        Phone: +49-6151-9287381
Thomas Conradi                      Fax:   +49-6151-9287381
Julius-Reiber Str. 15               Email: conradi@prostep.de
D-64293 Darmstadt
___________________________________________________________________________