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

PI, XMLDecl, and EncodingPI

  • From: Chris Hubick <hubick@m...>
  • To: Xml-Dev <xml-dev@i...>
  • Date: Wed, 03 Dec 1997 18:11:19 -0700

xmldecl
I am writing a recursive descent XML parser in Java and have
a couple questions....

The XML Working Draft dated 17-November-1997 states:

[24] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
[28] Misc ::= Comment | PI | S
[19] PI ::= '<?' Name (S (Char* - (Char* '?>' Char*)))? '?>'
[25] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
[79] EncodingPI ::= '<?xml' S 'encoding' Eq QEncoding S? '?>'

	Within a PI is the Name "xml" reserved?  If it is, should
there not be a [wfc] on PI stating so?
	By the current definition any XMLDecl and EncodingPI is also
a valid PI.  In a prolog an XMLDecl is optional, and is followed
by Misc, which includes PI.
	Ok, so I have can have an XML file with no XMLDecl
(it's optional) followed by "<?xml version="blah" encoding=5?>" which
matches PI, in my Misc*.  And this is legal?  My parser will
take this just fine as such, but I wonder about the others.
It makes detecting a bad XMLDecl impossible!  My parser will just
say fine, that wasn't an XMLDecl, and feed it to Misc, which will
most likely match (or possibly spew) it as a PI.

Shouldn't [19] PI have an S? at the end before '?>' ?

Also shouldnt PCData be:

[17] PCData ::= [^<&]+

rather than the current:

[17] PCData ::= [^<&]*
[44] content ::= (element | PCData | Reference | CDSect | PI | Comment)*

because:

<TEST>This is a test</TEST>

In my recursive descent parses to:

<Element>
  <STag><TEST></STag>
  <content>
    <PCData>This is a test</PCData>
    <PCData></PCData>
    <PCData></PCData>
    <PCData></PCData>
    <PCData></PCData>
    <PCData></PCData>
    ...

And we get infinite matches on a zero length PCData.

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


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.