From: Michael Mealling (michael@bailey.dscga.com)
Date: Mon Dec 04 2000 - 19:14:25 EST
On Mon, Dec 04, 2000 at 02:31:39PM +0100, Daniel Veillard wrote:
> On Sun, Dec 03, 2000 at 06:20:06PM -0500, Michael Mealling wrote:
> > I'm building a client application that will receive XML back from
> > several different servers which may decide to put different values in
> > thier SYSTEM identifier in their DOCTYPE. After poking around
> > trying to find an example of validatinog as you parsed (i.e.
> > xmlDoValidityCheckingDefaultValue = 1) it became obvious that
> > default behavior was to access whatever was in the SYSTEM ID regardless
> > of what the PUBLIC ID was. So I decided to write an ExternalEntityLoader.
> > Not finding an example of one I looked at the default one in xmlIO.c.
> > Its header looks like this:
> >
> > * xmlDefaultExternalEntityLoader:
> > * @URL: the URL for the entity to load
> > * @ID: the System ID for the entity to load
> > * @ctxt: the context in which the entity is called or NULL
> >
> > Is this correct?
>
> I think so except that ID is actually the PUBLIC id.
That's cool. I got all of this figured out but now I think
there might be a bug or else a problem in the reading of the XML spec.
I have a DTD that has this in it:
<!ELEMENT results (status? |
( service+,
( status | resourcedescriptor | referral )*
)*
)>
and when I give it this:
<!DOCTYPE cnrp PUBLIC "-//IETF//DTD CNRP 1.0//EN" "http://www.ietf.org/cnrp.dtd">
the parser barfs these errors:
Based on other parsers and my reading of the XML spec, that DTD
Thanks!
-MM
The entire DTD:
<!ELEMENT cnrp (query|results|servicequery)>
<!ELEMENT resourcedescriptor (commonname,id,resourceuri,
<!ELEMENT resourceuri (#PCDATA)>
<!ELEMENT referral (serviceref, datasetref?)>
<!ELEMENT status (#PCDATA)>
<!ELEMENT serviceref EMPTY>
<!ELEMENT service (serviceuri, dataset*,
<!ELEMENT server (serveruri, property*)>
<!ELEMENT dataset (property*)>
<!ELEMENT datasetref EMPTY>
<!ELEMENT propertyschema (propertydeclaration*)>
<!ELEMENT propertyname (#PCDATA)>
<!ELEMENT queryschema (propertyreference*)>
<!ELEMENT resourcedescriptorschema (propertyreference*)>
<!ELEMENT serviceschema (propertyreference*)>
<!ELEMENT propertyreference EMPTY>
This archive was generated by hypermail 2b29
: Mon Dec 04 2000 - 19:43:38 EST
<cnrp>
<results>
<service id="service1" ttl="10000">
<serviceuri>http://cnrp.networksolutions.com>
</service>
<resourcedescriptor>
<commonname>BAILEY BEAR</commonname>
<id>8000112</id>
<resourceuri>http://bailey.dscga.com/>
<serviceref ref="service1"/>
<description>Michael and Kathy's Golden Retriever</description>
</resourcedescriptor>
</results>
</cnrp>
Element results content doesn't follow the Dtd
Expecting (status? | (service+ , (status | resourcedescriptor | referral)*)*),
got (service resourcedescriptor )
should allow that xml. Any clues as to why libxml tags that as an error?
<!ELEMENT servicequery EMPTY>
<!ELEMENT query (id|(commonname,property*))>
<!ELEMENT id (#PCDATA)>
<!ELEMENT commonname (#PCDATA)>
<!ELEMENT property (#PCDATA)>
<!ATTLIST property name CDATA #REQUIRED>
<!ATTLIST property type CDATA "freeform">
<!ELEMENT results (status? |
( service+,
( status | resourcedescriptor | referral )*
)*
)>
serviceref, datasetref?,
description,
property*)>
<!ATTLIST resourcedescriptor id ID #IMPLIED>
<!ELEMENT description (#PCDATA)>
<!ATTLIST referral id ID #IMPLIED>
<!ATTLIST status code CDATA #REQUIRED>
<!ATTLIST status ref IDREF #IMPLIED>
<!ATTLIST serviceref ref IDREF #IMPLIED>
servers?,
description?,
property*,propertyschema?,queryschema?,resourcedescriptorschema?,
serviceschema?)>
<!ATTLIST service ttl CDATA "0">
<!ATTLIST service id ID #IMPLIED>
<!ELEMENT serviceuri (#PCDATA)>
<!ELEMENT servers (server+)>
<!ELEMENT serveruri (#PCDATA)>
<!ATTLIST dataset id ID #IMPLIED>
<!ATTLIST datasetref ref IDREF #IMPLIED>
<!ELEMENT propertydeclaration (propertyname, propertytype*)>
<!ATTLIST propertydeclaration id ID #IMPLIED>
<!ELEMENT propertytype (#PCDATA)>
<!ATTLIST propertytype default (no|yes) "no">
<!ATTLIST propertyreference ref IDREF #REQUIRED>
<!ATTLIST propertyreference required (no|yes) "no">
--
--------------------------------------------------------------------------------
Michael Mealling | Vote Libertarian! | www.rwhois.net/michael
Sr. Research Engineer | www.ga.lp.org/gwinnett | ICQ#: 14198821
Network Solutions | www.lp.org | michaelm@netsol.com
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net