[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Unnecessary well-formedness constraint

  • From: Justin Lipton <justin@s...>
  • To: "Xml-Dev (E-mail 2)" <xml-dev@l...>
  • Date: Sat, 14 Oct 2000 09:20:40 +1000

dtd well formedness
Perhaps I'm missing the point on this thread:


Example:
We use the parameter entity extras to either IGNORE or INCLUDE an element in
the DTD.

DTD:
<!-- Highest level construct is bugs. Start with this.  -->
<![ %extras; [
        <!ELEMENT revision (#PCDATA)>
		<!ATTLIST revision version (1|2|3|4) "1">

]]>

<!ELEMENT bugs (bug*)>

	<!ELEMENT bug (reporter, descriptor, resolution)>
		<!ATTLIST bug ID ID #REQUIRED>
		<!ATTLIST bug type (Defect | Functionality_Change|Enhancement | WishList)
"Defect">
	<!ATTLIST bug category (Critical | Major | ASAP | Minor) "Critical">
	<!ATTLIST bug component (Editor | Engine| Conversion | Repository | DTD)
"Editor">
	<!ATTLIST bug status (open|closed|in_progress|on_hold) "open">

	<!ELEMENT reporter (who, date)>
		<!ELEMENT who (#PCDATA)>
		<!ELEMENT date (#PCDATA)>

	<!ELEMENT descriptor (#PCDATA)>
		<!ATTLIST descriptor platform
(Windows95|Windows98|WindowsNT|Windows2000|Linux|Mac|All) "Linux">

	<!ELEMENT resolution (todo, modules, fixer)>
	<!ELEMENT todo (#PCDATA)>
	<!ELEMENT modules (#PCDATA)>
	<!ELEMENT fixer (who, date)>






XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE bugs SYSTEM "bugs.dtd" [
        <!ENTITY % extras "IGNORE">
]>

<bugs>
	<bug type="Defect" status="closed" component="Editor" category="Critical"
ID="editor1">

		<reporter>
			<who>JML</who>
			<date>14 Sept 2000</date>
		</reporter>

		<descriptor platform="Windows2000">
		Parsing of internal subspaces is casing problems.
		</descriptor>

		<resolution>
			<todo/>
			<modules>
			DOM liasons?
			</modules>

			<fixer>
				<who>JML</who>
				<date>20000915</date>
			</fixer>

		</resolution>
	</bug>
</bugs>

Our experience so far is that some parsers handle this and some don't -
Xerces seems to like it, XML4J doesn't, XMLSpy doesn't etc.

Is this a valid construct?
According to below (Section 4-1 of XML 1.0 spec)
"Parameter-entity references may only appear in the DTD."

Yours in confusion,
Justin.


-----Original Message-----
From: Martin Gudgin [mailto:marting@d...]
Sent: Friday, 13 October 2000 07:15
To: XML-Dev Mailing list
Subject: Re: Unnecessary well-formedness constraint


> "Elliotte Rusty Harold" wrote
>
> Section 4-1 of the XML 1.0 second edition spec states:
>
>
> Well-Formedness Constraint: In DTD
> Parameter-entity references may only appear in the DTD.
>
>
> The Annotated XML spec notes that:
>
> This constraint is not actually wrong, but it is rather misleading.
> Suppose I have a parameter entity named Fred, then if the string %Fred;
> appears somewhere in the document, outside of the DTD, that's not an
> error as this suggests; it's just the string %Fred;.
>
> So my question is why is this constraint here at all? What is its
> effect? If we removed it form the spec (say in the third edition) would
> this in any way change which document are considered to be well-formed
> or valid? Would removing it give parsers any leeway they don't have now?
> Right now this seems like an unnecessary statement to me.
>

My understanding is that the spec is correct; parameter entity references
cannot appear outside of a DTD, the reason being that outside of a DTD
%Fred; is *not* a reference to a parameter entity, it's just the string
%Fred;. Put another way the % character is only treated specially in the
DTD, it is treated just like any other character when encountered in the XML
part of the document.

Martin Gudgin
DevelopMentor



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.