Re: [xml] Embedding DTD into document

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Tue Jun 13 2000 - 15:08:43 EDT


On Thu, Jun 01, 2000 at 01:43:36PM -0600, Greg Sjaardema wrote:
> I am using XML as the basis for describing the syntax of the commands
> that a code parser understands. The syntax for each command or block of
> commands is described in a single file. A separate application was
> written that reads all of the individual files, verifies their
> structure, verifies correct nesting of commands and that all referenced
> commands are defined, strips out data and comments, and then writes an
> XML file containing all of the commands in a single file. This is all
> working great, but I would also like to output the DTD at the beginning
> of this file so there is only a single file to move to different
> platforms, and other considerations. I have been unable to find the
> correct sequence of calls that would let me read in the external DTD and
> then write it out as an 'internal' DTD in my concatenated XML file.
>
> Is this possible, if so, where should I look in the documentation.

  Something like the following:

{
  xmlDocPtr doc = xmlParseFile(...);
  xmlDtdPtr dtd = xmlParseDTD(NULL, ...);

  doc->InternalSubset = dtd;

  xmlSaveFile(..., doc);
  xmlFreeDoc(doc); /* do not free the Dtd twice */
}

  Doc is in:
    http://xmlsoft.org/gnome-xml-parser.html for xmlParseDTD ()
                                             and xmlParseFile()
    http://xmlsoft.org/gnome-xml-tree.html for xmlSaveFile ()

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
Message from the list xml@xmlsoft.org
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@xmlsoft.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 02 2000 - 12:30:14 EDT