Skip to content Skip to sidebar Skip to footer

Is XPath Suitable For HTML5 Format?

We know that XPath is created for XML parsing. What about HTML5 since it doesn't necessarily respect XML rules?

Solution 1:

There are 2 XMLs: Lexical XML and Parsed XML. XPath works against a Parsed XML representation, such as DOM or XDM. You can therefore create Parsed XML from Lexical HTML5, that way you can query HTML5 using XPath.


Solution 2:

XPath is for querying a DOM, not parsing markup. A DOM can be generated from an HTML document, so you can query it with XPath.


Post a Comment for "Is XPath Suitable For HTML5 Format?"