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 XML_BUFFER_ALLOC_HYBRID /* exact up to a threshold, and doubleit thereafter */
79 } xmlBufferAllocationScheme;
86 typedef struct _xmlBuffer xmlBuffer;
87 typedef xmlBuffer *xmlBufferPtr;
89 xmlChar *content; /* The buffer content UTF8 */
90 unsigned int use; /* The buffer size used */
91 unsigned int size; /* The buffer size */
92 xmlBufferAllocationScheme alloc; /* The realloc method */
93 xmlChar *contentIO; /* in IO mode we may have a different base */
99 * This is the namespace for the special xml: prefix predefined in the
100 * XML Namespace specification.
102 #define XML_XML_NAMESPACE \
103 (const xmlChar *) "http://www.w3.org/XML/1998/namespace"
108 * This is the name for the special xml:id attribute
110 #define XML_XML_ID (const xmlChar *) "xml:id"
113 * The different element types carried by an XML tree.
115 * NOTE: This is synchronized with DOM Level1 values
116 * See http://www.w3.org/TR/REC-DOM-Level-1/
118 * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
119 * be deprecated to use an XML_DTD_NODE.
123 XML_ATTRIBUTE_NODE= 2,
125 XML_CDATA_SECTION_NODE= 4,
126 XML_ENTITY_REF_NODE= 5,
130 XML_DOCUMENT_NODE= 9,
131 XML_DOCUMENT_TYPE_NODE= 10,
132 XML_DOCUMENT_FRAG_NODE= 11,
133 XML_NOTATION_NODE= 12,
134 XML_HTML_DOCUMENT_NODE= 13,
136 XML_ELEMENT_DECL= 15,
137 XML_ATTRIBUTE_DECL= 16,
139 XML_NAMESPACE_DECL= 18,
140 XML_XINCLUDE_START= 19,
142 #ifdef LIBXML_DOCB_ENABLED
143 ,XML_DOCB_DOCUMENT_NODE= 21
151 * A DTD Notation definition.
154 typedef struct _xmlNotation xmlNotation;
155 typedef xmlNotation *xmlNotationPtr;
156 struct _xmlNotation {
157 const xmlChar *name; /* Notation name */
158 const xmlChar *PublicID; /* Public identifier, if any */
159 const xmlChar *SystemID; /* System identifier, if any */
165 * A DTD Attribute type definition.
169 XML_ATTRIBUTE_CDATA = 1,
171 XML_ATTRIBUTE_IDREF ,
172 XML_ATTRIBUTE_IDREFS,
173 XML_ATTRIBUTE_ENTITY,
174 XML_ATTRIBUTE_ENTITIES,
175 XML_ATTRIBUTE_NMTOKEN,
176 XML_ATTRIBUTE_NMTOKENS,
177 XML_ATTRIBUTE_ENUMERATION,
178 XML_ATTRIBUTE_NOTATION
182 * xmlAttributeDefault:
184 * A DTD Attribute default definition.
188 XML_ATTRIBUTE_NONE = 1,
189 XML_ATTRIBUTE_REQUIRED,
190 XML_ATTRIBUTE_IMPLIED,
192 } xmlAttributeDefault;
197 * List structure used when there is an enumeration in DTDs.
200 typedef struct _xmlEnumeration xmlEnumeration;
201 typedef xmlEnumeration *xmlEnumerationPtr;
202 struct _xmlEnumeration {
203 struct _xmlEnumeration *next; /* next one */
204 const xmlChar *name; /* Enumeration name */
210 * An Attribute declaration in a DTD.
213 typedef struct _xmlAttribute xmlAttribute;
214 typedef xmlAttribute *xmlAttributePtr;
215 struct _xmlAttribute {
216 void *_private; /* application data */
217 xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
218 const xmlChar *name; /* Attribute name */
219 struct _xmlNode *children; /* NULL */
220 struct _xmlNode *last; /* NULL */
221 struct _xmlDtd *parent; /* -> DTD */
222 struct _xmlNode *next; /* next sibling link */
223 struct _xmlNode *prev; /* previous sibling link */
224 struct _xmlDoc *doc; /* the containing document */
226 struct _xmlAttribute *nexth; /* next in hash table */
227 xmlAttributeType atype; /* The attribute type */
228 xmlAttributeDefault def; /* the default */
229 const xmlChar *defaultValue; /* or the default value */
230 xmlEnumerationPtr tree; /* or the enumeration tree if any */
231 const xmlChar *prefix; /* the namespace prefix if any */
232 const xmlChar *elem; /* Element holding the attribute */
236 * xmlElementContentType:
238 * Possible definitions of element content types.
241 XML_ELEMENT_CONTENT_PCDATA = 1,
242 XML_ELEMENT_CONTENT_ELEMENT,
243 XML_ELEMENT_CONTENT_SEQ,
244 XML_ELEMENT_CONTENT_OR
245 } xmlElementContentType;
248 * xmlElementContentOccur:
250 * Possible definitions of element content occurrences.
253 XML_ELEMENT_CONTENT_ONCE = 1,
254 XML_ELEMENT_CONTENT_OPT,
255 XML_ELEMENT_CONTENT_MULT,
256 XML_ELEMENT_CONTENT_PLUS
257 } xmlElementContentOccur;
262 * An XML Element content as stored after parsing an element definition
266 typedef struct _xmlElementContent xmlElementContent;
267 typedef xmlElementContent *xmlElementContentPtr;
268 struct _xmlElementContent {
269 xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
270 xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
271 const xmlChar *name; /* Element name */
272 struct _xmlElementContent *c1; /* first child */
273 struct _xmlElementContent *c2; /* second child */
274 struct _xmlElementContent *parent; /* parent */
275 const xmlChar *prefix; /* Namespace prefix */
281 * The different possibilities for an element content type.
285 XML_ELEMENT_TYPE_UNDEFINED = 0,
286 XML_ELEMENT_TYPE_EMPTY = 1,
287 XML_ELEMENT_TYPE_ANY,
288 XML_ELEMENT_TYPE_MIXED,
289 XML_ELEMENT_TYPE_ELEMENT
295 #include <libxml/xmlregexp.h>
303 * An XML Element declaration from a DTD.
306 typedef struct _xmlElement xmlElement;
307 typedef xmlElement *xmlElementPtr;
309 void *_private; /* application data */
310 xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */
311 const xmlChar *name; /* Element name */
312 struct _xmlNode *children; /* NULL */
313 struct _xmlNode *last; /* NULL */
314 struct _xmlDtd *parent; /* -> DTD */
315 struct _xmlNode *next; /* next sibling link */
316 struct _xmlNode *prev; /* previous sibling link */
317 struct _xmlDoc *doc; /* the containing document */
319 xmlElementTypeVal etype; /* The type */
320 xmlElementContentPtr content; /* the allowed element content */
321 xmlAttributePtr attributes; /* List of the declared attributes */
322 const xmlChar *prefix; /* the namespace prefix if any */
323 #ifdef LIBXML_REGEXP_ENABLED
324 xmlRegexpPtr contModel; /* the validating regexp */
332 * XML_LOCAL_NAMESPACE:
334 * A namespace declaration node.
336 #define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
337 typedef xmlElementType xmlNsType;
343 * Note that prefix == NULL is valid, it defines the default namespace
344 * within the subtree (until overridden).
346 * xmlNsType is unified with xmlElementType.
349 typedef struct _xmlNs xmlNs;
350 typedef xmlNs *xmlNsPtr;
352 struct _xmlNs *next; /* next Ns link for this node */
353 xmlNsType type; /* global or local */
354 const xmlChar *href; /* URL for the namespace */
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 xmlChar* XMLCALL
699 xmlBufferDetach (const xmlBufferPtr buf);
700 XMLPUBFUN void XMLCALL
701 xmlBufferSetAllocationScheme(xmlBufferPtr buf,
702 xmlBufferAllocationScheme scheme);
703 XMLPUBFUN int XMLCALL
704 xmlBufferLength (const xmlBufferPtr buf);
707 * Creating/freeing new structures.
709 XMLPUBFUN xmlDtdPtr XMLCALL
710 xmlCreateIntSubset (xmlDocPtr doc,
712 const xmlChar *ExternalID,
713 const xmlChar *SystemID);
714 XMLPUBFUN xmlDtdPtr XMLCALL
715 xmlNewDtd (xmlDocPtr doc,
717 const xmlChar *ExternalID,
718 const xmlChar *SystemID);
719 XMLPUBFUN xmlDtdPtr XMLCALL
720 xmlGetIntSubset (xmlDocPtr doc);
721 XMLPUBFUN void XMLCALL
722 xmlFreeDtd (xmlDtdPtr cur);
723 #ifdef LIBXML_LEGACY_ENABLED
724 XMLPUBFUN xmlNsPtr XMLCALL
725 xmlNewGlobalNs (xmlDocPtr doc,
727 const xmlChar *prefix);
728 #endif /* LIBXML_LEGACY_ENABLED */
729 XMLPUBFUN xmlNsPtr XMLCALL
730 xmlNewNs (xmlNodePtr node,
732 const xmlChar *prefix);
733 XMLPUBFUN void XMLCALL
734 xmlFreeNs (xmlNsPtr cur);
735 XMLPUBFUN void XMLCALL
736 xmlFreeNsList (xmlNsPtr cur);
737 XMLPUBFUN xmlDocPtr XMLCALL
738 xmlNewDoc (const xmlChar *version);
739 XMLPUBFUN void XMLCALL
740 xmlFreeDoc (xmlDocPtr cur);
741 XMLPUBFUN xmlAttrPtr XMLCALL
742 xmlNewDocProp (xmlDocPtr doc,
744 const xmlChar *value);
745 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
746 defined(LIBXML_SCHEMAS_ENABLED)
747 XMLPUBFUN xmlAttrPtr XMLCALL
748 xmlNewProp (xmlNodePtr node,
750 const xmlChar *value);
752 XMLPUBFUN xmlAttrPtr XMLCALL
753 xmlNewNsProp (xmlNodePtr node,
756 const xmlChar *value);
757 XMLPUBFUN xmlAttrPtr XMLCALL
758 xmlNewNsPropEatName (xmlNodePtr node,
761 const xmlChar *value);
762 XMLPUBFUN void XMLCALL
763 xmlFreePropList (xmlAttrPtr cur);
764 XMLPUBFUN void XMLCALL
765 xmlFreeProp (xmlAttrPtr cur);
766 XMLPUBFUN xmlAttrPtr XMLCALL
767 xmlCopyProp (xmlNodePtr target,
769 XMLPUBFUN xmlAttrPtr XMLCALL
770 xmlCopyPropList (xmlNodePtr target,
772 #ifdef LIBXML_TREE_ENABLED
773 XMLPUBFUN xmlDtdPtr XMLCALL
774 xmlCopyDtd (xmlDtdPtr dtd);
775 #endif /* LIBXML_TREE_ENABLED */
776 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
777 XMLPUBFUN xmlDocPtr XMLCALL
778 xmlCopyDoc (xmlDocPtr doc,
780 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
782 * Creating new nodes.
784 XMLPUBFUN xmlNodePtr XMLCALL
785 xmlNewDocNode (xmlDocPtr doc,
788 const xmlChar *content);
789 XMLPUBFUN xmlNodePtr XMLCALL
790 xmlNewDocNodeEatName (xmlDocPtr doc,
793 const xmlChar *content);
794 XMLPUBFUN xmlNodePtr XMLCALL
795 xmlNewNode (xmlNsPtr ns,
796 const xmlChar *name);
797 XMLPUBFUN xmlNodePtr XMLCALL
798 xmlNewNodeEatName (xmlNsPtr ns,
800 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
801 XMLPUBFUN xmlNodePtr XMLCALL
802 xmlNewChild (xmlNodePtr parent,
805 const xmlChar *content);
807 XMLPUBFUN xmlNodePtr XMLCALL
808 xmlNewDocText (xmlDocPtr doc,
809 const xmlChar *content);
810 XMLPUBFUN xmlNodePtr XMLCALL
811 xmlNewText (const xmlChar *content);
812 XMLPUBFUN xmlNodePtr XMLCALL
813 xmlNewDocPI (xmlDocPtr doc,
815 const xmlChar *content);
816 XMLPUBFUN xmlNodePtr XMLCALL
817 xmlNewPI (const xmlChar *name,
818 const xmlChar *content);
819 XMLPUBFUN xmlNodePtr XMLCALL
820 xmlNewDocTextLen (xmlDocPtr doc,
821 const xmlChar *content,
823 XMLPUBFUN xmlNodePtr XMLCALL
824 xmlNewTextLen (const xmlChar *content,
826 XMLPUBFUN xmlNodePtr XMLCALL
827 xmlNewDocComment (xmlDocPtr doc,
828 const xmlChar *content);
829 XMLPUBFUN xmlNodePtr XMLCALL
830 xmlNewComment (const xmlChar *content);
831 XMLPUBFUN xmlNodePtr XMLCALL
832 xmlNewCDataBlock (xmlDocPtr doc,
833 const xmlChar *content,
835 XMLPUBFUN xmlNodePtr XMLCALL
836 xmlNewCharRef (xmlDocPtr doc,
837 const xmlChar *name);
838 XMLPUBFUN xmlNodePtr XMLCALL
839 xmlNewReference (xmlDocPtr doc,
840 const xmlChar *name);
841 XMLPUBFUN xmlNodePtr XMLCALL
842 xmlCopyNode (const xmlNodePtr node,
844 XMLPUBFUN xmlNodePtr XMLCALL
845 xmlDocCopyNode (const xmlNodePtr node,
848 XMLPUBFUN xmlNodePtr XMLCALL
849 xmlDocCopyNodeList (xmlDocPtr doc,
850 const xmlNodePtr node);
851 XMLPUBFUN xmlNodePtr XMLCALL
852 xmlCopyNodeList (const xmlNodePtr node);
853 #ifdef LIBXML_TREE_ENABLED
854 XMLPUBFUN xmlNodePtr XMLCALL
855 xmlNewTextChild (xmlNodePtr parent,
858 const xmlChar *content);
859 XMLPUBFUN xmlNodePtr XMLCALL
860 xmlNewDocRawNode (xmlDocPtr doc,
863 const xmlChar *content);
864 XMLPUBFUN xmlNodePtr XMLCALL
865 xmlNewDocFragment (xmlDocPtr doc);
866 #endif /* LIBXML_TREE_ENABLED */
871 XMLPUBFUN long XMLCALL
872 xmlGetLineNo (xmlNodePtr node);
873 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
874 XMLPUBFUN xmlChar * XMLCALL
875 xmlGetNodePath (xmlNodePtr node);
876 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
877 XMLPUBFUN xmlNodePtr XMLCALL
878 xmlDocGetRootElement (xmlDocPtr doc);
879 XMLPUBFUN xmlNodePtr XMLCALL
880 xmlGetLastChild (xmlNodePtr parent);
881 XMLPUBFUN int XMLCALL
882 xmlNodeIsText (xmlNodePtr node);
883 XMLPUBFUN int XMLCALL
884 xmlIsBlankNode (xmlNodePtr node);
887 * Changing the structure.
889 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
890 XMLPUBFUN xmlNodePtr XMLCALL
891 xmlDocSetRootElement (xmlDocPtr doc,
893 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
894 #ifdef LIBXML_TREE_ENABLED
895 XMLPUBFUN void XMLCALL
896 xmlNodeSetName (xmlNodePtr cur,
897 const xmlChar *name);
898 #endif /* LIBXML_TREE_ENABLED */
899 XMLPUBFUN xmlNodePtr XMLCALL
900 xmlAddChild (xmlNodePtr parent,
902 XMLPUBFUN xmlNodePtr XMLCALL
903 xmlAddChildList (xmlNodePtr parent,
905 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
906 XMLPUBFUN xmlNodePtr XMLCALL
907 xmlReplaceNode (xmlNodePtr old,
909 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
910 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
911 defined(LIBXML_SCHEMAS_ENABLED)
912 XMLPUBFUN xmlNodePtr XMLCALL
913 xmlAddPrevSibling (xmlNodePtr cur,
915 #endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */
916 XMLPUBFUN xmlNodePtr XMLCALL
917 xmlAddSibling (xmlNodePtr cur,
919 XMLPUBFUN xmlNodePtr XMLCALL
920 xmlAddNextSibling (xmlNodePtr cur,
922 XMLPUBFUN void XMLCALL
923 xmlUnlinkNode (xmlNodePtr cur);
924 XMLPUBFUN xmlNodePtr XMLCALL
925 xmlTextMerge (xmlNodePtr first,
927 XMLPUBFUN int XMLCALL
928 xmlTextConcat (xmlNodePtr node,
929 const xmlChar *content,
931 XMLPUBFUN void XMLCALL
932 xmlFreeNodeList (xmlNodePtr cur);
933 XMLPUBFUN void XMLCALL
934 xmlFreeNode (xmlNodePtr cur);
935 XMLPUBFUN void XMLCALL
936 xmlSetTreeDoc (xmlNodePtr tree,
938 XMLPUBFUN void XMLCALL
939 xmlSetListDoc (xmlNodePtr list,
944 XMLPUBFUN xmlNsPtr XMLCALL
945 xmlSearchNs (xmlDocPtr doc,
947 const xmlChar *nameSpace);
948 XMLPUBFUN xmlNsPtr XMLCALL
949 xmlSearchNsByHref (xmlDocPtr doc,
951 const xmlChar *href);
952 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
953 XMLPUBFUN xmlNsPtr * XMLCALL
954 xmlGetNsList (xmlDocPtr doc,
956 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
958 XMLPUBFUN void XMLCALL
959 xmlSetNs (xmlNodePtr node,
961 XMLPUBFUN xmlNsPtr XMLCALL
962 xmlCopyNamespace (xmlNsPtr cur);
963 XMLPUBFUN xmlNsPtr XMLCALL
964 xmlCopyNamespaceList (xmlNsPtr cur);
967 * Changing the content.
969 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
970 XMLPUBFUN xmlAttrPtr XMLCALL
971 xmlSetProp (xmlNodePtr node,
973 const xmlChar *value);
974 XMLPUBFUN xmlAttrPtr XMLCALL
975 xmlSetNsProp (xmlNodePtr node,
978 const xmlChar *value);
979 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
980 XMLPUBFUN xmlChar * XMLCALL
981 xmlGetNoNsProp (xmlNodePtr node,
982 const xmlChar *name);
983 XMLPUBFUN xmlChar * XMLCALL
984 xmlGetProp (xmlNodePtr node,
985 const xmlChar *name);
986 XMLPUBFUN xmlAttrPtr XMLCALL
987 xmlHasProp (xmlNodePtr node,
988 const xmlChar *name);
989 XMLPUBFUN xmlAttrPtr XMLCALL
990 xmlHasNsProp (xmlNodePtr node,
992 const xmlChar *nameSpace);
993 XMLPUBFUN xmlChar * XMLCALL
994 xmlGetNsProp (xmlNodePtr node,
996 const xmlChar *nameSpace);
997 XMLPUBFUN xmlNodePtr XMLCALL
998 xmlStringGetNodeList (xmlDocPtr doc,
999 const xmlChar *value);
1000 XMLPUBFUN xmlNodePtr XMLCALL
1001 xmlStringLenGetNodeList (xmlDocPtr doc,
1002 const xmlChar *value,
1004 XMLPUBFUN xmlChar * XMLCALL
1005 xmlNodeListGetString (xmlDocPtr doc,
1008 #ifdef LIBXML_TREE_ENABLED
1009 XMLPUBFUN xmlChar * XMLCALL
1010 xmlNodeListGetRawString (xmlDocPtr doc,
1013 #endif /* LIBXML_TREE_ENABLED */
1014 XMLPUBFUN void XMLCALL
1015 xmlNodeSetContent (xmlNodePtr cur,
1016 const xmlChar *content);
1017 #ifdef LIBXML_TREE_ENABLED
1018 XMLPUBFUN void XMLCALL
1019 xmlNodeSetContentLen (xmlNodePtr cur,
1020 const xmlChar *content,
1022 #endif /* LIBXML_TREE_ENABLED */
1023 XMLPUBFUN void XMLCALL
1024 xmlNodeAddContent (xmlNodePtr cur,
1025 const xmlChar *content);
1026 XMLPUBFUN void XMLCALL
1027 xmlNodeAddContentLen (xmlNodePtr cur,
1028 const xmlChar *content,
1030 XMLPUBFUN xmlChar * XMLCALL
1031 xmlNodeGetContent (xmlNodePtr cur);
1032 XMLPUBFUN int XMLCALL
1033 xmlNodeBufGetContent (xmlBufferPtr buffer,
1035 XMLPUBFUN xmlChar * XMLCALL
1036 xmlNodeGetLang (xmlNodePtr cur);
1037 XMLPUBFUN int XMLCALL
1038 xmlNodeGetSpacePreserve (xmlNodePtr cur);
1039 #ifdef LIBXML_TREE_ENABLED
1040 XMLPUBFUN void XMLCALL
1041 xmlNodeSetLang (xmlNodePtr cur,
1042 const xmlChar *lang);
1043 XMLPUBFUN void XMLCALL
1044 xmlNodeSetSpacePreserve (xmlNodePtr cur,
1046 #endif /* LIBXML_TREE_ENABLED */
1047 XMLPUBFUN xmlChar * XMLCALL
1048 xmlNodeGetBase (xmlDocPtr doc,
1050 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
1051 XMLPUBFUN void XMLCALL
1052 xmlNodeSetBase (xmlNodePtr cur,
1053 const xmlChar *uri);
1059 XMLPUBFUN int XMLCALL
1060 xmlRemoveProp (xmlAttrPtr cur);
1061 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
1062 XMLPUBFUN int XMLCALL
1063 xmlUnsetNsProp (xmlNodePtr node,
1065 const xmlChar *name);
1066 XMLPUBFUN int XMLCALL
1067 xmlUnsetProp (xmlNodePtr node,
1068 const xmlChar *name);
1069 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
1072 * Internal, don't use.
1074 XMLPUBFUN void XMLCALL
1075 xmlBufferWriteCHAR (xmlBufferPtr buf,
1076 const xmlChar *string);
1077 XMLPUBFUN void XMLCALL
1078 xmlBufferWriteChar (xmlBufferPtr buf,
1079 const char *string);
1080 XMLPUBFUN void XMLCALL
1081 xmlBufferWriteQuotedString(xmlBufferPtr buf,
1082 const xmlChar *string);
1084 #ifdef LIBXML_OUTPUT_ENABLED
1085 XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf,
1088 const xmlChar *string);
1089 #endif /* LIBXML_OUTPUT_ENABLED */
1091 #ifdef LIBXML_TREE_ENABLED
1093 * Namespace handling.
1095 XMLPUBFUN int XMLCALL
1096 xmlReconciliateNs (xmlDocPtr doc,
1100 #ifdef LIBXML_OUTPUT_ENABLED
1104 XMLPUBFUN void XMLCALL
1105 xmlDocDumpFormatMemory (xmlDocPtr cur,
1109 XMLPUBFUN void XMLCALL
1110 xmlDocDumpMemory (xmlDocPtr cur,
1113 XMLPUBFUN void XMLCALL
1114 xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
1115 xmlChar **doc_txt_ptr,
1117 const char *txt_encoding);
1118 XMLPUBFUN void XMLCALL
1119 xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
1120 xmlChar **doc_txt_ptr,
1122 const char *txt_encoding,
1124 XMLPUBFUN int XMLCALL
1125 xmlDocFormatDump (FILE *f,
1128 XMLPUBFUN int XMLCALL
1129 xmlDocDump (FILE *f,
1131 XMLPUBFUN void XMLCALL
1132 xmlElemDump (FILE *f,
1135 XMLPUBFUN int XMLCALL
1136 xmlSaveFile (const char *filename,
1138 XMLPUBFUN int XMLCALL
1139 xmlSaveFormatFile (const char *filename,
1142 XMLPUBFUN int XMLCALL
1143 xmlNodeDump (xmlBufferPtr buf,
1149 XMLPUBFUN int XMLCALL
1150 xmlSaveFileTo (xmlOutputBufferPtr buf,
1152 const char *encoding);
1153 XMLPUBFUN int XMLCALL
1154 xmlSaveFormatFileTo (xmlOutputBufferPtr buf,
1156 const char *encoding,
1158 XMLPUBFUN void XMLCALL
1159 xmlNodeDumpOutput (xmlOutputBufferPtr buf,
1164 const char *encoding);
1166 XMLPUBFUN int XMLCALL
1167 xmlSaveFormatFileEnc (const char *filename,
1169 const char *encoding,
1172 XMLPUBFUN int XMLCALL
1173 xmlSaveFileEnc (const char *filename,
1175 const char *encoding);
1177 #endif /* LIBXML_OUTPUT_ENABLED */
1181 XMLPUBFUN int XMLCALL
1182 xmlIsXHTML (const xmlChar *systemID,
1183 const xmlChar *publicID);
1188 XMLPUBFUN int XMLCALL
1189 xmlGetDocCompressMode (xmlDocPtr doc);
1190 XMLPUBFUN void XMLCALL
1191 xmlSetDocCompressMode (xmlDocPtr doc,
1193 XMLPUBFUN int XMLCALL
1194 xmlGetCompressMode (void);
1195 XMLPUBFUN void XMLCALL
1196 xmlSetCompressMode (int mode);
1199 * DOM-wrapper helper functions.
1201 XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL
1202 xmlDOMWrapNewCtxt (void);
1203 XMLPUBFUN void XMLCALL
1204 xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt);
1205 XMLPUBFUN int XMLCALL
1206 xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt,
1209 XMLPUBFUN int XMLCALL
1210 xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt,
1211 xmlDocPtr sourceDoc,
1214 xmlNodePtr destParent,
1216 XMLPUBFUN int XMLCALL
1217 xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt,
1221 XMLPUBFUN int XMLCALL
1222 xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt,
1223 xmlDocPtr sourceDoc,
1225 xmlNodePtr *clonedNode,
1227 xmlNodePtr destParent,
1231 #ifdef LIBXML_TREE_ENABLED
1233 * 5 interfaces from DOM ElementTraversal, but different in entities
1236 XMLPUBFUN unsigned long XMLCALL
1237 xmlChildElementCount (xmlNodePtr parent);
1238 XMLPUBFUN xmlNodePtr XMLCALL
1239 xmlNextElementSibling (xmlNodePtr node);
1240 XMLPUBFUN xmlNodePtr XMLCALL
1241 xmlFirstElementChild (xmlNodePtr parent);
1242 XMLPUBFUN xmlNodePtr XMLCALL
1243 xmlLastElementChild (xmlNodePtr parent);
1244 XMLPUBFUN xmlNodePtr XMLCALL
1245 xmlPreviousElementSibling (xmlNodePtr node);
1250 #ifndef __XML_PARSER_H__
1251 #include <libxml/xmlmemory.h>
1254 #endif /* __XML_TREE_H__ */