Re: [xml] DOM Parser + entities



On Wed, Oct 15, 2003 at 04:41:06PM +0200, Murray Cumming Comneon com wrote:
I'm using the DOM Parser, with replaceEntities=0 in the parser context, so
that the entity references appear in the tree instead of being resolved
automatically to text.

The entity reference node types are XML_ENTITY_REF_NODE, and, from looking
at the source code, the nodes seem to be plain xmlNodes and don't need to be
casted to any other struct type.

So, 2 questions:
1. What useful things can I discover about this node other than the name?
Maybe nothing. I'm clueless.

  Well an entity REF points though content to an entity DECL,
see xmlEntityPtr / struct _xmlEntity , after the usual navigation
fields you will find

    xmlChar                *orig;       /* content without ref substitution */
    xmlChar             *content;       /* content or ndata if unparsed */
    int                   length;       /* the content length */
    xmlEntityType          etype;       /* The entity type */
    const xmlChar    *ExternalID;       /* External identifier for PUBLIC */
    const xmlChar      *SystemID;       /* URI for a SYSTEM or PUBLIC Entity */
                                                                                
    struct _xmlEntity     *nexte;       /* unused */
    const xmlChar           *URI;       /* the full URI as computed */
    int                    owner;       /* does the entity own the childrens */

  that's a lot of informations about the entity.

2. I notice that these Entity Reference nodes have children. The child node
types are XML_ENTITY_DECL, but I can't see any logic to it. Are these child
nodes useful/meaningful.

  Multiple entity ref can point to the same declaration
a declaration is the equivalent to <!ENTITY in the DTD.

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]