Re: [xml] Writing DOCTYPE in XML



I´m trying to include a DTD in a XML file, by a DOCTYPE line like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE network SYSTEM "test.dtd">
<network>
...
</network>

I´m using xmlwriter module to write the xml, but how can I include the 
DOCTYPE line to reference test.dtd file.

use the xmlTextWriterWriteDTD call.  something like this, after the
StartDocument call, should work for you:

    xmlTextWriterWriteDTD(writer, (xmlChar *)"network", NULL,
                            (xmlChar *)"test.dtd", NULL);

i had problems with this call when i was using xmlWriter, but i believe 
that it has been fixed in 2.6.7.

-- 
trey



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