Re: XML Quiz
David Carlisle <[email protected]>
| Newsgroups | gmane.text.xml.devel |
|---|---|
| Message-ID | <CAEW6iOi+6eLjPQo0QadVA-_0dr8Qa=tiBN+hv0FOTa5M0HCyCw@mail.gmail.com> |
On Tue, 3 May 2022 at 13:28, Roger L Costello <[email protected]> wrote: > After XML parsing is complete, every occurrence of & will have been > replaced by & > > > > 1. True > 2. False > > > > Scroll down to see the answer …………… > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > False! If the & is within a CDATA section or within a comment, then it > will be unchanged. Otherwise, it will be changed. > > > > Lesson Learned: An XML lexer/parser must perform conditional processing: > > > > IF (& is within a CDATA section or comment) THEN > > OUTPUT(“&”) > > ELSE > > OUTPUT(“&”) > That's a strange way to describe the condition (and I doubt it corresponds to real code) It's not that you scoop up `&` then decide what to do with it, rather it is if & is within a CDATA section or comment or PI .... & else start scanning for an entity or character reference Your description would need separate tests for & and → and é .... David