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 char* dummy_children; /* lines up with node->children */
355 const xmlChar *prefix; /* prefix for the namespace */
356 void *_private; /* application data */
357 struct _xmlDoc *context; /* normally an xmlDoc */
363 * An XML DTD, as defined by <!DOCTYPE ... There is actually one for
364 * the internal subset and for the external subset.
366 typedef struct _xmlDtd xmlDtd;
367 typedef xmlDtd *xmlDtdPtr;
369 void *_private; /* application data */
370 xmlElementType type; /* XML_DTD_NODE, must be second ! */
371 const xmlChar *name; /* Name of the DTD */
372 struct _xmlNode *children; /* the value of the property link */
373 struct _xmlNode *last; /* last child link */
374 struct _xmlDoc *parent; /* child->parent link */
375 struct _xmlNode *next; /* next sibling link */
376 struct _xmlNode *prev; /* previous sibling link */
377 struct _xmlDoc *doc; /* the containing document */
379 /* End of common part */
380 void *notations; /* Hash table for notations if any */
381 void *elements; /* Hash table for elements if any */
382 void *attributes; /* Hash table for attributes if any */
383 void *entities; /* Hash table for entities if any */
384 const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
385 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
386 void *pentities; /* Hash table for param entities if any */
392 * An attribute on an XML node.
394 typedef struct _xmlAttr xmlAttr;
395 typedef xmlAttr *xmlAttrPtr;
397 void *_private; /* application data */
398 xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */
399 const xmlChar *name; /* the name of the property */
400 struct _xmlNode *children; /* the value of the property */
401 struct _xmlNode *last; /* NULL */
402 struct _xmlNode *parent; /* child->parent link */
403 struct _xmlAttr *next; /* next sibling link */
404 struct _xmlAttr *prev; /* previous sibling link */
405 struct _xmlDoc *doc; /* the containing document */
406 xmlNs *ns; /* pointer to the associated namespace */
407 xmlAttributeType atype; /* the attribute type if validating */
408 void *psvi; /* for type/PSVI informations */
414 * An XML ID instance.
417 typedef struct _xmlID xmlID;
418 typedef xmlID *xmlIDPtr;
420 struct _xmlID *next; /* next ID */
421 const xmlChar *value; /* The ID name */
422 xmlAttrPtr attr; /* The attribute holding it */
423 const xmlChar *name; /* The attribute if attr is not available */
424 int lineno; /* The line number if attr is not available */
425 struct _xmlDoc *doc; /* The document holding the ID */
431 * An XML IDREF instance.
434 typedef struct _xmlRef xmlRef;
435 typedef xmlRef *xmlRefPtr;
437 struct _xmlRef *next; /* next Ref */
438 const xmlChar *value; /* The Ref name */
439 xmlAttrPtr attr; /* The attribute holding it */
440 const xmlChar *name; /* The attribute if attr is not available */
441 int lineno; /* The line number if attr is not available */
447 * A node in an XML tree.
449 typedef struct _xmlNode xmlNode;
450 typedef xmlNode *xmlNodePtr;
452 void *_private; /* application data */
453 xmlElementType type; /* type number, must be second ! */
454 const xmlChar *name; /* the name of the node, or the entity */
455 struct _xmlNode *children; /* parent->childs link */
456 struct _xmlNode *last; /* last child link */
457 struct _xmlNode *parent; /* child->parent link */
458 struct _xmlNode *next; /* next sibling link */
459 struct _xmlNode *prev; /* previous sibling link */
460 struct _xmlDoc *doc; /* the containing document */
462 /* End of common part */
463 xmlNs *ns; /* pointer to the associated namespace */
464 xmlChar *content; /* the content */
465 struct _xmlAttr *properties;/* properties list */
466 xmlNs *nsDef; /* namespace definitions on this node */
467 void *psvi; /* for type/PSVI informations */
468 unsigned short line; /* line number */
469 unsigned short extra; /* extra data for XPath/XSLT */
475 * Macro to extract the content pointer of a node.
477 #define XML_GET_CONTENT(n) \
478 ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content)
483 * Macro to extract the line number of an element node.
485 #define XML_GET_LINE(n) \
491 * Set of properties of the document as found by the parser
492 * Some of them are linked to similary named xmlParserOption
495 XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */
496 XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */
497 XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */
498 XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */
499 XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */
500 XML_DOC_USERBUILT = 1<<5, /* Document was built using the API
501 and not by parsing an instance */
502 XML_DOC_INTERNAL = 1<<6, /* built for internal processing */
503 XML_DOC_HTML = 1<<7 /* parsed or built HTML document */
511 typedef struct _xmlDoc xmlDoc;
512 typedef xmlDoc *xmlDocPtr;
514 void *_private; /* application data */
515 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
516 char *name; /* name/filename/URI of the document */
517 struct _xmlNode *children; /* the document tree */
518 struct _xmlNode *last; /* last child link */
519 struct _xmlNode *parent; /* child->parent link */
520 struct _xmlNode *next; /* next sibling link */
521 struct _xmlNode *prev; /* previous sibling link */
522 struct _xmlDoc *doc; /* autoreference to itself */
524 /* End of common part */
525 int compression;/* level of zlib compression */
526 int standalone; /* standalone document (no external refs)
527 1 if standalone="yes"
529 -1 if there is no XML declaration
530 -2 if there is an XML declaration, but no
531 standalone attribute was specified */
532 struct _xmlDtd *intSubset; /* the document internal subset */
533 struct _xmlDtd *extSubset; /* the document external subset */
534 struct _xmlNs *oldNs; /* Global namespace, the old way */
535 const xmlChar *version; /* the XML version string */
536 const xmlChar *encoding; /* external initial encoding, if any */
537 void *ids; /* Hash table for ID attributes if any */
538 void *refs; /* Hash table for IDREFs attributes if any */
539 const xmlChar *URL; /* The URI for that document */
540 int charset; /* encoding of the in-memory content
541 actually an xmlCharEncoding */
542 struct _xmlDict *dict; /* dict used to allocate names or NULL */
543 void *psvi; /* for type/PSVI informations */
544 int parseFlags; /* set of xmlParserOption used to parse the
546 int properties; /* set of xmlDocProperties for this document
547 set at the end of parsing */
551 typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt;
552 typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr;
555 * xmlDOMWrapAcquireNsFunction:
556 * @ctxt: a DOM wrapper context
557 * @node: the context node (element or attribute)
558 * @nsName: the requested namespace name
559 * @nsPrefix: the requested namespace prefix
561 * A function called to acquire namespaces (xmlNs) from the wrapper.
563 * Returns an xmlNsPtr or NULL in case of an error.
565 typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt,
567 const xmlChar *nsName,
568 const xmlChar *nsPrefix);
573 * Context for DOM wrapper-operations.
575 struct _xmlDOMWrapCtxt {
578 * The type of this context, just in case we need specialized
579 * contexts in the future.
583 * Internal namespace map used for various operations.
587 * Use this one to acquire an xmlNsPtr intended for node->ns.
588 * (Note that this is not intended for elem->nsDef).
590 xmlDOMWrapAcquireNsFunction getNsForNodeFunc;
596 * Macro for compatibility naming layer with libxml1. Maps
599 #ifndef xmlChildrenNode
600 #define xmlChildrenNode children
606 * Macro for compatibility naming layer with libxml1. Maps
610 #define xmlRootNode children
618 * Some helper functions
620 #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)
621 XMLPUBFUN int XMLCALL
622 xmlValidateNCName (const xmlChar *value,
626 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
627 XMLPUBFUN int XMLCALL
628 xmlValidateQName (const xmlChar *value,
630 XMLPUBFUN int XMLCALL
631 xmlValidateName (const xmlChar *value,
633 XMLPUBFUN int XMLCALL
634 xmlValidateNMToken (const xmlChar *value,
638 XMLPUBFUN xmlChar * XMLCALL
639 xmlBuildQName (const xmlChar *ncname,
640 const xmlChar *prefix,
643 XMLPUBFUN xmlChar * XMLCALL
644 xmlSplitQName2 (const xmlChar *name,
646 XMLPUBFUN const xmlChar * XMLCALL
647 xmlSplitQName3 (const xmlChar *name,
654 XMLPUBFUN void XMLCALL
655 xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
656 XMLPUBFUN xmlBufferAllocationScheme XMLCALL
657 xmlGetBufferAllocationScheme(void);
659 XMLPUBFUN xmlBufferPtr XMLCALL
660 xmlBufferCreate (void);
661 XMLPUBFUN xmlBufferPtr XMLCALL
662 xmlBufferCreateSize (size_t size);
663 XMLPUBFUN xmlBufferPtr XMLCALL
664 xmlBufferCreateStatic (void *mem,
666 XMLPUBFUN int XMLCALL
667 xmlBufferResize (xmlBufferPtr buf,
669 XMLPUBFUN void XMLCALL
670 xmlBufferFree (xmlBufferPtr buf);
671 XMLPUBFUN int XMLCALL
672 xmlBufferDump (FILE *file,
674 XMLPUBFUN int XMLCALL
675 xmlBufferAdd (xmlBufferPtr buf,
678 XMLPUBFUN int XMLCALL
679 xmlBufferAddHead (xmlBufferPtr buf,
682 XMLPUBFUN int XMLCALL
683 xmlBufferCat (xmlBufferPtr buf,
685 XMLPUBFUN int XMLCALL
686 xmlBufferCCat (xmlBufferPtr buf,
688 XMLPUBFUN int XMLCALL
689 xmlBufferShrink (xmlBufferPtr buf,
691 XMLPUBFUN int XMLCALL
692 xmlBufferGrow (xmlBufferPtr buf,
694 XMLPUBFUN void XMLCALL
695 xmlBufferEmpty (xmlBufferPtr buf);
696 XMLPUBFUN const xmlChar* XMLCALL
697 xmlBufferContent (const xmlBufferPtr buf);
698 XMLPUBFUN void XMLCALL
699 xmlBufferSetAllocationScheme(xmlBufferPtr buf,
700 xmlBufferAllocationScheme scheme);
701 XMLPUBFUN int XMLCALL
702 xmlBufferLength (const xmlBufferPtr buf);
705 * Creating/freeing new structures.
707 XMLPUBFUN xmlDtdPtr XMLCALL
708 xmlCreateIntSubset (xmlDocPtr doc,
710 const xmlChar *ExternalID,
711 const xmlChar *SystemID);
712 XMLPUBFUN xmlDtdPtr XMLCALL
713 xmlNewDtd (xmlDocPtr doc,
715 const xmlChar *ExternalID,
716 const xmlChar *SystemID);
717 XMLPUBFUN xmlDtdPtr XMLCALL
718 xmlGetIntSubset (xmlDocPtr doc);
719 XMLPUBFUN void XMLCALL
720 xmlFreeDtd (xmlDtdPtr cur);
721 #ifdef LIBXML_LEGACY_ENABLED
722 XMLPUBFUN xmlNsPtr XMLCALL
723 xmlNewGlobalNs (xmlDocPtr doc,
725 const xmlChar *prefix);
726 #endif /* LIBXML_LEGACY_ENABLED */
727 XMLPUBFUN xmlNsPtr XMLCALL
728 xmlNewNs (xmlNodePtr node,
730 const xmlChar *prefix);
731 XMLPUBFUN void XMLCALL
732 xmlFreeNs (xmlNsPtr cur);
733 XMLPUBFUN void XMLCALL
734 xmlFreeNsList (xmlNsPtr cur);
735 XMLPUBFUN xmlDocPtr XMLCALL
736 xmlNewDoc (const xmlChar *version);
737 XMLPUBFUN void XMLCALL
738 xmlFreeDoc (xmlDocPtr cur);
739 XMLPUBFUN xmlAttrPtr XMLCALL
740 xmlNewDocProp (xmlDocPtr doc,
742 const xmlChar *value);
743 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
744 defined(LIBXML_SCHEMAS_ENABLED)
745 XMLPUBFUN xmlAttrPtr XMLCALL
746 xmlNewProp (xmlNodePtr node,
748 const xmlChar *value);
750 XMLPUBFUN xmlAttrPtr XMLCALL
751 xmlNewNsProp (xmlNodePtr node,
754 const xmlChar *value);
755 XMLPUBFUN xmlAttrPtr XMLCALL
756 xmlNewNsPropEatName (xmlNodePtr node,
759 const xmlChar *value);
760 XMLPUBFUN void XMLCALL
761 xmlFreePropList (xmlAttrPtr cur);
762 XMLPUBFUN void XMLCALL
763 xmlFreeProp (xmlAttrPtr cur);
764 XMLPUBFUN xmlAttrPtr XMLCALL
765 xmlCopyProp (xmlNodePtr target,
767 XMLPUBFUN xmlAttrPtr XMLCALL
768 xmlCopyPropList (xmlNodePtr target,
770 #ifdef LIBXML_TREE_ENABLED
771 XMLPUBFUN xmlDtdPtr XMLCALL
772 xmlCopyDtd (xmlDtdPtr dtd);
773 #endif /* LIBXML_TREE_ENABLED */
774 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
775 XMLPUBFUN xmlDocPtr XMLCALL
776 xmlCopyDoc (xmlDocPtr doc,
778 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
780 * Creating new nodes.
782 XMLPUBFUN xmlNodePtr XMLCALL
783 xmlNewDocNode (xmlDocPtr doc,
786 const xmlChar *content);
787 XMLPUBFUN xmlNodePtr XMLCALL
788 xmlNewDocNodeEatName (xmlDocPtr doc,
791 const xmlChar *content);
792 XMLPUBFUN xmlNodePtr XMLCALL
793 xmlNewNode (xmlNsPtr ns,
794 const xmlChar *name);
795 XMLPUBFUN xmlNodePtr XMLCALL
796 xmlNewNodeEatName (xmlNsPtr ns,
798 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
799 XMLPUBFUN xmlNodePtr XMLCALL
800 xmlNewChild (xmlNodePtr parent,
803 const xmlChar *content);
805 XMLPUBFUN xmlNodePtr XMLCALL
806 xmlNewDocText (xmlDocPtr doc,
807 const xmlChar *content);
808 XMLPUBFUN xmlNodePtr XMLCALL
809 xmlNewText (const xmlChar *content);
810 XMLPUBFUN xmlNodePtr XMLCALL
811 xmlNewDocPI (xmlDocPtr doc,
813 const xmlChar *content);
814 XMLPUBFUN xmlNodePtr XMLCALL
815 xmlNewPI (const xmlChar *name,
816 const xmlChar *content);
817 XMLPUBFUN xmlNodePtr XMLCALL
818 xmlNewDocTextLen (xmlDocPtr doc,
819 const xmlChar *content,
821 XMLPUBFUN xmlNodePtr XMLCALL
822 xmlNewTextLen (const xmlChar *content,
824 XMLPUBFUN xmlNodePtr XMLCALL
825 xmlNewDocComment (xmlDocPtr doc,
826 const xmlChar *content);
827 XMLPUBFUN xmlNodePtr XMLCALL
828 xmlNewComment (const xmlChar *content);
829 XMLPUBFUN xmlNodePtr XMLCALL
830 xmlNewCDataBlock (xmlDocPtr doc,
831 const xmlChar *content,
833 XMLPUBFUN xmlNodePtr XMLCALL
834 xmlNewCharRef (xmlDocPtr doc,
835 const xmlChar *name);
836 XMLPUBFUN xmlNodePtr XMLCALL
837 xmlNewReference (xmlDocPtr doc,
838 const xmlChar *name);
839 XMLPUBFUN xmlNodePtr XMLCALL
840 xmlCopyNode (const xmlNodePtr node,
842 XMLPUBFUN xmlNodePtr XMLCALL
843 xmlDocCopyNode (const xmlNodePtr node,
846 XMLPUBFUN xmlNodePtr XMLCALL
847 xmlDocCopyNodeList (xmlDocPtr doc,
848 const xmlNodePtr node);
849 XMLPUBFUN xmlNodePtr XMLCALL
850 xmlCopyNodeList (const xmlNodePtr node);
851 #ifdef LIBXML_TREE_ENABLED
852 XMLPUBFUN xmlNodePtr XMLCALL
853 xmlNewTextChild (xmlNodePtr parent,
856 const xmlChar *content);
857 XMLPUBFUN xmlNodePtr XMLCALL
858 xmlNewDocRawNode (xmlDocPtr doc,
861 const xmlChar *content);
862 XMLPUBFUN xmlNodePtr XMLCALL
863 xmlNewDocFragment (xmlDocPtr doc);
864 #endif /* LIBXML_TREE_ENABLED */
869 XMLPUBFUN long XMLCALL
870 xmlGetLineNo (xmlNodePtr node);
871 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
872 XMLPUBFUN xmlChar * XMLCALL
873 xmlGetNodePath (xmlNodePtr node);
874 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
875 XMLPUBFUN xmlNodePtr XMLCALL
876 xmlDocGetRootElement (xmlDocPtr doc);
877 XMLPUBFUN xmlNodePtr XMLCALL
878 xmlGetLastChild (xmlNodePtr parent);
879 XMLPUBFUN int XMLCALL
880 xmlNodeIsText (xmlNodePtr node);
881 XMLPUBFUN int XMLCALL
882 xmlIsBlankNode (xmlNodePtr node);
885 * Changing the structure.
887 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
888 XMLPUBFUN xmlNodePtr XMLCALL
889 xmlDocSetRootElement (xmlDocPtr doc,
891 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
892 #ifdef LIBXML_TREE_ENABLED
893 XMLPUBFUN void XMLCALL
894 xmlNodeSetName (xmlNodePtr cur,
895 const xmlChar *name);
896 #endif /* LIBXML_TREE_ENABLED */
897 XMLPUBFUN xmlNodePtr XMLCALL
898 xmlAddChild (xmlNodePtr parent,
900 XMLPUBFUN xmlNodePtr XMLCALL
901 xmlAddChildList (xmlNodePtr parent,
903 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
904 XMLPUBFUN xmlNodePtr XMLCALL
905 xmlReplaceNode (xmlNodePtr old,
907 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
908 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
909 defined(LIBXML_SCHEMAS_ENABLED)
910 XMLPUBFUN xmlNodePtr XMLCALL
911 xmlAddPrevSibling (xmlNodePtr cur,
913 #endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */
914 XMLPUBFUN xmlNodePtr XMLCALL
915 xmlAddSibling (xmlNodePtr cur,
917 XMLPUBFUN xmlNodePtr XMLCALL
918 xmlAddNextSibling (xmlNodePtr cur,
920 XMLPUBFUN void XMLCALL
921 xmlUnlinkNode (xmlNodePtr cur);
922 XMLPUBFUN xmlNodePtr XMLCALL
923 xmlTextMerge (xmlNodePtr first,
925 XMLPUBFUN int XMLCALL
926 xmlTextConcat (xmlNodePtr node,
927 const xmlChar *content,
929 XMLPUBFUN void XMLCALL
930 xmlFreeNodeList (xmlNodePtr cur);
931 XMLPUBFUN void XMLCALL
932 xmlFreeNode (xmlNodePtr cur);
933 XMLPUBFUN void XMLCALL
934 xmlSetTreeDoc (xmlNodePtr tree,
936 XMLPUBFUN void XMLCALL
937 xmlSetListDoc (xmlNodePtr list,
942 XMLPUBFUN xmlNsPtr XMLCALL
943 xmlSearchNs (xmlDocPtr doc,
945 const xmlChar *nameSpace);
946 XMLPUBFUN xmlNsPtr XMLCALL
947 xmlSearchNsByHref (xmlDocPtr doc,
949 const xmlChar *href);
950 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
951 XMLPUBFUN xmlNsPtr * XMLCALL
952 xmlGetNsList (xmlDocPtr doc,
954 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
956 XMLPUBFUN void XMLCALL
957 xmlSetNs (xmlNodePtr node,
959 XMLPUBFUN xmlNsPtr XMLCALL
960 xmlCopyNamespace (xmlNsPtr cur);
961 XMLPUBFUN xmlNsPtr XMLCALL
962 xmlCopyNamespaceList (xmlNsPtr cur);
965 * Changing the content.
967 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
968 XMLPUBFUN xmlAttrPtr XMLCALL
969 xmlSetProp (xmlNodePtr node,
971 const xmlChar *value);
972 XMLPUBFUN xmlAttrPtr XMLCALL
973 xmlSetNsProp (xmlNodePtr node,
976 const xmlChar *value);
977 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
978 XMLPUBFUN xmlChar * XMLCALL
979 xmlGetNoNsProp (xmlNodePtr node,
980 const xmlChar *name);
981 XMLPUBFUN xmlChar * XMLCALL
982 xmlGetProp (xmlNodePtr node,
983 const xmlChar *name);
984 XMLPUBFUN xmlAttrPtr XMLCALL
985 xmlHasProp (xmlNodePtr node,
986 const xmlChar *name);
987 XMLPUBFUN xmlAttrPtr XMLCALL
988 xmlHasNsProp (xmlNodePtr node,
990 const xmlChar *nameSpace);
991 XMLPUBFUN xmlChar * XMLCALL
992 xmlGetNsProp (xmlNodePtr node,
994 const xmlChar *nameSpace);
995 XMLPUBFUN xmlNodePtr XMLCALL
996 xmlStringGetNodeList (xmlDocPtr doc,
997 const xmlChar *value);
998 XMLPUBFUN xmlNodePtr XMLCALL
999 xmlStringLenGetNodeList (xmlDocPtr doc,
1000 const xmlChar *value,
1002 XMLPUBFUN xmlChar * XMLCALL
1003 xmlNodeListGetString (xmlDocPtr doc,
1006 #ifdef LIBXML_TREE_ENABLED
1007 XMLPUBFUN xmlChar * XMLCALL
1008 xmlNodeListGetRawString (xmlDocPtr doc,
1011 #endif /* LIBXML_TREE_ENABLED */
1012 XMLPUBFUN void XMLCALL
1013 xmlNodeSetContent (xmlNodePtr cur,
1014 const xmlChar *content);
1015 #ifdef LIBXML_TREE_ENABLED
1016 XMLPUBFUN void XMLCALL
1017 xmlNodeSetContentLen (xmlNodePtr cur,
1018 const xmlChar *content,
1020 #endif /* LIBXML_TREE_ENABLED */
1021 XMLPUBFUN void XMLCALL
1022 xmlNodeAddContent (xmlNodePtr cur,
1023 const xmlChar *content);
1024 XMLPUBFUN void XMLCALL
1025 xmlNodeAddContentLen (xmlNodePtr cur,
1026 const xmlChar *content,
1028 XMLPUBFUN xmlChar * XMLCALL
1029 xmlNodeGetContent (xmlNodePtr cur);
1030 XMLPUBFUN int XMLCALL
1031 xmlNodeBufGetContent (xmlBufferPtr buffer,
1033 XMLPUBFUN xmlChar * XMLCALL
1034 xmlNodeGetLang (xmlNodePtr cur);
1035 XMLPUBFUN int XMLCALL
1036 xmlNodeGetSpacePreserve (xmlNodePtr cur);
1037 #ifdef LIBXML_TREE_ENABLED
1038 XMLPUBFUN void XMLCALL
1039 xmlNodeSetLang (xmlNodePtr cur,
1040 const xmlChar *lang);
1041 XMLPUBFUN void XMLCALL
1042 xmlNodeSetSpacePreserve (xmlNodePtr cur,
1044 #endif /* LIBXML_TREE_ENABLED */
1045 XMLPUBFUN xmlChar * XMLCALL
1046 xmlNodeGetBase (xmlDocPtr doc,
1048 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
1049 XMLPUBFUN void XMLCALL
1050 xmlNodeSetBase (xmlNodePtr cur,
1051 const xmlChar *uri);
1057 XMLPUBFUN int XMLCALL
1058 xmlRemoveProp (xmlAttrPtr cur);
1059 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
1060 XMLPUBFUN int XMLCALL
1061 xmlUnsetNsProp (xmlNodePtr node,
1063 const xmlChar *name);
1064 XMLPUBFUN int XMLCALL
1065 xmlUnsetProp (xmlNodePtr node,
1066 const xmlChar *name);
1067 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
1070 * Internal, don't use.
1072 XMLPUBFUN void XMLCALL
1073 xmlBufferWriteCHAR (xmlBufferPtr buf,
1074 const xmlChar *string);
1075 XMLPUBFUN void XMLCALL
1076 xmlBufferWriteChar (xmlBufferPtr buf,
1077 const char *string);
1078 XMLPUBFUN void XMLCALL
1079 xmlBufferWriteQuotedString(xmlBufferPtr buf,
1080 const xmlChar *string);
1082 #ifdef LIBXML_OUTPUT_ENABLED
1083 XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf,
1086 const xmlChar *string);
1087 #endif /* LIBXML_OUTPUT_ENABLED */
1089 #ifdef LIBXML_TREE_ENABLED
1091 * Namespace handling.
1093 XMLPUBFUN int XMLCALL
1094 xmlReconciliateNs (xmlDocPtr doc,
1098 #ifdef LIBXML_OUTPUT_ENABLED
1102 XMLPUBFUN void XMLCALL
1103 xmlDocDumpFormatMemory (xmlDocPtr cur,
1107 XMLPUBFUN void XMLCALL
1108 xmlDocDumpMemory (xmlDocPtr cur,
1111 XMLPUBFUN void XMLCALL
1112 xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
1113 xmlChar **doc_txt_ptr,
1115 const char *txt_encoding);
1116 XMLPUBFUN void XMLCALL
1117 xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
1118 xmlChar **doc_txt_ptr,
1120 const char *txt_encoding,
1122 XMLPUBFUN int XMLCALL
1123 xmlDocFormatDump (FILE *f,
1126 XMLPUBFUN int XMLCALL
1127 xmlDocDump (FILE *f,
1129 XMLPUBFUN void XMLCALL
1130 xmlElemDump (FILE *f,
1133 XMLPUBFUN int XMLCALL
1134 xmlSaveFile (const char *filename,
1136 XMLPUBFUN int XMLCALL
1137 xmlSaveFormatFile (const char *filename,
1140 XMLPUBFUN int XMLCALL
1141 xmlNodeDump (xmlBufferPtr buf,
1147 XMLPUBFUN int XMLCALL
1148 xmlSaveFileTo (xmlOutputBufferPtr buf,
1150 const char *encoding);
1151 XMLPUBFUN int XMLCALL
1152 xmlSaveFormatFileTo (xmlOutputBufferPtr buf,
1154 const char *encoding,
1156 XMLPUBFUN void XMLCALL
1157 xmlNodeDumpOutput (xmlOutputBufferPtr buf,
1162 const char *encoding);
1164 XMLPUBFUN int XMLCALL
1165 xmlSaveFormatFileEnc (const char *filename,
1167 const char *encoding,
1170 XMLPUBFUN int XMLCALL
1171 xmlSaveFileEnc (const char *filename,
1173 const char *encoding);
1175 #endif /* LIBXML_OUTPUT_ENABLED */
1179 XMLPUBFUN int XMLCALL
1180 xmlIsXHTML (const xmlChar *systemID,
1181 const xmlChar *publicID);
1186 XMLPUBFUN int XMLCALL
1187 xmlGetDocCompressMode (xmlDocPtr doc);
1188 XMLPUBFUN void XMLCALL
1189 xmlSetDocCompressMode (xmlDocPtr doc,
1191 XMLPUBFUN int XMLCALL
1192 xmlGetCompressMode (void);
1193 XMLPUBFUN void XMLCALL
1194 xmlSetCompressMode (int mode);
1197 * DOM-wrapper helper functions.
1199 XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL
1200 xmlDOMWrapNewCtxt (void);
1201 XMLPUBFUN void XMLCALL
1202 xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt);
1203 XMLPUBFUN int XMLCALL
1204 xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt,
1207 XMLPUBFUN int XMLCALL
1208 xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt,
1209 xmlDocPtr sourceDoc,
1212 xmlNodePtr destParent,
1214 XMLPUBFUN int XMLCALL
1215 xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt,
1219 XMLPUBFUN int XMLCALL
1220 xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt,
1221 xmlDocPtr sourceDoc,
1223 xmlNodePtr *clonedNode,
1225 xmlNodePtr destParent,
1229 #ifdef LIBXML_TREE_ENABLED
1231 * 5 interfaces from DOM ElementTraversal, but different in entities
1234 XMLPUBFUN unsigned long XMLCALL
1235 xmlChildElementCount (xmlNodePtr parent);
1236 XMLPUBFUN xmlNodePtr XMLCALL
1237 xmlNextElementSibling (xmlNodePtr node);
1238 XMLPUBFUN xmlNodePtr XMLCALL
1239 xmlFirstElementChild (xmlNodePtr parent);
1240 XMLPUBFUN xmlNodePtr XMLCALL
1241 xmlLastElementChild (xmlNodePtr parent);
1242 XMLPUBFUN xmlNodePtr XMLCALL
1243 xmlPreviousElementSibling (xmlNodePtr node);
1248 #ifndef __XML_PARSER_H__
1249 #include <libxml/xmlmemory.h>
1252 #endif /* __XML_TREE_H__ */