3 ms·
… yes? It’s simple XML parsing, and then taking it as text, serialised HTML, or an already-parsed DOM tree. You are using an actual XML parser, right? In most
by chrismorgan 3mo ago
… yes? It’s simple XML parsing, and then taking it as text, serialised HTML, or an already-parsed DOM tree. You are using an actual XML parser, right?
In most environments it’s no harder, and in browsers themselves (which is where half of it is consumed) it’s arguably easier.
- inigyou 3mo agothe DOM tree is going to say either html:code or {http://something}code neither of which is just code.
- chrismorgan 3mo agoWhen an XML document contains HTML, the DOM representation is of elements in the http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml namespace. When you parse a document or fragment that is in HTML syntax, the DOM representation is of elements in the http://www.w3.org/1999/xhtml http://www.w3.org/1999/xhtml namespace. There is no difference.
- inigyou 3mo agoHope your parser implements all this correctly!
- chrismorgan 3mo agoIt’s genuinely easier to get it right than to get it wrong.
- qznc 3mo agoHTML5 is not XML. You don’t need to close your <p> for example. If I include such valid HTML5 into Atom it is invalid XML. Well, I can use <![CDATA but that is weird too.
- chrismorgan 3mo agoYou’re talking about writing it. The question here is reading it.