[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: A question for parsing experts: How to recognize that'<' d

  • From: "Liam R. E. Quin" <liam@fromoldbooks.org>
  • To: Roger L Costello <costello@mitre.org>, "xml-dev@l..." <xml-dev@l...>
  • Date: Tue, 16 Feb 2021 15:20:02 -0500

Re:  A question for parsing experts: How to recognize that'<' d
On Tue, 2021-02-16 at 17:52 +0000, Roger L Costello wrote:
> 
> 
> In the scanning process, you encounter a less than ( '<' ) symbol
> You must determine if it denotes the beginning of a start tag.

Wellm i did badly on the last parsing question, let's see if i can do
badly here too :) again before coffee!

> 
> Let c = the character currently being examined.
> Let nextchar = the character following c
> 
> if c == '<' and nextchar != '/' and nexchar != '!' and nextchar !=
> '?' then we are at the beginning of a start tag
> 
> Do you agree? Am I missing any checks?

You need to apply the test in the right place - you're not ging to see
a start tag inside an attribute value or comment or CDATA section or in
the internal subset outside of an entity replacement value (< is
notallowed unescaped in system or public identifiers).

If you do encounter a < in those other contexts, the input is not well-
formed. In places (e.g. public identifiers) the grammar enforces this;
elsewhere (e.g. system identifiers) it's made explicit in the prose.

In entity replacement texts, you don't want to tokenize until the
entity is actually used.

Also, you only have a start-tag (as the spec calls them) if nextchar is
a name start character. For example, <
boy
>
is not allowed, but
<girl
>
is fine is as
<enby>

Liam



-- 
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.