Re: Why is < illegal in an attribute value but the equivalent hex and decimal character entities are legal?
Roger L Costello <[email protected]>
| Newsgroups | gmane.text.xml.devel |
|---|---|
| Message-ID | <SA9PR09MB5952CF7AFA593C0C24B1ECDBC8129@SA9PR09MB5952.namprd09.prod.outlook.com> |
Thanks Pete. That makes sense.
And to be sure that I am crystal clear, when you say:
Internal logic converts "<x>blah</x>" to "<x>blah</x>"
The resulting converted value:
"<x>blah</x>"
does _not_ mean there is an element <x> with value blah. Rather, it means there is a stream of characters '<', 'x', '>', 'b', 'l', 'a', 'h', '<', '/', 'x', '>' and those characters have no semantics and are not to be interpreted.
Correct?
/Roger
-----Original Message-----
From: Pete Cordell <[email protected]>
Sent: Thursday, March 17, 2022 7:48 AM
To: Roger L Costello <[email protected]>; [email protected]
Subject: [EXT] Re: [xml-dev] Why is < illegal in an attribute value but the equivalent hex and decimal character entities are legal?
On 17/03/2022 11:25, Roger L Costello wrote:
> So this is perfectly well-formed XML:
>
> <Test foo="<x>blah</x>"/>
>
> And the numeric character references will be replaced during the parsing process to yield this:
>
> <Test foo="<x>blah</x>"/>
I'd say that parsing <Test foo="<x>blah</x>"/> yields an attribute named "foo" with a value of "<x>blah</x>".
It's not creating an alternate piece of XML that is then parsed again.
The sequence is more like:
- Low level XML tokeniser reads attribute name "foo"
- Low level parse checks it's followed by "=" and quotes
- Low level parser reads until it finds end quote, getting "<x>blah</x>"
- Internal logic converts "<x>blah</x>" to "<x>blah</x>"
- Internal logic creates a data record for an attribute of name "foo"
with value "<x>blah</x>" and associates it with the element "Test".
Regards,
Pete.
--
---------------------------------------------------------------------
Pete Cordell
Codalogic Ltd
Read & write XML in C++, http://www.xml2cpp.com
---------------------------------------------------------------------
_______________________________________________________________________
XML-DEV is a publicly archived, unmoderated list hosted by OASIS to support XML implementation and development. To minimize spam in the archives, you must subscribe before posting.
[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: [email protected]
subscribe: [email protected] List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php