PEReferences in comments
Chris Hubick
maillist at chris.hubick.com
Thu Aug 6 20:17:28 BST 1998
On Thu, 6 Aug 1998, Ron Bourret wrote:
> Are parameter entity references in comments in the external subset
> supposed to be expanded?
I was thinking about just this issue when this mail showed up in
my inbox :-) My initial reaction would be to say that no, they shouldn't
be. A comment should be just that, a comment. Allowing PEReferences
inside comments would mean that if that entity was not declared that you
would get an exception. If you are working on a DTD, and comment out part
of it, you would expect it not to be processed. This never occurred to me
while creating the external DTD grammar (don't use that as a reference,
like I said in the message, I just slapped it together in 5 min to
generate feedback). I have now realized that there is no external grammar
before PE expansion, and have given up wiring PEReferences into my grammar
processing code, that is, you will not be able to get the breakdown of an
_unprocessed_ external parsed entity.
I am just sitting down to write the code to do PEReference
expansion at the lexical level, and was wondering if I have to be able to
shut it off, or if I can just process a _whole_ external entity, which I
am pretty sure I can't. Toggling reference expansion makes this _much_
more complicated. Well, if I just escaped comments looking for '<!--' and
'-->' it wouldn't be that hard, but that is the cheap way out, I want
this code to be more reuseable than that. My XMLSource object acts as a
buffer, and the parser moves forward and back in that buffer (array type
syntax) while trying to identify what is next in the file. The thing is,
"what is next" in this case may (almost everything) or may not (comments)
want PEReference expansion, so I have to be able to say, get me the
character at index x, with PERef's expanded or without.
And I am writing this parser in my _free_ time!? For fun!? God I'm a geek!
---
Chris Hubick
mailto:chris at hubick.com
http://www.hubick.com/
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/
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