You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Dave Broudy <da...@broudy.net> on 2003/06/30 20:37:00 UTC
Internal Entities (in DOCTYPE) and XML Schema
Hello all,
I have a question about validating a document that contains both a DOCTYPE
and an XML Schema. My scenerio is that I'm producing the document in C++,
and the consumer (which I have no control over) uses Java (xerces-j).
It is convenient for me to use a couple of internal entities, but the
consumer program recently switched from a DOCTYPE to an XML Schema.
So, enough background. Aside from using both a complete DTD and a complete
XML Schema, is there anyway to do have a document like the one below? This
validates with xerces-c (using sample program SAX2Count), but not with
xerces-j (using sample program sax.Counter -n -f -s -v). Which is
right?
My reading of the XML spec says that in a well formed document a
doctypedecl is optional, and if it's included, it's allowed to contain
only '<!DOCTYPE entschema>'. xerces-j also gives an error in this case.
http://www.w3.org/TR/REC-xml#NT-prolog
It's been a long week, so maybe I'm reading something wrong.
Many thanks,
Dave
========================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE entschema [
<!ENTITY replace "my replacement text">
]>
<entschema
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="entschema.xsd">
<text>&replace; here</text>
</entschema>
========================================
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="entschema">
<xs:complexType>
<xs:sequence>
<xs:element name="text" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Dave Broudy dave@broudy.net
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: Internal Entities (in DOCTYPE) and XML Schema
Posted by George Cristian Bina <ge...@sync.ro>.
Hi Dave,
Have a look at
http://java.sun.com/xml/jaxp/change-requests-11.html
Shortly, if you add something like:
parser.setProperty(
"http://java.sun.com/xml/jaxp/properties/schemaLanguage",
"http://www.w3.org/2001/XMLSchema"
);
The validation will be performed against the specified schema. I tried your
sample with this setting and Xerces reports it valid.
Best Regards,
George
-------------------------------------------------------------
George Cristian Bina mailto:george@sync.ro
COO - sync.ro
Phone +40-(0)251-461480, +40-(0)251-461481
Fax +40-(0)251-461482
Mobile +40-(0)723-224067
SyncRO Soft srl, Bd N. Titulescu 170, Craiova, 1100 - Romania
http://www.sync.ro
<oXygen/> XML Editor - http://www.oxygenxml.com/
----- Original Message -----
From: "Dave Broudy" <da...@broudy.net>
To: <xe...@xml.apache.org>; <xe...@xml.apache.org>
Sent: Monday, June 30, 2003 9:37 PM
Subject: Internal Entities (in DOCTYPE) and XML Schema
> Hello all,
>
> I have a question about validating a document that contains both a DOCTYPE
> and an XML Schema. My scenerio is that I'm producing the document in C++,
> and the consumer (which I have no control over) uses Java (xerces-j).
> It is convenient for me to use a couple of internal entities, but the
> consumer program recently switched from a DOCTYPE to an XML Schema.
>
> So, enough background. Aside from using both a complete DTD and a complete
> XML Schema, is there anyway to do have a document like the one below? This
> validates with xerces-c (using sample program SAX2Count), but not with
> xerces-j (using sample program sax.Counter -n -f -s -v). Which is
> right?
>
> My reading of the XML spec says that in a well formed document a
> doctypedecl is optional, and if it's included, it's allowed to contain
> only '<!DOCTYPE entschema>'. xerces-j also gives an error in this case.
>
> http://www.w3.org/TR/REC-xml#NT-prolog
>
> It's been a long week, so maybe I'm reading something wrong.
>
> Many thanks,
> Dave
>
> ========================================
> <?xml version="1.0" encoding="UTF-8"?>
>
> <!DOCTYPE entschema [
> <!ENTITY replace "my replacement text">
> ]>
>
> <entschema
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="entschema.xsd">
>
> <text>&replace; here</text>
> </entschema>
>
> ========================================
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>
> <xs:element name="entschema">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="text" type="xs:string"/>
> </xs:sequence>
> </xs:complexType>
> </xs:element>
>
> </xs:schema>
>
> Dave Broudy dave@broudy.net
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org