Re: question

Eddie Robertsson <eddie@allette.com.au> writes:

<snip/>

> "When an XML processor recognizes a reference to a parsed entity, in
> order to validate the document, the processor must include its
> replacement text. If the entity is external, and the processor is
> not attempting to validate the XML document, the processor may, but
> need not, include the entity's replacement text.  If a
> non-validating processor does not include the replacement text, it
> must inform the application that it recognized, but did not read,
> the entity."

> Since both XSV and XML Spy validate this without any errors I guess
> the XML processor they're using resolves the external entity without
> actually doing any validation. Correct?

Correct for XSV.

> On the other hand if I run this with MSXML4 I will get an error
> because the external entity is only resolved if DTD validation is
> used and if DTD validation is used I will get errors because the DTD
> dosn't contain any element declarations.  So, in conslusion, if I
> want to be able to use external entities in this way together with
> XML Schema that should work on all processors then the DTD must
> contain all the element/attribute declarations.

> In my example this would be:
> 
> physicaladdress.xml
> --------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE PhysicalAddress [
>  <!ENTITY street SYSTEM  "street.xml">
>  <!ELEMENT PhysicalAddress (Street, State, Country)>
>  <!ATTLIST PhysicalAddress xmlns:xsi CDATA #IMPLIED
>                                                xsi:noNamespaceSchemaLocation CDATA
> #IMPLIED>
>  <!ELEMENT Street (#PCDATA)>
>  <!ELEMENT State (#PCDATA)>
>  <!ELEMENT Country (#PCDATA)>
> ]>
> <PhysicalAddress xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="PhysicalAddress.xsd">
>  &street;
>  <State>NSW</State>
>  <Country>Australia</Country>
> </PhysicalAddress>
> 
> Is this a correct understanding on my part or have I missed something?

I think so.  It was certainly intentional on my and Richard's part
that XSV does _not_ validate the instance, since the REC does _not_
require validated infosets.  An invalid document does _have_ an
infoset, whereas an ill-formed one does not.

I note you could just use the so-called 'Waterloo' DTD -- one which
uses ANY for the model for all the elements.

ht

> [1] http://www.w3.org/TR/2000/REC-xml-20001006#include-if-valid
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/

Received on Saturday, 7 July 2001 10:05:32 UTC