Re: [xml] (correct) way to link external subset to newly created XML doc



On Tue, Jan 08, 2002 at 12:18:29PM +0100, Henke, Markus wrote:
Hello,

i'm wondering what's the correct way to create a reference to an
external subset in a document that i'm building from scratch.
It's not that i'm not able to do so, i'm actualy using

xmlCreateIntSubset(myDocPtr, "rootNode", NULL, "myDTD.dtd");

and it works like a charm.
When i'm saving the doc to disk (via xmlSaveFormatFileTo(...)),
it'll look like

<?xml version="1.0"?>
<!DOCTYPE rootNode SYSTEM "myDTD.dtd">
<rootNode>...</rootNode>

and that's exactly what i want.
But, AFAIK that's an *external* subset and i'm using a function named
...Create*Int*Subset (and that's the only function i've found that do
so...).

So, the question: Am i missing something (or have i misunderstood the
meaning of *internal*/*external* subset)?

One can add an internal subset and one external subset *reference* to
an xmlDoc tree.
The internal subset node is part of the document and represented as
an xmlDtdPtr in the children list of the document. It will be serialized
at the same time as the document. The external subset is only referenced
from the xmlDocPtr and of course not serialized as such.

  So yes this creates a reference to the external subset. But that
reference is contained in the document and hence kept as part of the
internal subset informations.

  To create an external subset content, one would need to create a new
xmlDtd, fill it, possibly reference it from the xmlDocPtr, and serialize it 
(using xmlNodeDump() or xmlNodeDumpOutput() with a xmlDtd node should work).

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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