& entity

  • Thread starter Robert Frost-Bridges
  • Start date
R

Robert Frost-Bridges

Does a parser or processing application not work through a document one
character at a time starting from the first?

I have begun reading up on xml and note that in certain circumstances &
is to be escaped with & just as I have often done when writing html.
How is it that & can confuse but & is ok when the first character of
the entity is the one being escaped?
 
J

Jukka K. Korpela

Robert Frost-Bridges said:
Does a parser or processing application not work through a document one
character at a time starting from the first?

Not necessarily. There is not prohibition against parallel processing.
I have begun reading up on xml and note that in certain circumstances &
is to be escaped with & just as I have often done when writing html.

XML, the strongly simplified form of SGML, makes it mandatory to "escape"
& as & in all contexts, when it is meant to be a data character.
(Triviality is progress. War is peace.) Ref.:
http://www.w3.org/TR/REC-xml#syntax
How is it that & can confuse but & is ok when the first character of
the entity is the one being escaped?

The character & does not confuse. It indicates the start of an entity
reference or a character reference in certain contexts by SGML rules.
XML simplifies this.
 
T

Toby A Inkster

Robert said:
How is it that & can confuse but & is ok when the first character of
the entity is the one being escaped?

'&' *always* means 'this is the start of an entity' in XML. There is no
room for confusion.
 
R

Robert Frost-Bridges

R

Robert Frost-Bridges

'&' *always* means 'this is the start of an entity' in XML. There is no
room for confusion.

Which is what I didn't quite get, 'til this thread. If I type red&blue
it will throw up an error because there is no entity &blue.

It's all clear to me now :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top