Hi Rocco.

Well, I'll explain 'in extenso'.

Basically when you load an XML document using Expat the parser does the parsing using the elements and entities it knows + normal XML rules (like "tags begin with <something> and end in </something>"). Every XML has a DTD explaining how to decide whether the document is well formed and correct but, as expat is not a validating parser, it doesn't make any attempt at loading it and goes on using the normal XML rules. That is why some of the entities (like &lt;) work, as opposed to others (&nbsp;): they work because they are defined in the XML ruleset, *not* because they belong to the document DTD.

So, what is the solution? Loading the DTD. Expat knows how to parse a DTD, but it doesn't know where to find them. It even provides a handler (ExternalEntityRefHandler) for this special case: when it finds a reference to an external file, it gives you the possibility of retrieving it and pass its content to the parser. So what I'll do is add an ExternalEntityRefHandler to the expat parser in Kid.

Notices that this will not only allow Kid to parse correctly XHTML, but to parse correctly *any* kind of document with a DTD. So Kid would use one of the most standards compliant parser in the world :P

I'll try to implement this in the next few hours. Keep you all updated.

David

Rocco wrote:

I woul like ttis explanation, David.

Rocco



Reply via email to