0

As I know, HTML5 has standard parsing algorithm:

http://www.whatwg.org/specs/web-apps/current-work/multipage/parsing.html#parsing

But I didn't find a corresponding one for XML. Does it have ?

I also found one for XHTML.

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#xml-parser

But it is extremely general compared to the HTML5's. Is it the same with XML's ?

1
  • 2
    The standard for the HTML parser is so complex because it have to cope with various degrees of malformed markup. An XML parser just quits if it gets something unexpected. Commented Sep 15, 2012 at 0:16

2 Answers 2

1

XML has a very well defined grammar in the XML Specification (5th Edition). All XML parsers should follow that CFG exactly to produce the same parsing result.

Sign up to request clarification or add additional context in comments.

Comments

1

Generally, specification writers try to avoid including algorithms: specifications are written to define the effect of every possible input, without constraining the ability of implementors to invent their own algorithms for achieving the required result. The reason HTML5 includes an algorithm is an admission of failure; browsers have developed so many strange quirks that it is no longer possible to specify their behaviour at an abstract level, it can only be done by standardizing the actual algorithms.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.