[Adium-devl] O'Reilly XML blog article: Parsing XML… backwards?

Colin Barrett timber at lava.net
Fri Mar 16 11:17:09 UTC 2007


On Mar 14, 2007, at 12:09 PM, Peter Hosey wrote:

> On Mar 14, 2007, at 00:37:49, Colin Barrett wrote:
>> "</hello-->" is actually pretty easily solved. Don't generate the  
>> "end of comment" until you hit a space or <!--.
>
> Bad solution. <!--hello--> is a legal comment that must be treated  
> as such.

Right. Which is why you delay the firing of the events.

"-->" encountered. Possibly ambiguous. Parser reads more.
"hello" encountered. Still not sure what this is...
"<!--" encountered. Ah, we know it's a comment. Fire off the events  
for a comment.

Or, if it's actually a retardedly named element:

"-->" encountered. Possibly ambiguous. Parser reads more.
"hello" encountered. Still not sure what this is...
"<" encountered. Ah, we know it's a retardedly named element. Fire off  
the events for an element, hunt down the author of the document, and  
shoot them in the fae.

-Colin




More information about the devel mailing list