Re: [xml] Parsing a DTD



I succeeded in parsing my dtd-file. I am able to add an
empty internal subset of the dtd into my file using
xmlCreateIntSubset but I have not found out how I
could add the parsed dtd into the internal subset.

I have tried something like this with no luck:

 xmlDtdPtr dtd;
 xmlDtdPtr dtdext;

 dtdext = xmlParseDTD(NULL,(const xmlChar*)"genealog.dtd");
 dtd = xmlCreateIntSubset(doc,(const xmlChar *)"genealog",NULL,NULL);
  xmlAddChildList((xmlNodePtr)dtd,(xmlNodePtr)dtdext);

The resulting xml-file just contains
<!DOCTYPE genealog> but I would hope it would contain

<!DOCTYPE genealog [
<!ELEMENT genealog
(owner?,units,relations,groups,sources,conversions?,checkouts?,reports?,view
s?) >
............
]>

Cannot find much in API list about using the dtd. Any help would be
appreciated.

Kaarle Kaila

--
Kaarle Kaila
email: kaarle dot kaila at iki dot fi
www.iki.fi/kaila



----- Original Message ----- 
From: "Kaarle Kaila" <kaarle kaila iki fi>
To: <xml gnome org>
Sent: Sunday, February 01, 2004 4:57 PM
Subject: Re: [xml] Parsing a DTD


I have tried that and it creates an empty internal DTD skeleton into my
XML-file.
I have my original dtd in the file genealog.dtd that is in the same folder
where my application is.
I have also tried to load it givin it the full path name but the
xmlParseDTD
always returns NULL.

I want to be able to put all my data in the same file- At least it makes
creating the compressed
image easier as I have not yet found out how to insert more than one file
using commands like

xmlSetDocCompressMode (doc,9);
 xmlOutputBufferPtr buf =   xmlOutputBufferCreateFilename((const char
*)"output\\file.xml.gz",NULL,9);
 xmlSaveFileTo(buf,doc,"UTF-8");

Kaarle

--
Kaarle Kaila
email: kaarle dot kaila at iki dot fi
www.iki.fi/kaila


----- Original Message ----- 
From: "John Fleck" <jfleck inkstain net>
To: <xml gnome org>
Sent: Sunday, February 01, 2004 4:26 PM
Subject: Re: [xml] Parsing a DTD


On Sun, 2004-02-01 at 04:32, Kaarle Kaila wrote:
hi,

I am creating an xml file as a backup of my database and now I have
been
trying to add
the DTD into the xml-file. For that purpose I try to read teh dtd
using
the
command below:

 xmlDtdPtr dtd = xmlParseDTD(NULL,(const xmlChar*)"genealog.dtd");


It's not immediately obvious what your error is, but given what it sound
as though you're trying to do, you might want to try xmlCreateIntSubset:

http://www.xmlsoft.org/html/libxml-tree.html#xmlCreateIntSubset

Cheers,
John



_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml




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