Yet another niggling XML syntax question

David Brownell db at Eng.Sun.COM
Mon Mar 1 22:20:52 GMT 1999


roddey at us.ibm.com wrote:
> 
> Does the following violate the 'partial markup in entity' rule of XML?
> 
> <!ENTITY Part1 "<!ELEMENT ">
> <!ENTITY Part2 " Bubba ANY>">
> <!ENTITY Whole "%Part1;%Part2">
> %Whole;

I'll assume you intended to work with parameter entities; then as Richard
pointed out this can be legal ... if the three syntax errors are corrected
("<ENTITY % Part" twice, "%Part2;") AND if this is found in an external
parameter entity not an internal one (which disallows PEs inside entity
declarations -- a WF constraint).


> So I'm assuming
> that this is ok, that the prohibition against partial markup refers to the
> eventual use of the entity, not to the definition thereof?

Right -- this would violate _validity_ constraints (but a nonvalidating
parser should accept it just fine):

	<!DOCTYPE Bubba [
	  <!ENTITY % Part1 "<!ELEMENT ">
	  <!ENTITY % Part2 " Bubba ANY>">
	  <!-- next is a validity error in both internal
		 and external subsets -->
	  %Part1;%Part2;
	]>
	<Bubba></Bubba>

Another way to make an error out of your declarations is to make the
PEs be external, not internal -- then they'd not match full grammatical
productions.

- Dave

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list