RE: [xml] Inserting a DTD when creating a XML file

Hello Yvan,

it could be *very* usefull if you could post the code
that you're actualy using!
Otherwise one just can guess what's happen.

-----Original Message-----
From: Yvan Paitel [mailto:ypaitel sofamordanek com]
Sent: Friday, January 25, 2002 2:05 AM
To: 'veillard redhat com'; darrell
Cc: xml gnome org
Subject: RE: [xml] Inserting a DTD when creating a XML file

If I save the document (using xmlSaveFile or 
xmlSaveFileFormat), the DTD is
neither included nor referenced in the xml file. Any idea? 

Thanks for your help,

-----Original Message-----
From: Daniel Veillard [mailto:veillard redhat com]
Sent: Thursday, January 24, 2002 7:36 AM
To: darrell
Cc: ypaitel sofamordanek com; xml gnome org
Subject: Re: [xml] Inserting a DTD when creating a XML file

On Tue, Jan 22, 2002 at 09:17:44PM -0700, darrell wrote:
i am unsure if anyone is alowed to reply,

  Of course !

but this is an exerpt from the 
faq, perhaps it is not what you are looking for?

It is also possible to simply add a Dtd to an existing document:

xmlDocPtr doc; /* your existing document */
        xmlDtdPtr dtd = xmlParseDTD(NULL, filename_of_dtd); 
/* parse the
DTD */
        dtd->name = xmlStrDup((xmlChar*)"root_name"); /* 
use the given
root */

        doc->intSubset = dtd;

  It can be a good idea to link the DTD as the first node in the doc
children list:
     if (doc->children == NULL)
         xmlAddChild((xmlNodePtr) doc, (xmlNodePtr) dtd);
         xmlAddPrevSibling(doc->children, (xmlNodePtr) dtd);


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

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