Re: [xml] Building DOM: Adding the DOCTYPE



On Mon, Nov 18, 2002 at 07:22:41PM +0100, Murray Cumming wrote:
When using the libxml DOM interface to build an XML document, how can I
add the DOCTYPE declaration at the top? For instance
<!DOCTYPE example_xml_doc SYSTEM "example_xml_doc.dtd">

use 
xmlDtdPtr
xmlCreateIntSubset(xmlDocPtr doc, const xmlChar *name,
                   const xmlChar *ExternalID, const xmlChar *SystemID);

  xmlCreateIntSubset(doc, "example_xml_doc", NULL, "example_xml_doc.dtd");

 should do what you want.
Note that it won't try to fetch and add the content of  "example_xml_doc.dtd"
it just create a node in the tree and insert it.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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