2 * Summary: interfaces for tree manipulation
3 * Description: this module describes the structures found in an tree resulting
4 * from an XML or HTML parsing, as well as the API provided for
5 * various processing on that tree
7 * Copy: See Copyright for the status of this software.
9 * Author: Daniel Veillard
12 #ifndef __XML_TREE_H__
13 #define __XML_TREE_H__
16 #include <libxml/xmlversion.h>
17 #include <libxml/xmlstring.h>
24 * Some of the basic types pointer to structures:
27 typedef struct _xmlParserInputBuffer xmlParserInputBuffer
;
28 typedef xmlParserInputBuffer
*xmlParserInputBufferPtr
;
30 typedef struct _xmlOutputBuffer xmlOutputBuffer
;
31 typedef xmlOutputBuffer
*xmlOutputBufferPtr
;
34 typedef struct _xmlParserInput xmlParserInput
;
35 typedef xmlParserInput
*xmlParserInputPtr
;
37 typedef struct _xmlParserCtxt xmlParserCtxt
;
38 typedef xmlParserCtxt
*xmlParserCtxtPtr
;
40 typedef struct _xmlSAXLocator xmlSAXLocator
;
41 typedef xmlSAXLocator
*xmlSAXLocatorPtr
;
43 typedef struct _xmlSAXHandler xmlSAXHandler
;
44 typedef xmlSAXHandler
*xmlSAXHandlerPtr
;
47 typedef struct _xmlEntity xmlEntity
;
48 typedef xmlEntity
*xmlEntityPtr
;
53 * default buffer size 4000.
55 #define BASE_BUFFER_SIZE 4096
58 * LIBXML_NAMESPACE_DICT:
60 * Defines experimental behaviour:
61 * 1) xmlNs gets an additional field @context (a xmlDoc)
62 * 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc.
64 /* #define LIBXML_NAMESPACE_DICT */
67 * xmlBufferAllocationScheme:
69 * A buffer allocation scheme can be defined to either match exactly the
70 * need or double it's allocated size each time it is found too small.
74 XML_BUFFER_ALLOC_DOUBLEIT
, /* double each time one need to grow */
75 XML_BUFFER_ALLOC_EXACT
, /* grow only to the minimal size */
76 XML_BUFFER_ALLOC_IMMUTABLE
, /* immutable buffer */
77 XML_BUFFER_ALLOC_IO
/* special allocation scheme used for I/O */
78 } xmlBufferAllocationScheme
;
85 typedef struct _xmlBuffer xmlBuffer
;
86 typedef xmlBuffer
*xmlBufferPtr
;
88 xmlChar
*content
; /* The buffer content UTF8 */
89 unsigned int use
; /* The buffer size used */
90 unsigned int size
; /* The buffer size */
91 xmlBufferAllocationScheme alloc
; /* The realloc method */
92 xmlChar
*contentIO
; /* in IO mode we may have a different base */
98 * This is the namespace for the special xml: prefix predefined in the
99 * XML Namespace specification.
101 #define XML_XML_NAMESPACE \
102 (const xmlChar *) "http://www.w3.org/XML/1998/namespace"
107 * This is the name for the special xml:id attribute
109 #define XML_XML_ID (const xmlChar *) "xml:id"
112 * The different element types carried by an XML tree.
114 * NOTE: This is synchronized with DOM Level1 values
115 * See http://www.w3.org/TR/REC-DOM-Level-1/
117 * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
118 * be deprecated to use an XML_DTD_NODE.
122 XML_ATTRIBUTE_NODE
= 2,
124 XML_CDATA_SECTION_NODE
= 4,
125 XML_ENTITY_REF_NODE
= 5,
129 XML_DOCUMENT_NODE
= 9,
130 XML_DOCUMENT_TYPE_NODE
= 10,
131 XML_DOCUMENT_FRAG_NODE
= 11,
132 XML_NOTATION_NODE
= 12,
133 XML_HTML_DOCUMENT_NODE
= 13,
135 XML_ELEMENT_DECL
= 15,
136 XML_ATTRIBUTE_DECL
= 16,
138 XML_NAMESPACE_DECL
= 18,
139 XML_XINCLUDE_START
= 19,
141 #ifdef LIBXML_DOCB_ENABLED
142 ,XML_DOCB_DOCUMENT_NODE
= 21
150 * A DTD Notation definition.
153 typedef struct _xmlNotation xmlNotation
;
154 typedef xmlNotation
*xmlNotationPtr
;
155 struct _xmlNotation
{
156 const xmlChar
*name
; /* Notation name */
157 const xmlChar
*PublicID
; /* Public identifier, if any */
158 const xmlChar
*SystemID
; /* System identifier, if any */
164 * A DTD Attribute type definition.
168 XML_ATTRIBUTE_CDATA
= 1,
170 XML_ATTRIBUTE_IDREF
,
171 XML_ATTRIBUTE_IDREFS
,
172 XML_ATTRIBUTE_ENTITY
,
173 XML_ATTRIBUTE_ENTITIES
,
174 XML_ATTRIBUTE_NMTOKEN
,
175 XML_ATTRIBUTE_NMTOKENS
,
176 XML_ATTRIBUTE_ENUMERATION
,
177 XML_ATTRIBUTE_NOTATION
181 * xmlAttributeDefault:
183 * A DTD Attribute default definition.
187 XML_ATTRIBUTE_NONE
= 1,
188 XML_ATTRIBUTE_REQUIRED
,
189 XML_ATTRIBUTE_IMPLIED
,
191 } xmlAttributeDefault
;
196 * List structure used when there is an enumeration in DTDs.
199 typedef struct _xmlEnumeration xmlEnumeration
;
200 typedef xmlEnumeration
*xmlEnumerationPtr
;
201 struct _xmlEnumeration
{
202 struct _xmlEnumeration
*next
; /* next one */
203 const xmlChar
*name
; /* Enumeration name */
209 * An Attribute declaration in a DTD.
212 typedef struct _xmlAttribute xmlAttribute
;
213 typedef xmlAttribute
*xmlAttributePtr
;
214 struct _xmlAttribute
{
215 void *_private
; /* application data */
216 xmlElementType type
; /* XML_ATTRIBUTE_DECL, must be second ! */
217 const xmlChar
*name
; /* Attribute name */
218 struct _xmlNode
*children
; /* NULL */
219 struct _xmlNode
*last
; /* NULL */
220 struct _xmlDtd
*parent
; /* -> DTD */
221 struct _xmlNode
*next
; /* next sibling link */
222 struct _xmlNode
*prev
; /* previous sibling link */
223 struct _xmlDoc
*doc
; /* the containing document */
225 struct _xmlAttribute
*nexth
; /* next in hash table */
226 xmlAttributeType atype
; /* The attribute type */
227 xmlAttributeDefault def
; /* the default */
228 const xmlChar
*defaultValue
; /* or the default value */
229 xmlEnumerationPtr tree
; /* or the enumeration tree if any */
230 const xmlChar
*prefix
; /* the namespace prefix if any */
231 const xmlChar
*elem
; /* Element holding the attribute */
235 * xmlElementContentType:
237 * Possible definitions of element content types.
240 XML_ELEMENT_CONTENT_PCDATA
= 1,
241 XML_ELEMENT_CONTENT_ELEMENT
,
242 XML_ELEMENT_CONTENT_SEQ
,
243 XML_ELEMENT_CONTENT_OR
244 } xmlElementContentType
;
247 * xmlElementContentOccur:
249 * Possible definitions of element content occurrences.
252 XML_ELEMENT_CONTENT_ONCE
= 1,
253 XML_ELEMENT_CONTENT_OPT
,
254 XML_ELEMENT_CONTENT_MULT
,
255 XML_ELEMENT_CONTENT_PLUS
256 } xmlElementContentOccur
;
261 * An XML Element content as stored after parsing an element definition
265 typedef struct _xmlElementContent xmlElementContent
;
266 typedef xmlElementContent
*xmlElementContentPtr
;
267 struct _xmlElementContent
{
268 xmlElementContentType type
; /* PCDATA, ELEMENT, SEQ or OR */
269 xmlElementContentOccur ocur
; /* ONCE, OPT, MULT or PLUS */
270 const xmlChar
*name
; /* Element name */
271 struct _xmlElementContent
*c1
; /* first child */
272 struct _xmlElementContent
*c2
; /* second child */
273 struct _xmlElementContent
*parent
; /* parent */
274 const xmlChar
*prefix
; /* Namespace prefix */
280 * The different possibilities for an element content type.
284 XML_ELEMENT_TYPE_UNDEFINED
= 0,
285 XML_ELEMENT_TYPE_EMPTY
= 1,
286 XML_ELEMENT_TYPE_ANY
,
287 XML_ELEMENT_TYPE_MIXED
,
288 XML_ELEMENT_TYPE_ELEMENT
294 #include <libxml/xmlregexp.h>
302 * An XML Element declaration from a DTD.
305 typedef struct _xmlElement xmlElement
;
306 typedef xmlElement
*xmlElementPtr
;
308 void *_private
; /* application data */
309 xmlElementType type
; /* XML_ELEMENT_DECL, must be second ! */
310 const xmlChar
*name
; /* Element name */
311 struct _xmlNode
*children
; /* NULL */
312 struct _xmlNode
*last
; /* NULL */
313 struct _xmlDtd
*parent
; /* -> DTD */
314 struct _xmlNode
*next
; /* next sibling link */
315 struct _xmlNode
*prev
; /* previous sibling link */
316 struct _xmlDoc
*doc
; /* the containing document */
318 xmlElementTypeVal etype
; /* The type */
319 xmlElementContentPtr content
; /* the allowed element content */
320 xmlAttributePtr attributes
; /* List of the declared attributes */
321 const xmlChar
*prefix
; /* the namespace prefix if any */
322 #ifdef LIBXML_REGEXP_ENABLED
323 xmlRegexpPtr contModel
; /* the validating regexp */
331 * XML_LOCAL_NAMESPACE:
333 * A namespace declaration node.
335 #define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
336 typedef xmlElementType xmlNsType
;
342 * Note that prefix == NULL is valid, it defines the default namespace
343 * within the subtree (until overridden).
345 * xmlNsType is unified with xmlElementType.
348 typedef struct _xmlNs xmlNs
;
349 typedef xmlNs
*xmlNsPtr
;
351 struct _xmlNs
*next
; /* next Ns link for this node */
352 xmlNsType type
; /* global or local */
353 const xmlChar
*href
; /* URL for the namespace */
354 const xmlChar
*prefix
; /* prefix for the namespace */
355 void *_private
; /* application data */
356 struct _xmlDoc
*context
; /* normally an xmlDoc */
362 * An XML DTD, as defined by <!DOCTYPE ... There is actually one for
363 * the internal subset and for the external subset.
365 typedef struct _xmlDtd xmlDtd
;
366 typedef xmlDtd
*xmlDtdPtr
;
368 void *_private
; /* application data */
369 xmlElementType type
; /* XML_DTD_NODE, must be second ! */
370 const xmlChar
*name
; /* Name of the DTD */
371 struct _xmlNode
*children
; /* the value of the property link */
372 struct _xmlNode
*last
; /* last child link */
373 struct _xmlDoc
*parent
; /* child->parent link */
374 struct _xmlNode
*next
; /* next sibling link */
375 struct _xmlNode
*prev
; /* previous sibling link */
376 struct _xmlDoc
*doc
; /* the containing document */
378 /* End of common part */
379 void *notations
; /* Hash table for notations if any */
380 void *elements
; /* Hash table for elements if any */
381 void *attributes
; /* Hash table for attributes if any */
382 void *entities
; /* Hash table for entities if any */
383 const xmlChar
*ExternalID
; /* External identifier for PUBLIC DTD */
384 const xmlChar
*SystemID
; /* URI for a SYSTEM or PUBLIC DTD */
385 void *pentities
; /* Hash table for param entities if any */
391 * An attribute on an XML node.
393 typedef struct _xmlAttr xmlAttr
;
394 typedef xmlAttr
*xmlAttrPtr
;
396 void *_private
; /* application data */
397 xmlElementType type
; /* XML_ATTRIBUTE_NODE, must be second ! */
398 const xmlChar
*name
; /* the name of the property */
399 struct _xmlNode
*children
; /* the value of the property */
400 struct _xmlNode
*last
; /* NULL */
401 struct _xmlNode
*parent
; /* child->parent link */
402 struct _xmlAttr
*next
; /* next sibling link */
403 struct _xmlAttr
*prev
; /* previous sibling link */
404 struct _xmlDoc
*doc
; /* the containing document */
405 xmlNs
*ns
; /* pointer to the associated namespace */
406 xmlAttributeType atype
; /* the attribute type if validating */
407 void *psvi
; /* for type/PSVI informations */
413 * An XML ID instance.
416 typedef struct _xmlID xmlID
;
417 typedef xmlID
*xmlIDPtr
;
419 struct _xmlID
*next
; /* next ID */
420 const xmlChar
*value
; /* The ID name */
421 xmlAttrPtr attr
; /* The attribute holding it */
422 const xmlChar
*name
; /* The attribute if attr is not available */
423 int lineno
; /* The line number if attr is not available */
424 struct _xmlDoc
*doc
; /* The document holding the ID */
430 * An XML IDREF instance.
433 typedef struct _xmlRef xmlRef
;
434 typedef xmlRef
*xmlRefPtr
;
436 struct _xmlRef
*next
; /* next Ref */
437 const xmlChar
*value
; /* The Ref name */
438 xmlAttrPtr attr
; /* The attribute holding it */
439 const xmlChar
*name
; /* The attribute if attr is not available */
440 int lineno
; /* The line number if attr is not available */
446 * A node in an XML tree.
448 typedef struct _xmlNode xmlNode
;
449 typedef xmlNode
*xmlNodePtr
;
451 void *_private
; /* application data */
452 xmlElementType type
; /* type number, must be second ! */
453 const xmlChar
*name
; /* the name of the node, or the entity */
454 struct _xmlNode
*children
; /* parent->childs link */
455 struct _xmlNode
*last
; /* last child link */
456 struct _xmlNode
*parent
; /* child->parent link */
457 struct _xmlNode
*next
; /* next sibling link */
458 struct _xmlNode
*prev
; /* previous sibling link */
459 struct _xmlDoc
*doc
; /* the containing document */
461 /* End of common part */
462 xmlNs
*ns
; /* pointer to the associated namespace */
463 xmlChar
*content
; /* the content */
464 struct _xmlAttr
*properties
;/* properties list */
465 xmlNs
*nsDef
; /* namespace definitions on this node */
466 void *psvi
; /* for type/PSVI informations */
467 unsigned short line
; /* line number */
468 unsigned short extra
; /* extra data for XPath/XSLT */
474 * Macro to extract the content pointer of a node.
476 #define XML_GET_CONTENT(n) \
477 ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content)
482 * Macro to extract the line number of an element node.
484 #define XML_GET_LINE(n) \
490 * Set of properties of the document as found by the parser
491 * Some of them are linked to similary named xmlParserOption
494 XML_DOC_WELLFORMED
= 1<<0, /* document is XML well formed */
495 XML_DOC_NSVALID
= 1<<1, /* document is Namespace valid */
496 XML_DOC_OLD10
= 1<<2, /* parsed with old XML-1.0 parser */
497 XML_DOC_DTDVALID
= 1<<3, /* DTD validation was successful */
498 XML_DOC_XINCLUDE
= 1<<4, /* XInclude substitution was done */
499 XML_DOC_USERBUILT
= 1<<5, /* Document was built using the API
500 and not by parsing an instance */
501 XML_DOC_INTERNAL
= 1<<6, /* built for internal processing */
502 XML_DOC_HTML
= 1<<7 /* parsed or built HTML document */
510 typedef struct _xmlDoc xmlDoc
;
511 typedef xmlDoc
*xmlDocPtr
;
513 void *_private
; /* application data */
514 xmlElementType type
; /* XML_DOCUMENT_NODE, must be second ! */
515 char *name
; /* name/filename/URI of the document */
516 struct _xmlNode
*children
; /* the document tree */
517 struct _xmlNode
*last
; /* last child link */
518 struct _xmlNode
*parent
; /* child->parent link */
519 struct _xmlNode
*next
; /* next sibling link */
520 struct _xmlNode
*prev
; /* previous sibling link */
521 struct _xmlDoc
*doc
; /* autoreference to itself */
523 /* End of common part */
524 int compression
;/* level of zlib compression */
525 int standalone
; /* standalone document (no external refs)
526 1 if standalone="yes"
528 -1 if there is no XML declaration
529 -2 if there is an XML declaration, but no
530 standalone attribute was specified */
531 struct _xmlDtd
*intSubset
; /* the document internal subset */
532 struct _xmlDtd
*extSubset
; /* the document external subset */
533 struct _xmlNs
*oldNs
; /* Global namespace, the old way */
534 const xmlChar
*version
; /* the XML version string */
535 const xmlChar
*encoding
; /* external initial encoding, if any */
536 void *ids
; /* Hash table for ID attributes if any */
537 void *refs
; /* Hash table for IDREFs attributes if any */
538 const xmlChar
*URL
; /* The URI for that document */
539 int charset
; /* encoding of the in-memory content
540 actually an xmlCharEncoding */
541 struct _xmlDict
*dict
; /* dict used to allocate names or NULL */
542 void *psvi
; /* for type/PSVI informations */
543 int parseFlags
; /* set of xmlParserOption used to parse the
545 int properties
; /* set of xmlDocProperties for this document
546 set at the end of parsing */
550 typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt
;
551 typedef xmlDOMWrapCtxt
*xmlDOMWrapCtxtPtr
;
554 * xmlDOMWrapAcquireNsFunction:
555 * @ctxt: a DOM wrapper context
556 * @node: the context node (element or attribute)
557 * @nsName: the requested namespace name
558 * @nsPrefix: the requested namespace prefix
560 * A function called to acquire namespaces (xmlNs) from the wrapper.
562 * Returns an xmlNsPtr or NULL in case of an error.
564 typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction
) (xmlDOMWrapCtxtPtr ctxt
,
566 const xmlChar
*nsName
,
567 const xmlChar
*nsPrefix
);
572 * Context for DOM wrapper-operations.
574 struct _xmlDOMWrapCtxt
{
577 * The type of this context, just in case we need specialized
578 * contexts in the future.
582 * Internal namespace map used for various operations.
586 * Use this one to acquire an xmlNsPtr intended for node->ns.
587 * (Note that this is not intended for elem->nsDef).
589 xmlDOMWrapAcquireNsFunction getNsForNodeFunc
;
595 * Macro for compatibility naming layer with libxml1. Maps
598 #ifndef xmlChildrenNode
599 #define xmlChildrenNode children
605 * Macro for compatibility naming layer with libxml1. Maps
609 #define xmlRootNode children
617 * Some helper functions
619 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || defined(LIBXML_DOCB_ENABLED)
620 XMLPUBFUN
int XMLCALL
621 xmlValidateNCName (const xmlChar
*value
,
625 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
626 XMLPUBFUN
int XMLCALL
627 xmlValidateQName (const xmlChar
*value
,
629 XMLPUBFUN
int XMLCALL
630 xmlValidateName (const xmlChar
*value
,
632 XMLPUBFUN
int XMLCALL
633 xmlValidateNMToken (const xmlChar
*value
,
637 XMLPUBFUN xmlChar
* XMLCALL
638 xmlBuildQName (const xmlChar
*ncname
,
639 const xmlChar
*prefix
,
642 XMLPUBFUN xmlChar
* XMLCALL
643 xmlSplitQName2 (const xmlChar
*name
,
645 XMLPUBFUN
const xmlChar
* XMLCALL
646 xmlSplitQName3 (const xmlChar
*name
,
653 XMLPUBFUN
void XMLCALL
654 xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme
);
655 XMLPUBFUN xmlBufferAllocationScheme XMLCALL
656 xmlGetBufferAllocationScheme(void);
658 XMLPUBFUN xmlBufferPtr XMLCALL
659 xmlBufferCreate (void);
660 XMLPUBFUN xmlBufferPtr XMLCALL
661 xmlBufferCreateSize (size_t size
);
662 XMLPUBFUN xmlBufferPtr XMLCALL
663 xmlBufferCreateStatic (void *mem
,
665 XMLPUBFUN
int XMLCALL
666 xmlBufferResize (xmlBufferPtr buf
,
668 XMLPUBFUN
void XMLCALL
669 xmlBufferFree (xmlBufferPtr buf
);
670 XMLPUBFUN
int XMLCALL
671 xmlBufferDump (FILE *file
,
673 XMLPUBFUN
int XMLCALL
674 xmlBufferAdd (xmlBufferPtr buf
,
677 XMLPUBFUN
int XMLCALL
678 xmlBufferAddHead (xmlBufferPtr buf
,
681 XMLPUBFUN
int XMLCALL
682 xmlBufferCat (xmlBufferPtr buf
,
684 XMLPUBFUN
int XMLCALL
685 xmlBufferCCat (xmlBufferPtr buf
,
687 XMLPUBFUN
int XMLCALL
688 xmlBufferShrink (xmlBufferPtr buf
,
690 XMLPUBFUN
int XMLCALL
691 xmlBufferGrow (xmlBufferPtr buf
,
693 XMLPUBFUN
void XMLCALL
694 xmlBufferEmpty (xmlBufferPtr buf
);
695 XMLPUBFUN
const xmlChar
* XMLCALL
696 xmlBufferContent (const xmlBufferPtr buf
);
697 XMLPUBFUN
void XMLCALL
698 xmlBufferSetAllocationScheme(xmlBufferPtr buf
,
699 xmlBufferAllocationScheme scheme
);
700 XMLPUBFUN
int XMLCALL
701 xmlBufferLength (const xmlBufferPtr buf
);
704 * Creating/freeing new structures.
706 XMLPUBFUN xmlDtdPtr XMLCALL
707 xmlCreateIntSubset (xmlDocPtr doc
,
709 const xmlChar
*ExternalID
,
710 const xmlChar
*SystemID
);
711 XMLPUBFUN xmlDtdPtr XMLCALL
712 xmlNewDtd (xmlDocPtr doc
,
714 const xmlChar
*ExternalID
,
715 const xmlChar
*SystemID
);
716 XMLPUBFUN xmlDtdPtr XMLCALL
717 xmlGetIntSubset (xmlDocPtr doc
);
718 XMLPUBFUN
void XMLCALL
719 xmlFreeDtd (xmlDtdPtr cur
);
720 #ifdef LIBXML_LEGACY_ENABLED
721 XMLPUBFUN xmlNsPtr XMLCALL
722 xmlNewGlobalNs (xmlDocPtr doc
,
724 const xmlChar
*prefix
);
725 #endif /* LIBXML_LEGACY_ENABLED */
726 XMLPUBFUN xmlNsPtr XMLCALL
727 xmlNewNs (xmlNodePtr node
,
729 const xmlChar
*prefix
);
730 XMLPUBFUN
void XMLCALL
731 xmlFreeNs (xmlNsPtr cur
);
732 XMLPUBFUN
void XMLCALL
733 xmlFreeNsList (xmlNsPtr cur
);
734 XMLPUBFUN xmlDocPtr XMLCALL
735 xmlNewDoc (const xmlChar
*version
);
736 XMLPUBFUN
void XMLCALL
737 xmlFreeDoc (xmlDocPtr cur
);
738 XMLPUBFUN xmlAttrPtr XMLCALL
739 xmlNewDocProp (xmlDocPtr doc
,
741 const xmlChar
*value
);
742 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
743 defined(LIBXML_SCHEMAS_ENABLED)
744 XMLPUBFUN xmlAttrPtr XMLCALL
745 xmlNewProp (xmlNodePtr node
,
747 const xmlChar
*value
);
749 XMLPUBFUN xmlAttrPtr XMLCALL
750 xmlNewNsProp (xmlNodePtr node
,
753 const xmlChar
*value
);
754 XMLPUBFUN xmlAttrPtr XMLCALL
755 xmlNewNsPropEatName (xmlNodePtr node
,
758 const xmlChar
*value
);
759 XMLPUBFUN
void XMLCALL
760 xmlFreePropList (xmlAttrPtr cur
);
761 XMLPUBFUN
void XMLCALL
762 xmlFreeProp (xmlAttrPtr cur
);
763 XMLPUBFUN xmlAttrPtr XMLCALL
764 xmlCopyProp (xmlNodePtr target
,
766 XMLPUBFUN xmlAttrPtr XMLCALL
767 xmlCopyPropList (xmlNodePtr target
,
769 #ifdef LIBXML_TREE_ENABLED
770 XMLPUBFUN xmlDtdPtr XMLCALL
771 xmlCopyDtd (xmlDtdPtr dtd
);
772 #endif /* LIBXML_TREE_ENABLED */
773 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
774 XMLPUBFUN xmlDocPtr XMLCALL
775 xmlCopyDoc (xmlDocPtr doc
,
777 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
779 * Creating new nodes.
781 XMLPUBFUN xmlNodePtr XMLCALL
782 xmlNewDocNode (xmlDocPtr doc
,
785 const xmlChar
*content
);
786 XMLPUBFUN xmlNodePtr XMLCALL
787 xmlNewDocNodeEatName (xmlDocPtr doc
,
790 const xmlChar
*content
);
791 XMLPUBFUN xmlNodePtr XMLCALL
792 xmlNewNode (xmlNsPtr ns
,
793 const xmlChar
*name
);
794 XMLPUBFUN xmlNodePtr XMLCALL
795 xmlNewNodeEatName (xmlNsPtr ns
,
797 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
798 XMLPUBFUN xmlNodePtr XMLCALL
799 xmlNewChild (xmlNodePtr parent
,
802 const xmlChar
*content
);
804 XMLPUBFUN xmlNodePtr XMLCALL
805 xmlNewDocText (xmlDocPtr doc
,
806 const xmlChar
*content
);
807 XMLPUBFUN xmlNodePtr XMLCALL
808 xmlNewText (const xmlChar
*content
);
809 XMLPUBFUN xmlNodePtr XMLCALL
810 xmlNewDocPI (xmlDocPtr doc
,
812 const xmlChar
*content
);
813 XMLPUBFUN xmlNodePtr XMLCALL
814 xmlNewPI (const xmlChar
*name
,
815 const xmlChar
*content
);
816 XMLPUBFUN xmlNodePtr XMLCALL
817 xmlNewDocTextLen (xmlDocPtr doc
,
818 const xmlChar
*content
,
820 XMLPUBFUN xmlNodePtr XMLCALL
821 xmlNewTextLen (const xmlChar
*content
,
823 XMLPUBFUN xmlNodePtr XMLCALL
824 xmlNewDocComment (xmlDocPtr doc
,
825 const xmlChar
*content
);
826 XMLPUBFUN xmlNodePtr XMLCALL
827 xmlNewComment (const xmlChar
*content
);
828 XMLPUBFUN xmlNodePtr XMLCALL
829 xmlNewCDataBlock (xmlDocPtr doc
,
830 const xmlChar
*content
,
832 XMLPUBFUN xmlNodePtr XMLCALL
833 xmlNewCharRef (xmlDocPtr doc
,
834 const xmlChar
*name
);
835 XMLPUBFUN xmlNodePtr XMLCALL
836 xmlNewReference (xmlDocPtr doc
,
837 const xmlChar
*name
);
838 XMLPUBFUN xmlNodePtr XMLCALL
839 xmlCopyNode (const xmlNodePtr node
,
841 XMLPUBFUN xmlNodePtr XMLCALL
842 xmlDocCopyNode (const xmlNodePtr node
,
845 XMLPUBFUN xmlNodePtr XMLCALL
846 xmlDocCopyNodeList (xmlDocPtr doc
,
847 const xmlNodePtr node
);
848 XMLPUBFUN xmlNodePtr XMLCALL
849 xmlCopyNodeList (const xmlNodePtr node
);
850 #ifdef LIBXML_TREE_ENABLED
851 XMLPUBFUN xmlNodePtr XMLCALL
852 xmlNewTextChild (xmlNodePtr parent
,
855 const xmlChar
*content
);
856 XMLPUBFUN xmlNodePtr XMLCALL
857 xmlNewDocRawNode (xmlDocPtr doc
,
860 const xmlChar
*content
);
861 XMLPUBFUN xmlNodePtr XMLCALL
862 xmlNewDocFragment (xmlDocPtr doc
);
863 #endif /* LIBXML_TREE_ENABLED */
868 XMLPUBFUN
long XMLCALL
869 xmlGetLineNo (xmlNodePtr node
);
870 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
871 XMLPUBFUN xmlChar
* XMLCALL
872 xmlGetNodePath (xmlNodePtr node
);
873 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
874 XMLPUBFUN xmlNodePtr XMLCALL
875 xmlDocGetRootElement (xmlDocPtr doc
);
876 XMLPUBFUN xmlNodePtr XMLCALL
877 xmlGetLastChild (xmlNodePtr parent
);
878 XMLPUBFUN
int XMLCALL
879 xmlNodeIsText (xmlNodePtr node
);
880 XMLPUBFUN
int XMLCALL
881 xmlIsBlankNode (xmlNodePtr node
);
884 * Changing the structure.
886 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
887 XMLPUBFUN xmlNodePtr XMLCALL
888 xmlDocSetRootElement (xmlDocPtr doc
,
890 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
891 #ifdef LIBXML_TREE_ENABLED
892 XMLPUBFUN
void XMLCALL
893 xmlNodeSetName (xmlNodePtr cur
,
894 const xmlChar
*name
);
895 #endif /* LIBXML_TREE_ENABLED */
896 XMLPUBFUN xmlNodePtr XMLCALL
897 xmlAddChild (xmlNodePtr parent
,
899 XMLPUBFUN xmlNodePtr XMLCALL
900 xmlAddChildList (xmlNodePtr parent
,
902 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
903 XMLPUBFUN xmlNodePtr XMLCALL
904 xmlReplaceNode (xmlNodePtr old
,
906 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
907 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
908 defined(LIBXML_SCHEMAS_ENABLED)
909 XMLPUBFUN xmlNodePtr XMLCALL
910 xmlAddPrevSibling (xmlNodePtr cur
,
912 #endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */
913 XMLPUBFUN xmlNodePtr XMLCALL
914 xmlAddSibling (xmlNodePtr cur
,
916 XMLPUBFUN xmlNodePtr XMLCALL
917 xmlAddNextSibling (xmlNodePtr cur
,
919 XMLPUBFUN
void XMLCALL
920 xmlUnlinkNode (xmlNodePtr cur
);
921 XMLPUBFUN xmlNodePtr XMLCALL
922 xmlTextMerge (xmlNodePtr first
,
924 XMLPUBFUN
int XMLCALL
925 xmlTextConcat (xmlNodePtr node
,
926 const xmlChar
*content
,
928 XMLPUBFUN
void XMLCALL
929 xmlFreeNodeList (xmlNodePtr cur
);
930 XMLPUBFUN
void XMLCALL
931 xmlFreeNode (xmlNodePtr cur
);
932 XMLPUBFUN
void XMLCALL
933 xmlSetTreeDoc (xmlNodePtr tree
,
935 XMLPUBFUN
void XMLCALL
936 xmlSetListDoc (xmlNodePtr list
,
941 XMLPUBFUN xmlNsPtr XMLCALL
942 xmlSearchNs (xmlDocPtr doc
,
944 const xmlChar
*nameSpace
);
945 XMLPUBFUN xmlNsPtr XMLCALL
946 xmlSearchNsByHref (xmlDocPtr doc
,
948 const xmlChar
*href
);
949 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
950 XMLPUBFUN xmlNsPtr
* XMLCALL
951 xmlGetNsList (xmlDocPtr doc
,
953 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
955 XMLPUBFUN
void XMLCALL
956 xmlSetNs (xmlNodePtr node
,
958 XMLPUBFUN xmlNsPtr XMLCALL
959 xmlCopyNamespace (xmlNsPtr cur
);
960 XMLPUBFUN xmlNsPtr XMLCALL
961 xmlCopyNamespaceList (xmlNsPtr cur
);
964 * Changing the content.
966 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
967 XMLPUBFUN xmlAttrPtr XMLCALL
968 xmlSetProp (xmlNodePtr node
,
970 const xmlChar
*value
);
971 XMLPUBFUN xmlAttrPtr XMLCALL
972 xmlSetNsProp (xmlNodePtr node
,
975 const xmlChar
*value
);
976 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
977 XMLPUBFUN xmlChar
* XMLCALL
978 xmlGetNoNsProp (xmlNodePtr node
,
979 const xmlChar
*name
);
980 XMLPUBFUN xmlChar
* XMLCALL
981 xmlGetProp (xmlNodePtr node
,
982 const xmlChar
*name
);
983 XMLPUBFUN xmlAttrPtr XMLCALL
984 xmlHasProp (xmlNodePtr node
,
985 const xmlChar
*name
);
986 XMLPUBFUN xmlAttrPtr XMLCALL
987 xmlHasNsProp (xmlNodePtr node
,
989 const xmlChar
*nameSpace
);
990 XMLPUBFUN xmlChar
* XMLCALL
991 xmlGetNsProp (xmlNodePtr node
,
993 const xmlChar
*nameSpace
);
994 XMLPUBFUN xmlNodePtr XMLCALL
995 xmlStringGetNodeList (xmlDocPtr doc
,
996 const xmlChar
*value
);
997 XMLPUBFUN xmlNodePtr XMLCALL
998 xmlStringLenGetNodeList (xmlDocPtr doc
,
999 const xmlChar
*value
,
1001 XMLPUBFUN xmlChar
* XMLCALL
1002 xmlNodeListGetString (xmlDocPtr doc
,
1005 #ifdef LIBXML_TREE_ENABLED
1006 XMLPUBFUN xmlChar
* XMLCALL
1007 xmlNodeListGetRawString (xmlDocPtr doc
,
1010 #endif /* LIBXML_TREE_ENABLED */
1011 XMLPUBFUN
void XMLCALL
1012 xmlNodeSetContent (xmlNodePtr cur
,
1013 const xmlChar
*content
);
1014 #ifdef LIBXML_TREE_ENABLED
1015 XMLPUBFUN
void XMLCALL
1016 xmlNodeSetContentLen (xmlNodePtr cur
,
1017 const xmlChar
*content
,
1019 #endif /* LIBXML_TREE_ENABLED */
1020 XMLPUBFUN
void XMLCALL
1021 xmlNodeAddContent (xmlNodePtr cur
,
1022 const xmlChar
*content
);
1023 XMLPUBFUN
void XMLCALL
1024 xmlNodeAddContentLen (xmlNodePtr cur
,
1025 const xmlChar
*content
,
1027 XMLPUBFUN xmlChar
* XMLCALL
1028 xmlNodeGetContent (xmlNodePtr cur
);
1029 XMLPUBFUN
int XMLCALL
1030 xmlNodeBufGetContent (xmlBufferPtr buffer
,
1032 XMLPUBFUN xmlChar
* XMLCALL
1033 xmlNodeGetLang (xmlNodePtr cur
);
1034 XMLPUBFUN
int XMLCALL
1035 xmlNodeGetSpacePreserve (xmlNodePtr cur
);
1036 #ifdef LIBXML_TREE_ENABLED
1037 XMLPUBFUN
void XMLCALL
1038 xmlNodeSetLang (xmlNodePtr cur
,
1039 const xmlChar
*lang
);
1040 XMLPUBFUN
void XMLCALL
1041 xmlNodeSetSpacePreserve (xmlNodePtr cur
,
1043 #endif /* LIBXML_TREE_ENABLED */
1044 XMLPUBFUN xmlChar
* XMLCALL
1045 xmlNodeGetBase (xmlDocPtr doc
,
1047 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
1048 XMLPUBFUN
void XMLCALL
1049 xmlNodeSetBase (xmlNodePtr cur
,
1050 const xmlChar
*uri
);
1056 XMLPUBFUN
int XMLCALL
1057 xmlRemoveProp (xmlAttrPtr cur
);
1058 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
1059 XMLPUBFUN
int XMLCALL
1060 xmlUnsetNsProp (xmlNodePtr node
,
1062 const xmlChar
*name
);
1063 XMLPUBFUN
int XMLCALL
1064 xmlUnsetProp (xmlNodePtr node
,
1065 const xmlChar
*name
);
1066 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
1069 * Internal, don't use.
1071 XMLPUBFUN
void XMLCALL
1072 xmlBufferWriteCHAR (xmlBufferPtr buf
,
1073 const xmlChar
*string
);
1074 XMLPUBFUN
void XMLCALL
1075 xmlBufferWriteChar (xmlBufferPtr buf
,
1076 const char *string
);
1077 XMLPUBFUN
void XMLCALL
1078 xmlBufferWriteQuotedString(xmlBufferPtr buf
,
1079 const xmlChar
*string
);
1081 #ifdef LIBXML_OUTPUT_ENABLED
1082 XMLPUBFUN
void xmlAttrSerializeTxtContent(xmlBufferPtr buf
,
1085 const xmlChar
*string
);
1086 #endif /* LIBXML_OUTPUT_ENABLED */
1088 #ifdef LIBXML_TREE_ENABLED
1090 * Namespace handling.
1092 XMLPUBFUN
int XMLCALL
1093 xmlReconciliateNs (xmlDocPtr doc
,
1097 #ifdef LIBXML_OUTPUT_ENABLED
1101 XMLPUBFUN
void XMLCALL
1102 xmlDocDumpFormatMemory (xmlDocPtr cur
,
1106 XMLPUBFUN
void XMLCALL
1107 xmlDocDumpMemory (xmlDocPtr cur
,
1110 XMLPUBFUN
void XMLCALL
1111 xmlDocDumpMemoryEnc (xmlDocPtr out_doc
,
1112 xmlChar
**doc_txt_ptr
,
1114 const char *txt_encoding
);
1115 XMLPUBFUN
void XMLCALL
1116 xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc
,
1117 xmlChar
**doc_txt_ptr
,
1119 const char *txt_encoding
,
1121 XMLPUBFUN
int XMLCALL
1122 xmlDocFormatDump (FILE *f
,
1125 XMLPUBFUN
int XMLCALL
1126 xmlDocDump (FILE *f
,
1128 XMLPUBFUN
void XMLCALL
1129 xmlElemDump (FILE *f
,
1132 XMLPUBFUN
int XMLCALL
1133 xmlSaveFile (const char *filename
,
1135 XMLPUBFUN
int XMLCALL
1136 xmlSaveFormatFile (const char *filename
,
1139 XMLPUBFUN
int XMLCALL
1140 xmlNodeDump (xmlBufferPtr buf
,
1146 XMLPUBFUN
int XMLCALL
1147 xmlSaveFileTo (xmlOutputBufferPtr buf
,
1149 const char *encoding
);
1150 XMLPUBFUN
int XMLCALL
1151 xmlSaveFormatFileTo (xmlOutputBufferPtr buf
,
1153 const char *encoding
,
1155 XMLPUBFUN
void XMLCALL
1156 xmlNodeDumpOutput (xmlOutputBufferPtr buf
,
1161 const char *encoding
);
1163 XMLPUBFUN
int XMLCALL
1164 xmlSaveFormatFileEnc (const char *filename
,
1166 const char *encoding
,
1169 XMLPUBFUN
int XMLCALL
1170 xmlSaveFileEnc (const char *filename
,
1172 const char *encoding
);
1174 #endif /* LIBXML_OUTPUT_ENABLED */
1178 XMLPUBFUN
int XMLCALL
1179 xmlIsXHTML (const xmlChar
*systemID
,
1180 const xmlChar
*publicID
);
1185 XMLPUBFUN
int XMLCALL
1186 xmlGetDocCompressMode (xmlDocPtr doc
);
1187 XMLPUBFUN
void XMLCALL
1188 xmlSetDocCompressMode (xmlDocPtr doc
,
1190 XMLPUBFUN
int XMLCALL
1191 xmlGetCompressMode (void);
1192 XMLPUBFUN
void XMLCALL
1193 xmlSetCompressMode (int mode
);
1196 * DOM-wrapper helper functions.
1198 XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL
1199 xmlDOMWrapNewCtxt (void);
1200 XMLPUBFUN
void XMLCALL
1201 xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt
);
1202 XMLPUBFUN
int XMLCALL
1203 xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt
,
1206 XMLPUBFUN
int XMLCALL
1207 xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt
,
1208 xmlDocPtr sourceDoc
,
1211 xmlNodePtr destParent
,
1213 XMLPUBFUN
int XMLCALL
1214 xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt
,
1218 XMLPUBFUN
int XMLCALL
1219 xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt
,
1220 xmlDocPtr sourceDoc
,
1222 xmlNodePtr
*clonedNode
,
1224 xmlNodePtr destParent
,
1228 #ifdef LIBXML_TREE_ENABLED
1230 * 5 interfaces from DOM ElementTraversal, but different in entities
1233 XMLPUBFUN
unsigned long XMLCALL
1234 xmlChildElementCount (xmlNodePtr parent
);
1235 XMLPUBFUN xmlNodePtr XMLCALL
1236 xmlNextElementSibling (xmlNodePtr node
);
1237 XMLPUBFUN xmlNodePtr XMLCALL
1238 xmlFirstElementChild (xmlNodePtr parent
);
1239 XMLPUBFUN xmlNodePtr XMLCALL
1240 xmlLastElementChild (xmlNodePtr parent
);
1241 XMLPUBFUN xmlNodePtr XMLCALL
1242 xmlPreviousElementSibling (xmlNodePtr node
);
1247 #ifndef __XML_PARSER_H__
1248 #include <libxml/xmlmemory.h>
1251 #endif /* __XML_TREE_H__ */