You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Cliff Binstock <bi...@pacifier.net> on 2002/03/13 01:43:49 UTC

Entities.

It appears from the XML Schema Recommendation
that one can create a non-parseable entity in
an XML file to be validated by a schema (see
example in Part 0 at the end of this message).
I tried the following XML:

==================================

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE demo [
    <!ENTITY myURI SYSTEM "http://www.example.com">
]>
<demo
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation=
            "c:\XMLSchemaExample\apacheErr\withdtd.xsd">
    <whatever>text</whatever>
</demo>

===================================

With a really simple schema:

===================================

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<xsd:element name="demo">
    <xsd:complexType>
        <xsd:all>
            <xsd:element name="whatever" type="xsd:token"/>
        </xsd:all>
    </xsd:complexType>
</xsd:element>

</xsd:schema>

====================================

I get:

[Error] withdtd.xml:10:2: Element type "demo" must be declared.
[Error] withdtd.xml:12:15: Element type "whatever" must be declared.

Which is consistent with a missing info in the DTD.
[ I fully admit to knowing little about DTDs ].

Should I be able to declare just entities in an internal DTD?

If not, is there any way with Apache (or even in
theory) to use the built-in ENTITY datatype?


Thanks!


Cliff Binstock
binstock@pacifier.net

============================

The Part 0 example:

<?xml version="1.0" ?>
<!DOCTYPE PurchaseOrder [
<!ENTITY eacute "é">
]>
<purchaseOrder xmlns="http://www.example.com/PO1"
               orderDate="1999-10-20>
 <!-- etc. -->
  <city>Montr&eacute;al</city>
 <!-- etc. -->
</purchaseOrder>



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org