From: Daniel Veillard (Daniel.Veillard@imag.fr)
Date: Tue Jan 23 2001 - 13:57:37 EST
On Tue, Jan 23, 2001 at 01:16:21PM -0500, Fred_Smith@computrition.com wrote:
[snip]
> DTD is stored in a file named "CI7.dtd". I don't want the !DOCTYPE tag to
> include either the "SYSTEM" or the ""CI7.dtd"" fields, I want it just as
> shown in the first file.
>
> Here's an excerpt of the code I'm using to create the second file shown
> above, can someone show me what I need to change to make it work in the
> desired way?
>
> #include <stdio.h>
> #include <fcntl.h>
> #include <stdlib.h>
> #include <sys/types.h>
> #include <unistd.h>
> #include <libxml/tree.h>
> #include <libxml/SAX.h>
> int main (int argc, char ** argv)
> {
> xmlDocPtr doc;
> xmlNodePtr root;
> xmlDtdPtr dtd;
> doc = xmlNewDoc("1.0");
> dtd = xmlParseDTD (NULL, "CI7.dtd");
the xmlDtdPtr structure is defined in tree.h
add the following there:
if (dtd->ExternalID != NULL) {
xmlFree((xmlChar *) dtd->ExternalID);
dtd->ExternalID = NULL;
}
if (dtd->SystemID != NULL) {
xmlFree((xmlChar *) dtd->SystemID);
dtd->SystemID = NULL;
}
you should also test that xmlNewDoc and xmlParseDTD didn't
returned NULL,
> doc->intSubset = dtd;
> dtd->parent = doc;
> dtd->doc = doc;
> doc->children = (xmlNodePtr) dtd;
>
> root = xmlNewDocNode(doc, NULL, "EXAMPLE", NULL);
> xmlDocSetRootElement (doc, root);
> <snip>
> }
>
> I'd appreciate some pointers/help in accomplishing this, I've been going
> crosseyed trying to read my way through the library hoping to figure it
> out, but so far I'm merely going blind.
this kind of change is rather uncommon so there is no API
for those, but the structures are public (in tree.h)
Daniel
-- Daniel Veillard | Red Hat Network http://redhat.com/products/network/ veillard@redhat.com | libxml Gnome XML toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ ---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net
This archive was generated by hypermail 2b29 : Tue Jan 23 2001 - 14:43:39 EST