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__
17 #include <libxml/xmlversion.h>
18 #include <libxml/xmlstring.h>
25 * Some of the basic types pointer to structures:
28 typedef struct _xmlParserInputBuffer xmlParserInputBuffer;
29 typedef xmlParserInputBuffer *xmlParserInputBufferPtr;
31 typedef struct _xmlOutputBuffer xmlOutputBuffer;
32 typedef xmlOutputBuffer *xmlOutputBufferPtr;
35 typedef struct _xmlParserInput xmlParserInput;
36 typedef xmlParserInput *xmlParserInputPtr;
38 typedef struct _xmlParserCtxt xmlParserCtxt;
39 typedef xmlParserCtxt *xmlParserCtxtPtr;
41 typedef struct _xmlSAXLocator xmlSAXLocator;
42 typedef xmlSAXLocator *xmlSAXLocatorPtr;
44 typedef struct _xmlSAXHandler xmlSAXHandler;
45 typedef xmlSAXHandler *xmlSAXHandlerPtr;
48 typedef struct _xmlEntity xmlEntity;
49 typedef xmlEntity *xmlEntityPtr;
54 * default buffer size 4000.
56 #define BASE_BUFFER_SIZE 4096
59 * LIBXML_NAMESPACE_DICT:
61 * Defines experimental behaviour:
62 * 1) xmlNs gets an additional field @context (a xmlDoc)
63 * 2) when creating a tree, xmlNs->href is stored in the dict of xmlDoc.
65 /* #define LIBXML_NAMESPACE_DICT */
68 * xmlBufferAllocationScheme:
70 * A buffer allocation scheme can be defined to either match exactly the
71 * need or double it's allocated size each time it is found too small.
75 XML_BUFFER_ALLOC_DOUBLEIT, /* double each time one need to grow */
76 XML_BUFFER_ALLOC_EXACT, /* grow only to the minimal size */
77 XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */
78 XML_BUFFER_ALLOC_IO, /* special allocation scheme used for I/O */
79 XML_BUFFER_ALLOC_HYBRID /* exact up to a threshold, and doubleit thereafter */
80 } xmlBufferAllocationScheme;
85 * A buffer structure, this old construct is limited to 2GB and
86 * is being deprecated, use API with xmlBuf instead
88 typedef struct _xmlBuffer xmlBuffer;
89 typedef xmlBuffer *xmlBufferPtr;
91 xmlChar *content; /* The buffer content UTF8 */
92 unsigned int use; /* The buffer size used */
93 unsigned int size; /* The buffer size */
94 xmlBufferAllocationScheme alloc; /* The realloc method */
95 xmlChar *contentIO; /* in IO mode we may have a different base */
101 * A buffer structure, new one, the actual structure internals are not public
104 typedef struct _xmlBuf xmlBuf;
109 * A pointer to a buffer structure, the actual structure internals are not
113 typedef xmlBuf *xmlBufPtr;
116 * A few public routines for xmlBuf. As those are expected to be used
117 * mostly internally the bulk of the routines are internal in buf.h
119 XMLPUBFUN xmlChar* XMLCALL xmlBufContent (const xmlBufPtr buf);
120 XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (const xmlBufPtr buf);
121 XMLPUBFUN size_t XMLCALL xmlBufUse (const xmlBufPtr buf);
122 XMLPUBFUN size_t XMLCALL xmlBufShrink (xmlBufPtr buf, size_t len);
125 * LIBXML2_NEW_BUFFER:
127 * Macro used to express that the API use the new buffers for
128 * xmlParserInputBuffer and xmlOutputBuffer. The change was
129 * introduced in 2.9.0.
131 #define LIBXML2_NEW_BUFFER
136 * This is the namespace for the special xml: prefix predefined in the
137 * XML Namespace specification.
139 #define XML_XML_NAMESPACE \
140 (const xmlChar *) "http://www.w3.org/XML/1998/namespace"
145 * This is the name for the special xml:id attribute
147 #define XML_XML_ID (const xmlChar *) "xml:id"
150 * The different element types carried by an XML tree.
152 * NOTE: This is synchronized with DOM Level1 values
153 * See http://www.w3.org/TR/REC-DOM-Level-1/
155 * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
156 * be deprecated to use an XML_DTD_NODE.
160 XML_ATTRIBUTE_NODE= 2,
162 XML_CDATA_SECTION_NODE= 4,
163 XML_ENTITY_REF_NODE= 5,
167 XML_DOCUMENT_NODE= 9,
168 XML_DOCUMENT_TYPE_NODE= 10,
169 XML_DOCUMENT_FRAG_NODE= 11,
170 XML_NOTATION_NODE= 12,
171 XML_HTML_DOCUMENT_NODE= 13,
173 XML_ELEMENT_DECL= 15,
174 XML_ATTRIBUTE_DECL= 16,
176 XML_NAMESPACE_DECL= 18,
177 XML_XINCLUDE_START= 19,
179 #ifdef LIBXML_DOCB_ENABLED
180 ,XML_DOCB_DOCUMENT_NODE= 21
188 * A DTD Notation definition.
191 typedef struct _xmlNotation xmlNotation;
192 typedef xmlNotation *xmlNotationPtr;
193 struct _xmlNotation {
194 const xmlChar *name; /* Notation name */
195 const xmlChar *PublicID; /* Public identifier, if any */
196 const xmlChar *SystemID; /* System identifier, if any */
202 * A DTD Attribute type definition.
206 XML_ATTRIBUTE_CDATA = 1,
208 XML_ATTRIBUTE_IDREF ,
209 XML_ATTRIBUTE_IDREFS,
210 XML_ATTRIBUTE_ENTITY,
211 XML_ATTRIBUTE_ENTITIES,
212 XML_ATTRIBUTE_NMTOKEN,
213 XML_ATTRIBUTE_NMTOKENS,
214 XML_ATTRIBUTE_ENUMERATION,
215 XML_ATTRIBUTE_NOTATION
219 * xmlAttributeDefault:
221 * A DTD Attribute default definition.
225 XML_ATTRIBUTE_NONE = 1,
226 XML_ATTRIBUTE_REQUIRED,
227 XML_ATTRIBUTE_IMPLIED,
229 } xmlAttributeDefault;
234 * List structure used when there is an enumeration in DTDs.
237 typedef struct _xmlEnumeration xmlEnumeration;
238 typedef xmlEnumeration *xmlEnumerationPtr;
239 struct _xmlEnumeration {
240 struct _xmlEnumeration *next; /* next one */
241 const xmlChar *name; /* Enumeration name */
247 * An Attribute declaration in a DTD.
250 typedef struct _xmlAttribute xmlAttribute;
251 typedef xmlAttribute *xmlAttributePtr;
252 struct _xmlAttribute {
253 void *_private; /* application data */
254 xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
255 const xmlChar *name; /* Attribute name */
256 struct _xmlNode *children; /* NULL */
257 struct _xmlNode *last; /* NULL */
258 struct _xmlDtd *parent; /* -> DTD */
259 struct _xmlNode *next; /* next sibling link */
260 struct _xmlNode *prev; /* previous sibling link */
261 struct _xmlDoc *doc; /* the containing document */
263 struct _xmlAttribute *nexth; /* next in hash table */
264 xmlAttributeType atype; /* The attribute type */
265 xmlAttributeDefault def; /* the default */
266 const xmlChar *defaultValue; /* or the default value */
267 xmlEnumerationPtr tree; /* or the enumeration tree if any */
268 const xmlChar *prefix; /* the namespace prefix if any */
269 const xmlChar *elem; /* Element holding the attribute */
273 * xmlElementContentType:
275 * Possible definitions of element content types.
278 XML_ELEMENT_CONTENT_PCDATA = 1,
279 XML_ELEMENT_CONTENT_ELEMENT,
280 XML_ELEMENT_CONTENT_SEQ,
281 XML_ELEMENT_CONTENT_OR
282 } xmlElementContentType;
285 * xmlElementContentOccur:
287 * Possible definitions of element content occurrences.
290 XML_ELEMENT_CONTENT_ONCE = 1,
291 XML_ELEMENT_CONTENT_OPT,
292 XML_ELEMENT_CONTENT_MULT,
293 XML_ELEMENT_CONTENT_PLUS
294 } xmlElementContentOccur;
299 * An XML Element content as stored after parsing an element definition
303 typedef struct _xmlElementContent xmlElementContent;
304 typedef xmlElementContent *xmlElementContentPtr;
305 struct _xmlElementContent {
306 xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
307 xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
308 const xmlChar *name; /* Element name */
309 struct _xmlElementContent *c1; /* first child */
310 struct _xmlElementContent *c2; /* second child */
311 struct _xmlElementContent *parent; /* parent */
312 const xmlChar *prefix; /* Namespace prefix */
318 * The different possibilities for an element content type.
322 XML_ELEMENT_TYPE_UNDEFINED = 0,
323 XML_ELEMENT_TYPE_EMPTY = 1,
324 XML_ELEMENT_TYPE_ANY,
325 XML_ELEMENT_TYPE_MIXED,
326 XML_ELEMENT_TYPE_ELEMENT
332 #include <libxml/xmlregexp.h>
340 * An XML Element declaration from a DTD.
343 typedef struct _xmlElement xmlElement;
344 typedef xmlElement *xmlElementPtr;
346 void *_private; /* application data */
347 xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */
348 const xmlChar *name; /* Element name */
349 struct _xmlNode *children; /* NULL */
350 struct _xmlNode *last; /* NULL */
351 struct _xmlDtd *parent; /* -> DTD */
352 struct _xmlNode *next; /* next sibling link */
353 struct _xmlNode *prev; /* previous sibling link */
354 struct _xmlDoc *doc; /* the containing document */
356 xmlElementTypeVal etype; /* The type */
357 xmlElementContentPtr content; /* the allowed element content */
358 xmlAttributePtr attributes; /* List of the declared attributes */
359 const xmlChar *prefix; /* the namespace prefix if any */
360 #ifdef LIBXML_REGEXP_ENABLED
361 xmlRegexpPtr contModel; /* the validating regexp */
369 * XML_LOCAL_NAMESPACE:
371 * A namespace declaration node.
373 #define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
374 typedef xmlElementType xmlNsType;
380 * Note that prefix == NULL is valid, it defines the default namespace
381 * within the subtree (until overridden).
383 * xmlNsType is unified with xmlElementType.
386 typedef struct _xmlNs xmlNs;
387 typedef xmlNs *xmlNsPtr;
389 struct _xmlNs *next; /* next Ns link for this node */
390 xmlNsType type; /* global or local */
391 const xmlChar *href; /* URL for the namespace */
392 const xmlChar *prefix; /* prefix for the namespace */
393 void *_private; /* application data */
394 struct _xmlDoc *context; /* normally an xmlDoc */
400 * An XML DTD, as defined by <!DOCTYPE ... There is actually one for
401 * the internal subset and for the external subset.
403 typedef struct _xmlDtd xmlDtd;
404 typedef xmlDtd *xmlDtdPtr;
406 void *_private; /* application data */
407 xmlElementType type; /* XML_DTD_NODE, must be second ! */
408 const xmlChar *name; /* Name of the DTD */
409 struct _xmlNode *children; /* the value of the property link */
410 struct _xmlNode *last; /* last child link */
411 struct _xmlDoc *parent; /* child->parent link */
412 struct _xmlNode *next; /* next sibling link */
413 struct _xmlNode *prev; /* previous sibling link */
414 struct _xmlDoc *doc; /* the containing document */
416 /* End of common part */
417 void *notations; /* Hash table for notations if any */
418 void *elements; /* Hash table for elements if any */
419 void *attributes; /* Hash table for attributes if any */
420 void *entities; /* Hash table for entities if any */
421 const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
422 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
423 void *pentities; /* Hash table for param entities if any */
429 * An attribute on an XML node.
431 typedef struct _xmlAttr xmlAttr;
432 typedef xmlAttr *xmlAttrPtr;
434 void *_private; /* application data */
435 xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */
436 const xmlChar *name; /* the name of the property */
437 struct _xmlNode *children; /* the value of the property */
438 struct _xmlNode *last; /* NULL */
439 struct _xmlNode *parent; /* child->parent link */
440 struct _xmlAttr *next; /* next sibling link */
441 struct _xmlAttr *prev; /* previous sibling link */
442 struct _xmlDoc *doc; /* the containing document */
443 xmlNs *ns; /* pointer to the associated namespace */
444 xmlAttributeType atype; /* the attribute type if validating */
445 void *psvi; /* for type/PSVI informations */
451 * An XML ID instance.
454 typedef struct _xmlID xmlID;
455 typedef xmlID *xmlIDPtr;
457 struct _xmlID *next; /* next ID */
458 const xmlChar *value; /* The ID name */
459 xmlAttrPtr attr; /* The attribute holding it */
460 const xmlChar *name; /* The attribute if attr is not available */
461 int lineno; /* The line number if attr is not available */
462 struct _xmlDoc *doc; /* The document holding the ID */
468 * An XML IDREF instance.
471 typedef struct _xmlRef xmlRef;
472 typedef xmlRef *xmlRefPtr;
474 struct _xmlRef *next; /* next Ref */
475 const xmlChar *value; /* The Ref name */
476 xmlAttrPtr attr; /* The attribute holding it */
477 const xmlChar *name; /* The attribute if attr is not available */
478 int lineno; /* The line number if attr is not available */
484 * A node in an XML tree.
486 typedef struct _xmlNode xmlNode;
487 typedef xmlNode *xmlNodePtr;
489 void *_private; /* application data */
490 xmlElementType type; /* type number, must be second ! */
491 const xmlChar *name; /* the name of the node, or the entity */
492 struct _xmlNode *children; /* parent->childs link */
493 struct _xmlNode *last; /* last child link */
494 struct _xmlNode *parent; /* child->parent link */
495 struct _xmlNode *next; /* next sibling link */
496 struct _xmlNode *prev; /* previous sibling link */
497 struct _xmlDoc *doc; /* the containing document */
499 /* End of common part */
500 xmlNs *ns; /* pointer to the associated namespace */
501 xmlChar *content; /* the content */
502 struct _xmlAttr *properties;/* properties list */
503 xmlNs *nsDef; /* namespace definitions on this node */
504 void *psvi; /* for type/PSVI informations */
505 unsigned short line; /* line number */
506 unsigned short extra; /* extra data for XPath/XSLT */
512 * Macro to extract the content pointer of a node.
514 #define XML_GET_CONTENT(n) \
515 ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content)
520 * Macro to extract the line number of an element node.
522 #define XML_GET_LINE(n) \
528 * Set of properties of the document as found by the parser
529 * Some of them are linked to similary named xmlParserOption
532 XML_DOC_WELLFORMED = 1<<0, /* document is XML well formed */
533 XML_DOC_NSVALID = 1<<1, /* document is Namespace valid */
534 XML_DOC_OLD10 = 1<<2, /* parsed with old XML-1.0 parser */
535 XML_DOC_DTDVALID = 1<<3, /* DTD validation was successful */
536 XML_DOC_XINCLUDE = 1<<4, /* XInclude substitution was done */
537 XML_DOC_USERBUILT = 1<<5, /* Document was built using the API
538 and not by parsing an instance */
539 XML_DOC_INTERNAL = 1<<6, /* built for internal processing */
540 XML_DOC_HTML = 1<<7 /* parsed or built HTML document */
548 typedef struct _xmlDoc xmlDoc;
549 typedef xmlDoc *xmlDocPtr;
551 void *_private; /* application data */
552 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
553 char *name; /* name/filename/URI of the document */
554 struct _xmlNode *children; /* the document tree */
555 struct _xmlNode *last; /* last child link */
556 struct _xmlNode *parent; /* child->parent link */
557 struct _xmlNode *next; /* next sibling link */
558 struct _xmlNode *prev; /* previous sibling link */
559 struct _xmlDoc *doc; /* autoreference to itself */
561 /* End of common part */
562 int compression;/* level of zlib compression */
563 int standalone; /* standalone document (no external refs)
564 1 if standalone="yes"
566 -1 if there is no XML declaration
567 -2 if there is an XML declaration, but no
568 standalone attribute was specified */
569 struct _xmlDtd *intSubset; /* the document internal subset */
570 struct _xmlDtd *extSubset; /* the document external subset */
571 struct _xmlNs *oldNs; /* Global namespace, the old way */
572 const xmlChar *version; /* the XML version string */
573 const xmlChar *encoding; /* external initial encoding, if any */
574 void *ids; /* Hash table for ID attributes if any */
575 void *refs; /* Hash table for IDREFs attributes if any */
576 const xmlChar *URL; /* The URI for that document */
577 int charset; /* encoding of the in-memory content
578 actually an xmlCharEncoding */
579 struct _xmlDict *dict; /* dict used to allocate names or NULL */
580 void *psvi; /* for type/PSVI informations */
581 int parseFlags; /* set of xmlParserOption used to parse the
583 int properties; /* set of xmlDocProperties for this document
584 set at the end of parsing */
588 typedef struct _xmlDOMWrapCtxt xmlDOMWrapCtxt;
589 typedef xmlDOMWrapCtxt *xmlDOMWrapCtxtPtr;
592 * xmlDOMWrapAcquireNsFunction:
593 * @ctxt: a DOM wrapper context
594 * @node: the context node (element or attribute)
595 * @nsName: the requested namespace name
596 * @nsPrefix: the requested namespace prefix
598 * A function called to acquire namespaces (xmlNs) from the wrapper.
600 * Returns an xmlNsPtr or NULL in case of an error.
602 typedef xmlNsPtr (*xmlDOMWrapAcquireNsFunction) (xmlDOMWrapCtxtPtr ctxt,
604 const xmlChar *nsName,
605 const xmlChar *nsPrefix);
610 * Context for DOM wrapper-operations.
612 struct _xmlDOMWrapCtxt {
615 * The type of this context, just in case we need specialized
616 * contexts in the future.
620 * Internal namespace map used for various operations.
624 * Use this one to acquire an xmlNsPtr intended for node->ns.
625 * (Note that this is not intended for elem->nsDef).
627 xmlDOMWrapAcquireNsFunction getNsForNodeFunc;
633 * Macro for compatibility naming layer with libxml1. Maps
636 #ifndef xmlChildrenNode
637 #define xmlChildrenNode children
643 * Macro for compatibility naming layer with libxml1. Maps
647 #define xmlRootNode children
655 * Some helper functions
657 #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)
658 XMLPUBFUN int XMLCALL
659 xmlValidateNCName (const xmlChar *value,
663 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
664 XMLPUBFUN int XMLCALL
665 xmlValidateQName (const xmlChar *value,
667 XMLPUBFUN int XMLCALL
668 xmlValidateName (const xmlChar *value,
670 XMLPUBFUN int XMLCALL
671 xmlValidateNMToken (const xmlChar *value,
675 XMLPUBFUN xmlChar * XMLCALL
676 xmlBuildQName (const xmlChar *ncname,
677 const xmlChar *prefix,
680 XMLPUBFUN xmlChar * XMLCALL
681 xmlSplitQName2 (const xmlChar *name,
683 XMLPUBFUN const xmlChar * XMLCALL
684 xmlSplitQName3 (const xmlChar *name,
688 * Handling Buffers, the old ones see @xmlBuf for the new ones.
691 XMLPUBFUN void XMLCALL
692 xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
693 XMLPUBFUN xmlBufferAllocationScheme XMLCALL
694 xmlGetBufferAllocationScheme(void);
696 XMLPUBFUN xmlBufferPtr XMLCALL
697 xmlBufferCreate (void);
698 XMLPUBFUN xmlBufferPtr XMLCALL
699 xmlBufferCreateSize (size_t size);
700 XMLPUBFUN xmlBufferPtr XMLCALL
701 xmlBufferCreateStatic (void *mem,
703 XMLPUBFUN int XMLCALL
704 xmlBufferResize (xmlBufferPtr buf,
706 XMLPUBFUN void XMLCALL
707 xmlBufferFree (xmlBufferPtr buf);
708 XMLPUBFUN int XMLCALL
709 xmlBufferDump (FILE *file,
711 XMLPUBFUN int XMLCALL
712 xmlBufferAdd (xmlBufferPtr buf,
715 XMLPUBFUN int XMLCALL
716 xmlBufferAddHead (xmlBufferPtr buf,
719 XMLPUBFUN int XMLCALL
720 xmlBufferCat (xmlBufferPtr buf,
722 XMLPUBFUN int XMLCALL
723 xmlBufferCCat (xmlBufferPtr buf,
725 XMLPUBFUN int XMLCALL
726 xmlBufferShrink (xmlBufferPtr buf,
728 XMLPUBFUN int XMLCALL
729 xmlBufferGrow (xmlBufferPtr buf,
731 XMLPUBFUN void XMLCALL
732 xmlBufferEmpty (xmlBufferPtr buf);
733 XMLPUBFUN const xmlChar* XMLCALL
734 xmlBufferContent (const xmlBufferPtr buf);
735 XMLPUBFUN xmlChar* XMLCALL
736 xmlBufferDetach (xmlBufferPtr buf);
737 XMLPUBFUN void XMLCALL
738 xmlBufferSetAllocationScheme(xmlBufferPtr buf,
739 xmlBufferAllocationScheme scheme);
740 XMLPUBFUN int XMLCALL
741 xmlBufferLength (const xmlBufferPtr buf);
744 * Creating/freeing new structures.
746 XMLPUBFUN xmlDtdPtr XMLCALL
747 xmlCreateIntSubset (xmlDocPtr doc,
749 const xmlChar *ExternalID,
750 const xmlChar *SystemID);
751 XMLPUBFUN xmlDtdPtr XMLCALL
752 xmlNewDtd (xmlDocPtr doc,
754 const xmlChar *ExternalID,
755 const xmlChar *SystemID);
756 XMLPUBFUN xmlDtdPtr XMLCALL
757 xmlGetIntSubset (xmlDocPtr doc);
758 XMLPUBFUN void XMLCALL
759 xmlFreeDtd (xmlDtdPtr cur);
760 #ifdef LIBXML_LEGACY_ENABLED
761 XMLPUBFUN xmlNsPtr XMLCALL
762 xmlNewGlobalNs (xmlDocPtr doc,
764 const xmlChar *prefix);
765 #endif /* LIBXML_LEGACY_ENABLED */
766 XMLPUBFUN xmlNsPtr XMLCALL
767 xmlNewNs (xmlNodePtr node,
769 const xmlChar *prefix);
770 XMLPUBFUN void XMLCALL
771 xmlFreeNs (xmlNsPtr cur);
772 XMLPUBFUN void XMLCALL
773 xmlFreeNsList (xmlNsPtr cur);
774 XMLPUBFUN xmlDocPtr XMLCALL
775 xmlNewDoc (const xmlChar *version);
776 XMLPUBFUN void XMLCALL
777 xmlFreeDoc (xmlDocPtr cur);
778 XMLPUBFUN xmlAttrPtr XMLCALL
779 xmlNewDocProp (xmlDocPtr doc,
781 const xmlChar *value);
782 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
783 defined(LIBXML_SCHEMAS_ENABLED)
784 XMLPUBFUN xmlAttrPtr XMLCALL
785 xmlNewProp (xmlNodePtr node,
787 const xmlChar *value);
789 XMLPUBFUN xmlAttrPtr XMLCALL
790 xmlNewNsProp (xmlNodePtr node,
793 const xmlChar *value);
794 XMLPUBFUN xmlAttrPtr XMLCALL
795 xmlNewNsPropEatName (xmlNodePtr node,
798 const xmlChar *value);
799 XMLPUBFUN void XMLCALL
800 xmlFreePropList (xmlAttrPtr cur);
801 XMLPUBFUN void XMLCALL
802 xmlFreeProp (xmlAttrPtr cur);
803 XMLPUBFUN xmlAttrPtr XMLCALL
804 xmlCopyProp (xmlNodePtr target,
806 XMLPUBFUN xmlAttrPtr XMLCALL
807 xmlCopyPropList (xmlNodePtr target,
809 #ifdef LIBXML_TREE_ENABLED
810 XMLPUBFUN xmlDtdPtr XMLCALL
811 xmlCopyDtd (xmlDtdPtr dtd);
812 #endif /* LIBXML_TREE_ENABLED */
813 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
814 XMLPUBFUN xmlDocPtr XMLCALL
815 xmlCopyDoc (xmlDocPtr doc,
817 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
819 * Creating new nodes.
821 XMLPUBFUN xmlNodePtr XMLCALL
822 xmlNewDocNode (xmlDocPtr doc,
825 const xmlChar *content);
826 XMLPUBFUN xmlNodePtr XMLCALL
827 xmlNewDocNodeEatName (xmlDocPtr doc,
830 const xmlChar *content);
831 XMLPUBFUN xmlNodePtr XMLCALL
832 xmlNewNode (xmlNsPtr ns,
833 const xmlChar *name);
834 XMLPUBFUN xmlNodePtr XMLCALL
835 xmlNewNodeEatName (xmlNsPtr ns,
837 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
838 XMLPUBFUN xmlNodePtr XMLCALL
839 xmlNewChild (xmlNodePtr parent,
842 const xmlChar *content);
844 XMLPUBFUN xmlNodePtr XMLCALL
845 xmlNewDocText (xmlDocPtr doc,
846 const xmlChar *content);
847 XMLPUBFUN xmlNodePtr XMLCALL
848 xmlNewText (const xmlChar *content);
849 XMLPUBFUN xmlNodePtr XMLCALL
850 xmlNewDocPI (xmlDocPtr doc,
852 const xmlChar *content);
853 XMLPUBFUN xmlNodePtr XMLCALL
854 xmlNewPI (const xmlChar *name,
855 const xmlChar *content);
856 XMLPUBFUN xmlNodePtr XMLCALL
857 xmlNewDocTextLen (xmlDocPtr doc,
858 const xmlChar *content,
860 XMLPUBFUN xmlNodePtr XMLCALL
861 xmlNewTextLen (const xmlChar *content,
863 XMLPUBFUN xmlNodePtr XMLCALL
864 xmlNewDocComment (xmlDocPtr doc,
865 const xmlChar *content);
866 XMLPUBFUN xmlNodePtr XMLCALL
867 xmlNewComment (const xmlChar *content);
868 XMLPUBFUN xmlNodePtr XMLCALL
869 xmlNewCDataBlock (xmlDocPtr doc,
870 const xmlChar *content,
872 XMLPUBFUN xmlNodePtr XMLCALL
873 xmlNewCharRef (xmlDocPtr doc,
874 const xmlChar *name);
875 XMLPUBFUN xmlNodePtr XMLCALL
876 xmlNewReference (xmlDocPtr doc,
877 const xmlChar *name);
878 XMLPUBFUN xmlNodePtr XMLCALL
879 xmlCopyNode (const xmlNodePtr node,
881 XMLPUBFUN xmlNodePtr XMLCALL
882 xmlDocCopyNode (const xmlNodePtr node,
885 XMLPUBFUN xmlNodePtr XMLCALL
886 xmlDocCopyNodeList (xmlDocPtr doc,
887 const xmlNodePtr node);
888 XMLPUBFUN xmlNodePtr XMLCALL
889 xmlCopyNodeList (const xmlNodePtr node);
890 #ifdef LIBXML_TREE_ENABLED
891 XMLPUBFUN xmlNodePtr XMLCALL
892 xmlNewTextChild (xmlNodePtr parent,
895 const xmlChar *content);
896 XMLPUBFUN xmlNodePtr XMLCALL
897 xmlNewDocRawNode (xmlDocPtr doc,
900 const xmlChar *content);
901 XMLPUBFUN xmlNodePtr XMLCALL
902 xmlNewDocFragment (xmlDocPtr doc);
903 #endif /* LIBXML_TREE_ENABLED */
908 XMLPUBFUN long XMLCALL
909 xmlGetLineNo (xmlNodePtr node);
910 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
911 XMLPUBFUN xmlChar * XMLCALL
912 xmlGetNodePath (xmlNodePtr node);
913 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
914 XMLPUBFUN xmlNodePtr XMLCALL
915 xmlDocGetRootElement (xmlDocPtr doc);
916 XMLPUBFUN xmlNodePtr XMLCALL
917 xmlGetLastChild (xmlNodePtr parent);
918 XMLPUBFUN int XMLCALL
919 xmlNodeIsText (xmlNodePtr node);
920 XMLPUBFUN int XMLCALL
921 xmlIsBlankNode (xmlNodePtr node);
924 * Changing the structure.
926 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
927 XMLPUBFUN xmlNodePtr XMLCALL
928 xmlDocSetRootElement (xmlDocPtr doc,
930 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
931 #ifdef LIBXML_TREE_ENABLED
932 XMLPUBFUN void XMLCALL
933 xmlNodeSetName (xmlNodePtr cur,
934 const xmlChar *name);
935 #endif /* LIBXML_TREE_ENABLED */
936 XMLPUBFUN xmlNodePtr XMLCALL
937 xmlAddChild (xmlNodePtr parent,
939 XMLPUBFUN xmlNodePtr XMLCALL
940 xmlAddChildList (xmlNodePtr parent,
942 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
943 XMLPUBFUN xmlNodePtr XMLCALL
944 xmlReplaceNode (xmlNodePtr old,
946 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
947 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
948 defined(LIBXML_SCHEMAS_ENABLED)
949 XMLPUBFUN xmlNodePtr XMLCALL
950 xmlAddPrevSibling (xmlNodePtr cur,
952 #endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */
953 XMLPUBFUN xmlNodePtr XMLCALL
954 xmlAddSibling (xmlNodePtr cur,
956 XMLPUBFUN xmlNodePtr XMLCALL
957 xmlAddNextSibling (xmlNodePtr cur,
959 XMLPUBFUN void XMLCALL
960 xmlUnlinkNode (xmlNodePtr cur);
961 XMLPUBFUN xmlNodePtr XMLCALL
962 xmlTextMerge (xmlNodePtr first,
964 XMLPUBFUN int XMLCALL
965 xmlTextConcat (xmlNodePtr node,
966 const xmlChar *content,
968 XMLPUBFUN void XMLCALL
969 xmlFreeNodeList (xmlNodePtr cur);
970 XMLPUBFUN void XMLCALL
971 xmlFreeNode (xmlNodePtr cur);
972 XMLPUBFUN void XMLCALL
973 xmlSetTreeDoc (xmlNodePtr tree,
975 XMLPUBFUN void XMLCALL
976 xmlSetListDoc (xmlNodePtr list,
981 XMLPUBFUN xmlNsPtr XMLCALL
982 xmlSearchNs (xmlDocPtr doc,
984 const xmlChar *nameSpace);
985 XMLPUBFUN xmlNsPtr XMLCALL
986 xmlSearchNsByHref (xmlDocPtr doc,
988 const xmlChar *href);
989 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
990 XMLPUBFUN xmlNsPtr * XMLCALL
991 xmlGetNsList (xmlDocPtr doc,
993 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
995 XMLPUBFUN void XMLCALL
996 xmlSetNs (xmlNodePtr node,
998 XMLPUBFUN xmlNsPtr XMLCALL
999 xmlCopyNamespace (xmlNsPtr cur);
1000 XMLPUBFUN xmlNsPtr XMLCALL
1001 xmlCopyNamespaceList (xmlNsPtr cur);
1004 * Changing the content.
1006 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
1007 XMLPUBFUN xmlAttrPtr XMLCALL
1008 xmlSetProp (xmlNodePtr node,
1009 const xmlChar *name,
1010 const xmlChar *value);
1011 XMLPUBFUN xmlAttrPtr XMLCALL
1012 xmlSetNsProp (xmlNodePtr node,
1014 const xmlChar *name,
1015 const xmlChar *value);
1016 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
1017 XMLPUBFUN xmlChar * XMLCALL
1018 xmlGetNoNsProp (xmlNodePtr node,
1019 const xmlChar *name);
1020 XMLPUBFUN xmlChar * XMLCALL
1021 xmlGetProp (xmlNodePtr node,
1022 const xmlChar *name);
1023 XMLPUBFUN xmlAttrPtr XMLCALL
1024 xmlHasProp (xmlNodePtr node,
1025 const xmlChar *name);
1026 XMLPUBFUN xmlAttrPtr XMLCALL
1027 xmlHasNsProp (xmlNodePtr node,
1028 const xmlChar *name,
1029 const xmlChar *nameSpace);
1030 XMLPUBFUN xmlChar * XMLCALL
1031 xmlGetNsProp (xmlNodePtr node,
1032 const xmlChar *name,
1033 const xmlChar *nameSpace);
1034 XMLPUBFUN xmlNodePtr XMLCALL
1035 xmlStringGetNodeList (xmlDocPtr doc,
1036 const xmlChar *value);
1037 XMLPUBFUN xmlNodePtr XMLCALL
1038 xmlStringLenGetNodeList (xmlDocPtr doc,
1039 const xmlChar *value,
1041 XMLPUBFUN xmlChar * XMLCALL
1042 xmlNodeListGetString (xmlDocPtr doc,
1045 #ifdef LIBXML_TREE_ENABLED
1046 XMLPUBFUN xmlChar * XMLCALL
1047 xmlNodeListGetRawString (xmlDocPtr doc,
1050 #endif /* LIBXML_TREE_ENABLED */
1051 XMLPUBFUN void XMLCALL
1052 xmlNodeSetContent (xmlNodePtr cur,
1053 const xmlChar *content);
1054 #ifdef LIBXML_TREE_ENABLED
1055 XMLPUBFUN void XMLCALL
1056 xmlNodeSetContentLen (xmlNodePtr cur,
1057 const xmlChar *content,
1059 #endif /* LIBXML_TREE_ENABLED */
1060 XMLPUBFUN void XMLCALL
1061 xmlNodeAddContent (xmlNodePtr cur,
1062 const xmlChar *content);
1063 XMLPUBFUN void XMLCALL
1064 xmlNodeAddContentLen (xmlNodePtr cur,
1065 const xmlChar *content,
1067 XMLPUBFUN xmlChar * XMLCALL
1068 xmlNodeGetContent (xmlNodePtr cur);
1070 XMLPUBFUN int XMLCALL
1071 xmlNodeBufGetContent (xmlBufferPtr buffer,
1073 XMLPUBFUN int XMLCALL
1074 xmlBufGetNodeContent (xmlBufPtr buf,
1077 XMLPUBFUN xmlChar * XMLCALL
1078 xmlNodeGetLang (xmlNodePtr cur);
1079 XMLPUBFUN int XMLCALL
1080 xmlNodeGetSpacePreserve (xmlNodePtr cur);
1081 #ifdef LIBXML_TREE_ENABLED
1082 XMLPUBFUN void XMLCALL
1083 xmlNodeSetLang (xmlNodePtr cur,
1084 const xmlChar *lang);
1085 XMLPUBFUN void XMLCALL
1086 xmlNodeSetSpacePreserve (xmlNodePtr cur,
1088 #endif /* LIBXML_TREE_ENABLED */
1089 XMLPUBFUN xmlChar * XMLCALL
1090 xmlNodeGetBase (xmlDocPtr doc,
1092 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
1093 XMLPUBFUN void XMLCALL
1094 xmlNodeSetBase (xmlNodePtr cur,
1095 const xmlChar *uri);
1101 XMLPUBFUN int XMLCALL
1102 xmlRemoveProp (xmlAttrPtr cur);
1103 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
1104 XMLPUBFUN int XMLCALL
1105 xmlUnsetNsProp (xmlNodePtr node,
1107 const xmlChar *name);
1108 XMLPUBFUN int XMLCALL
1109 xmlUnsetProp (xmlNodePtr node,
1110 const xmlChar *name);
1111 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
1114 * Internal, don't use.
1116 XMLPUBFUN void XMLCALL
1117 xmlBufferWriteCHAR (xmlBufferPtr buf,
1118 const xmlChar *string);
1119 XMLPUBFUN void XMLCALL
1120 xmlBufferWriteChar (xmlBufferPtr buf,
1121 const char *string);
1122 XMLPUBFUN void XMLCALL
1123 xmlBufferWriteQuotedString(xmlBufferPtr buf,
1124 const xmlChar *string);
1126 #ifdef LIBXML_OUTPUT_ENABLED
1127 XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf,
1130 const xmlChar *string);
1131 #endif /* LIBXML_OUTPUT_ENABLED */
1133 #ifdef LIBXML_TREE_ENABLED
1135 * Namespace handling.
1137 XMLPUBFUN int XMLCALL
1138 xmlReconciliateNs (xmlDocPtr doc,
1142 #ifdef LIBXML_OUTPUT_ENABLED
1146 XMLPUBFUN void XMLCALL
1147 xmlDocDumpFormatMemory (xmlDocPtr cur,
1151 XMLPUBFUN void XMLCALL
1152 xmlDocDumpMemory (xmlDocPtr cur,
1155 XMLPUBFUN void XMLCALL
1156 xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
1157 xmlChar **doc_txt_ptr,
1159 const char *txt_encoding);
1160 XMLPUBFUN void XMLCALL
1161 xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
1162 xmlChar **doc_txt_ptr,
1164 const char *txt_encoding,
1166 XMLPUBFUN int XMLCALL
1167 xmlDocFormatDump (FILE *f,
1170 XMLPUBFUN int XMLCALL
1171 xmlDocDump (FILE *f,
1173 XMLPUBFUN void XMLCALL
1174 xmlElemDump (FILE *f,
1177 XMLPUBFUN int XMLCALL
1178 xmlSaveFile (const char *filename,
1180 XMLPUBFUN int XMLCALL
1181 xmlSaveFormatFile (const char *filename,
1184 XMLPUBFUN size_t XMLCALL
1185 xmlBufNodeDump (xmlBufPtr buf,
1190 XMLPUBFUN int XMLCALL
1191 xmlNodeDump (xmlBufferPtr buf,
1197 XMLPUBFUN int XMLCALL
1198 xmlSaveFileTo (xmlOutputBufferPtr buf,
1200 const char *encoding);
1201 XMLPUBFUN int XMLCALL
1202 xmlSaveFormatFileTo (xmlOutputBufferPtr buf,
1204 const char *encoding,
1206 XMLPUBFUN void XMLCALL
1207 xmlNodeDumpOutput (xmlOutputBufferPtr buf,
1212 const char *encoding);
1214 XMLPUBFUN int XMLCALL
1215 xmlSaveFormatFileEnc (const char *filename,
1217 const char *encoding,
1220 XMLPUBFUN int XMLCALL
1221 xmlSaveFileEnc (const char *filename,
1223 const char *encoding);
1225 #endif /* LIBXML_OUTPUT_ENABLED */
1229 XMLPUBFUN int XMLCALL
1230 xmlIsXHTML (const xmlChar *systemID,
1231 const xmlChar *publicID);
1236 XMLPUBFUN int XMLCALL
1237 xmlGetDocCompressMode (xmlDocPtr doc);
1238 XMLPUBFUN void XMLCALL
1239 xmlSetDocCompressMode (xmlDocPtr doc,
1241 XMLPUBFUN int XMLCALL
1242 xmlGetCompressMode (void);
1243 XMLPUBFUN void XMLCALL
1244 xmlSetCompressMode (int mode);
1247 * DOM-wrapper helper functions.
1249 XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL
1250 xmlDOMWrapNewCtxt (void);
1251 XMLPUBFUN void XMLCALL
1252 xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt);
1253 XMLPUBFUN int XMLCALL
1254 xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt,
1257 XMLPUBFUN int XMLCALL
1258 xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt,
1259 xmlDocPtr sourceDoc,
1262 xmlNodePtr destParent,
1264 XMLPUBFUN int XMLCALL
1265 xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt,
1269 XMLPUBFUN int XMLCALL
1270 xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt,
1271 xmlDocPtr sourceDoc,
1273 xmlNodePtr *clonedNode,
1275 xmlNodePtr destParent,
1279 #ifdef LIBXML_TREE_ENABLED
1281 * 5 interfaces from DOM ElementTraversal, but different in entities
1284 XMLPUBFUN unsigned long XMLCALL
1285 xmlChildElementCount (xmlNodePtr parent);
1286 XMLPUBFUN xmlNodePtr XMLCALL
1287 xmlNextElementSibling (xmlNodePtr node);
1288 XMLPUBFUN xmlNodePtr XMLCALL
1289 xmlFirstElementChild (xmlNodePtr parent);
1290 XMLPUBFUN xmlNodePtr XMLCALL
1291 xmlLastElementChild (xmlNodePtr parent);
1292 XMLPUBFUN xmlNodePtr XMLCALL
1293 xmlPreviousElementSibling (xmlNodePtr node);
1298 #ifndef __XML_PARSER_H__
1299 #include <libxml/xmlmemory.h>
1302 #endif /* __XML_TREE_H__ */