[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] PI, XMLDecl, and EncodingPI
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|