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

On Tue, Jan 08, 2002 at 02:59:27PM +0100, Henke, Markus wrote:
  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.

OK, that'll work for me ATM.
But what's to do when i actually use an internal (build from scratch)
*and* an (existing) external subset?
When i create the *reference* to the external subset
via xmlCreateIntSubset(), xmlDocPtr->intSubset points to the *external*

 it does it by name. Not by a pointer to the xmlDtdPtr.

Who's than pointing to the internal subset, and where
xmlDocPtr->extSubset is pointing to?

 this one points to the xmlDtdPtr of the external subset.

In a nutshell if you have internal and external subsets:
   - The DOCTYPE declaration generates an xmlDtdPtr node which is
     one of the children of the xmlDocPtr (before the root element)
   - This xmlDtdPtr is also referenced from the xmlDocPtr as 
   - the external subset System ID and Public ID are stored in this
     xmlDocPtr->intSubset because they are actually carried by the DOCTYPE
     as xmlDocPtr->intSubset->ExternalID and xmlDocPtr->intSubset->SystemID
   - the external subset (if parsed which is not the default behaviour)
     is stored as xmlDocPtr->extSubset

If you have no external subset but an internal subset:
   - xmlDocPtr->extSubset is NULL
   - xmlDocPtr->intSubset->ExternalID and xmlDocPtr->intSubset->SystemID are

If you have no internal subset but an external subset:
   - it's like the case where both are present except xmlDocPtr->intSubset
     have no children

If you have no internal subset nor external subset:
   - both xmlDocPtr->intSubset and xmlDocPtr->extSubset are NULL
   - there should be no xmlDtdPtr in the full document tree.

 I hope this clear things up,


Daniel Veillard      | Red Hat Network
veillard redhat com  | libxml Gnome XML XSLT toolkit | Rpmfind RPM search engine

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