Re: [xml] Problem Creating DTD for programatically generated document



On 01/24/2012 01:09 PM, Michael Maul wrote:
The below appears to conform to the meaning of the AIP doc vor xmlNewDtd
    dtd2 =
xmlNewDtd(xml_doc3,"HTML","http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd","-//W3C//DTD
XHTML 1.0 Strict//EN");
However when the document is dumped it yeilds
   <?xml version="1.0"?>
   <!DOCTYPE HTML PUBLIC
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"; "-//W3C//DTD XHTML
1.0 Strict//EN">

First off, I was never able to use xmlNewDtd to create a DOCTYPE
declaration which would appear inside of a document (when doing
xmlDocDump*). Instead, I had to use xmlCreateIntSubset. I'm not sure if
that's just me, so if you're able to generate the declaration using
xmlNewDtd, good on ya!

Which has the external and system in the wrong order. If I try and end
run around and revers the external and system args the xmlNewDtd fails.

It is my understanding that the two are in the correct order. ExternalID
refers to the Formal Public Identifier and SystemID refers to the actual
URI of the DTD [1].

In your case:
 - ExternalID: "-//W3C//DTD XHTML 1.0 Strict//EN"
 - SystemID: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";

I'm not sure what you mean by "xmlNewDtd fails." I tried with the order
reversed and there was no 'failure' (other than what I've always
experienced - no DOCTYPE declaration - which might be an error on my part).

So is this a bug, does it matter, or what am I doing wrong?
I don't know if this is a bug, but you could get the desired behavior
using xmlCreateIntSubset, instead.

I'd appreciate it if you could share the way in which you force the
newly created dtd (dtd2) to be output with the document.

P



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]