[prev in list] [next in list] [prev in thread] [next in thread]
List: xml-dev
Subject: Re: [xml-dev] XML Quiz
From: David Carlisle <d.p.carlisle () gmail ! com>
Date: 2022-05-03 14:29:46
Message-ID: CAEW6iOi+6eLjPQo0QadVA-_0dr8Qa=tiBN+hv0FOTa5M0HCyCw () mail ! gmail ! com
[Download RAW message or body]
On Tue, 3 May 2022 at 13:28, Roger L Costello <costello@mitre.org> 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
[Attachment #3 (text/html)]
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Tue, 3 May 2022 at 13:28, Roger L Costello <<a \
href="mailto:costello@mitre.org">costello@mitre.org</a>> \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="overflow-wrap: break-word;" lang="EN-US">
<div class="gmail-m_-1879915322665863281WordSection1">
<p class="MsoNormal">After XML parsing is complete, every occurrence of &amp; \
will have been replaced by &<u></u><u></u></p> <p class="MsoNormal"><u></u> \
<u></u></p> <ol style="margin-top:0in" type="a" start="1">
<li class="gmail-m_-1879915322665863281MsoListParagraph" \
style="margin-left:0in">True<u></u><u></u></li><li \
class="gmail-m_-1879915322665863281MsoListParagraph" \
style="margin-left:0in">False<u></u><u></u></li></ol> <p class="MsoNormal"><u></u> \
<u></u></p> <p class="MsoNormal">Scroll down to see the answer \
……………<u></u><u></u></p> <p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">False! If the &amp; is within a CDATA section or within a \
comment, then it will be unchanged. Otherwise, it will be changed.<u></u><u></u></p> \
<p class="MsoNormal"><u></u> <u></u></p> <p class="MsoNormal">Lesson Learned: An XML \
lexer/parser must perform conditional processing:<u></u><u></u></p> <p \
class="MsoNormal"><u></u> <u></u></p> <p class="MsoNormal">IF (&amp; is within a \
CDATA section or comment) THEN<u></u><u></u></p> <p class="MsoNormal"> \
OUTPUT("&amp;")<u></u><u></u></p> <p class="MsoNormal">ELSE<u></u><u></u></p>
<p class="MsoNormal"> \
OUTPUT("&")</p></div></div></blockquote><div><br></div><div>That's a strange \
way to describe the condition (and I doubt it corresponds to real \
code)</div><div>It's not that you scoop up `&amp;` then decide what to do \
with it, rather it is</div><div><br></div><div>if & is within a CDATA section or \
comment or PI ....<br></div><div> &</div><div>else</div><div> start scanning \
for an entity or character reference</div><div><br></div><div><br></div><div>Your \
description would need separate tests for &amp; and &rightarrow; and \
&eacute; ....</div><div><br></div><div>David</div><div><br></div><div><br></div></div></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic