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 xmlBuf* buf);
120 XMLPUBFUN xmlChar* XMLCALL xmlBufEnd (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) || \
658 defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED) || \
659 defined (LIBXML_HTML_ENABLED) || defined(LIBXML_SAX1_ENABLED) || \
660 defined(LIBXML_HTML_ENABLED) || defined(LIBXML_WRITER_ENABLED) || \
661 defined(LIBXML_DOCB_ENABLED) || defined(LIBXML_LEGACY_ENABLED)
662 XMLPUBFUN int XMLCALL
663 xmlValidateNCName (const xmlChar *value,
667 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
668 XMLPUBFUN int XMLCALL
669 xmlValidateQName (const xmlChar *value,
671 XMLPUBFUN int XMLCALL
672 xmlValidateName (const xmlChar *value,
674 XMLPUBFUN int XMLCALL
675 xmlValidateNMToken (const xmlChar *value,
679 XMLPUBFUN xmlChar * XMLCALL
680 xmlBuildQName (const xmlChar *ncname,
681 const xmlChar *prefix,
684 XMLPUBFUN xmlChar * XMLCALL
685 xmlSplitQName2 (const xmlChar *name,
687 XMLPUBFUN const xmlChar * XMLCALL
688 xmlSplitQName3 (const xmlChar *name,
692 * Handling Buffers, the old ones see @xmlBuf for the new ones.
695 XMLPUBFUN void XMLCALL
696 xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
697 XMLPUBFUN xmlBufferAllocationScheme XMLCALL
698 xmlGetBufferAllocationScheme(void);
700 XMLPUBFUN xmlBufferPtr XMLCALL
701 xmlBufferCreate (void);
702 XMLPUBFUN xmlBufferPtr XMLCALL
703 xmlBufferCreateSize (size_t size);
704 XMLPUBFUN xmlBufferPtr XMLCALL
705 xmlBufferCreateStatic (void *mem,
707 XMLPUBFUN int XMLCALL
708 xmlBufferResize (xmlBufferPtr buf,
710 XMLPUBFUN void XMLCALL
711 xmlBufferFree (xmlBufferPtr buf);
712 XMLPUBFUN int XMLCALL
713 xmlBufferDump (FILE *file,
715 XMLPUBFUN int XMLCALL
716 xmlBufferAdd (xmlBufferPtr buf,
719 XMLPUBFUN int XMLCALL
720 xmlBufferAddHead (xmlBufferPtr buf,
723 XMLPUBFUN int XMLCALL
724 xmlBufferCat (xmlBufferPtr buf,
726 XMLPUBFUN int XMLCALL
727 xmlBufferCCat (xmlBufferPtr buf,
729 XMLPUBFUN int XMLCALL
730 xmlBufferShrink (xmlBufferPtr buf,
732 XMLPUBFUN int XMLCALL
733 xmlBufferGrow (xmlBufferPtr buf,
735 XMLPUBFUN void XMLCALL
736 xmlBufferEmpty (xmlBufferPtr buf);
737 XMLPUBFUN const xmlChar* XMLCALL
738 xmlBufferContent (const xmlBuffer *buf);
739 XMLPUBFUN xmlChar* XMLCALL
740 xmlBufferDetach (xmlBufferPtr buf);
741 XMLPUBFUN void XMLCALL
742 xmlBufferSetAllocationScheme(xmlBufferPtr buf,
743 xmlBufferAllocationScheme scheme);
744 XMLPUBFUN int XMLCALL
745 xmlBufferLength (const xmlBuffer *buf);
748 * Creating/freeing new structures.
750 XMLPUBFUN xmlDtdPtr XMLCALL
751 xmlCreateIntSubset (xmlDocPtr doc,
753 const xmlChar *ExternalID,
754 const xmlChar *SystemID);
755 XMLPUBFUN xmlDtdPtr XMLCALL
756 xmlNewDtd (xmlDocPtr doc,
758 const xmlChar *ExternalID,
759 const xmlChar *SystemID);
760 XMLPUBFUN xmlDtdPtr XMLCALL
761 xmlGetIntSubset (const xmlDoc *doc);
762 XMLPUBFUN void XMLCALL
763 xmlFreeDtd (xmlDtdPtr cur);
764 #ifdef LIBXML_LEGACY_ENABLED
765 XMLPUBFUN xmlNsPtr XMLCALL
766 xmlNewGlobalNs (xmlDocPtr doc,
768 const xmlChar *prefix);
769 #endif /* LIBXML_LEGACY_ENABLED */
770 XMLPUBFUN xmlNsPtr XMLCALL
771 xmlNewNs (xmlNodePtr node,
773 const xmlChar *prefix);
774 XMLPUBFUN void XMLCALL
775 xmlFreeNs (xmlNsPtr cur);
776 XMLPUBFUN void XMLCALL
777 xmlFreeNsList (xmlNsPtr cur);
778 XMLPUBFUN xmlDocPtr XMLCALL
779 xmlNewDoc (const xmlChar *version);
780 XMLPUBFUN void XMLCALL
781 xmlFreeDoc (xmlDocPtr cur);
782 XMLPUBFUN xmlAttrPtr XMLCALL
783 xmlNewDocProp (xmlDocPtr doc,
785 const xmlChar *value);
786 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
787 defined(LIBXML_SCHEMAS_ENABLED)
788 XMLPUBFUN xmlAttrPtr XMLCALL
789 xmlNewProp (xmlNodePtr node,
791 const xmlChar *value);
793 XMLPUBFUN xmlAttrPtr XMLCALL
794 xmlNewNsProp (xmlNodePtr node,
797 const xmlChar *value);
798 XMLPUBFUN xmlAttrPtr XMLCALL
799 xmlNewNsPropEatName (xmlNodePtr node,
802 const xmlChar *value);
803 XMLPUBFUN void XMLCALL
804 xmlFreePropList (xmlAttrPtr cur);
805 XMLPUBFUN void XMLCALL
806 xmlFreeProp (xmlAttrPtr cur);
807 XMLPUBFUN xmlAttrPtr XMLCALL
808 xmlCopyProp (xmlNodePtr target,
810 XMLPUBFUN xmlAttrPtr XMLCALL
811 xmlCopyPropList (xmlNodePtr target,
813 #ifdef LIBXML_TREE_ENABLED
814 XMLPUBFUN xmlDtdPtr XMLCALL
815 xmlCopyDtd (xmlDtdPtr dtd);
816 #endif /* LIBXML_TREE_ENABLED */
817 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
818 XMLPUBFUN xmlDocPtr XMLCALL
819 xmlCopyDoc (xmlDocPtr doc,
821 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
823 * Creating new nodes.
825 XMLPUBFUN xmlNodePtr XMLCALL
826 xmlNewDocNode (xmlDocPtr doc,
829 const xmlChar *content);
830 XMLPUBFUN xmlNodePtr XMLCALL
831 xmlNewDocNodeEatName (xmlDocPtr doc,
834 const xmlChar *content);
835 XMLPUBFUN xmlNodePtr XMLCALL
836 xmlNewNode (xmlNsPtr ns,
837 const xmlChar *name);
838 XMLPUBFUN xmlNodePtr XMLCALL
839 xmlNewNodeEatName (xmlNsPtr ns,
841 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
842 XMLPUBFUN xmlNodePtr XMLCALL
843 xmlNewChild (xmlNodePtr parent,
846 const xmlChar *content);
848 XMLPUBFUN xmlNodePtr XMLCALL
849 xmlNewDocText (const xmlDoc *doc,
850 const xmlChar *content);
851 XMLPUBFUN xmlNodePtr XMLCALL
852 xmlNewText (const xmlChar *content);
853 XMLPUBFUN xmlNodePtr XMLCALL
854 xmlNewDocPI (xmlDocPtr doc,
856 const xmlChar *content);
857 XMLPUBFUN xmlNodePtr XMLCALL
858 xmlNewPI (const xmlChar *name,
859 const xmlChar *content);
860 XMLPUBFUN xmlNodePtr XMLCALL
861 xmlNewDocTextLen (xmlDocPtr doc,
862 const xmlChar *content,
864 XMLPUBFUN xmlNodePtr XMLCALL
865 xmlNewTextLen (const xmlChar *content,
867 XMLPUBFUN xmlNodePtr XMLCALL
868 xmlNewDocComment (xmlDocPtr doc,
869 const xmlChar *content);
870 XMLPUBFUN xmlNodePtr XMLCALL
871 xmlNewComment (const xmlChar *content);
872 XMLPUBFUN xmlNodePtr XMLCALL
873 xmlNewCDataBlock (xmlDocPtr doc,
874 const xmlChar *content,
876 XMLPUBFUN xmlNodePtr XMLCALL
877 xmlNewCharRef (xmlDocPtr doc,
878 const xmlChar *name);
879 XMLPUBFUN xmlNodePtr XMLCALL
880 xmlNewReference (const xmlDoc *doc,
881 const xmlChar *name);
882 XMLPUBFUN xmlNodePtr XMLCALL
883 xmlCopyNode (xmlNodePtr node,
885 XMLPUBFUN xmlNodePtr XMLCALL
886 xmlDocCopyNode (xmlNodePtr node,
889 XMLPUBFUN xmlNodePtr XMLCALL
890 xmlDocCopyNodeList (xmlDocPtr doc,
892 XMLPUBFUN xmlNodePtr XMLCALL
893 xmlCopyNodeList (xmlNodePtr node);
894 #ifdef LIBXML_TREE_ENABLED
895 XMLPUBFUN xmlNodePtr XMLCALL
896 xmlNewTextChild (xmlNodePtr parent,
899 const xmlChar *content);
900 XMLPUBFUN xmlNodePtr XMLCALL
901 xmlNewDocRawNode (xmlDocPtr doc,
904 const xmlChar *content);
905 XMLPUBFUN xmlNodePtr XMLCALL
906 xmlNewDocFragment (xmlDocPtr doc);
907 #endif /* LIBXML_TREE_ENABLED */
912 XMLPUBFUN long XMLCALL
913 xmlGetLineNo (const xmlNode *node);
914 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
915 XMLPUBFUN xmlChar * XMLCALL
916 xmlGetNodePath (const xmlNode *node);
917 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */
918 XMLPUBFUN xmlNodePtr XMLCALL
919 xmlDocGetRootElement (const xmlDoc *doc);
920 XMLPUBFUN xmlNodePtr XMLCALL
921 xmlGetLastChild (const xmlNode *parent);
922 XMLPUBFUN int XMLCALL
923 xmlNodeIsText (const xmlNode *node);
924 XMLPUBFUN int XMLCALL
925 xmlIsBlankNode (const xmlNode *node);
928 * Changing the structure.
930 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
931 XMLPUBFUN xmlNodePtr XMLCALL
932 xmlDocSetRootElement (xmlDocPtr doc,
934 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
935 #ifdef LIBXML_TREE_ENABLED
936 XMLPUBFUN void XMLCALL
937 xmlNodeSetName (xmlNodePtr cur,
938 const xmlChar *name);
939 #endif /* LIBXML_TREE_ENABLED */
940 XMLPUBFUN xmlNodePtr XMLCALL
941 xmlAddChild (xmlNodePtr parent,
943 XMLPUBFUN xmlNodePtr XMLCALL
944 xmlAddChildList (xmlNodePtr parent,
946 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
947 XMLPUBFUN xmlNodePtr XMLCALL
948 xmlReplaceNode (xmlNodePtr old,
950 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
951 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \
952 defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
953 XMLPUBFUN xmlNodePtr XMLCALL
954 xmlAddPrevSibling (xmlNodePtr cur,
956 #endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */
957 XMLPUBFUN xmlNodePtr XMLCALL
958 xmlAddSibling (xmlNodePtr cur,
960 XMLPUBFUN xmlNodePtr XMLCALL
961 xmlAddNextSibling (xmlNodePtr cur,
963 XMLPUBFUN void XMLCALL
964 xmlUnlinkNode (xmlNodePtr cur);
965 XMLPUBFUN xmlNodePtr XMLCALL
966 xmlTextMerge (xmlNodePtr first,
968 XMLPUBFUN int XMLCALL
969 xmlTextConcat (xmlNodePtr node,
970 const xmlChar *content,
972 XMLPUBFUN void XMLCALL
973 xmlFreeNodeList (xmlNodePtr cur);
974 XMLPUBFUN void XMLCALL
975 xmlFreeNode (xmlNodePtr cur);
976 XMLPUBFUN void XMLCALL
977 xmlSetTreeDoc (xmlNodePtr tree,
979 XMLPUBFUN void XMLCALL
980 xmlSetListDoc (xmlNodePtr list,
985 XMLPUBFUN xmlNsPtr XMLCALL
986 xmlSearchNs (xmlDocPtr doc,
988 const xmlChar *nameSpace);
989 XMLPUBFUN xmlNsPtr XMLCALL
990 xmlSearchNsByHref (xmlDocPtr doc,
992 const xmlChar *href);
993 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \
994 defined(LIBXML_SCHEMAS_ENABLED)
995 XMLPUBFUN xmlNsPtr * XMLCALL
996 xmlGetNsList (const xmlDoc *doc,
997 const xmlNode *node);
998 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */
1000 XMLPUBFUN void XMLCALL
1001 xmlSetNs (xmlNodePtr node,
1003 XMLPUBFUN xmlNsPtr XMLCALL
1004 xmlCopyNamespace (xmlNsPtr cur);
1005 XMLPUBFUN xmlNsPtr XMLCALL
1006 xmlCopyNamespaceList (xmlNsPtr cur);
1009 * Changing the content.
1011 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
1012 defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
1013 XMLPUBFUN xmlAttrPtr XMLCALL
1014 xmlSetProp (xmlNodePtr node,
1015 const xmlChar *name,
1016 const xmlChar *value);
1017 XMLPUBFUN xmlAttrPtr XMLCALL
1018 xmlSetNsProp (xmlNodePtr node,
1020 const xmlChar *name,
1021 const xmlChar *value);
1022 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \
1023 defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */
1024 XMLPUBFUN xmlChar * XMLCALL
1025 xmlGetNoNsProp (const xmlNode *node,
1026 const xmlChar *name);
1027 XMLPUBFUN xmlChar * XMLCALL
1028 xmlGetProp (const xmlNode *node,
1029 const xmlChar *name);
1030 XMLPUBFUN xmlAttrPtr XMLCALL
1031 xmlHasProp (const xmlNode *node,
1032 const xmlChar *name);
1033 XMLPUBFUN xmlAttrPtr XMLCALL
1034 xmlHasNsProp (const xmlNode *node,
1035 const xmlChar *name,
1036 const xmlChar *nameSpace);
1037 XMLPUBFUN xmlChar * XMLCALL
1038 xmlGetNsProp (const xmlNode *node,
1039 const xmlChar *name,
1040 const xmlChar *nameSpace);
1041 XMLPUBFUN xmlNodePtr XMLCALL
1042 xmlStringGetNodeList (const xmlDoc *doc,
1043 const xmlChar *value);
1044 XMLPUBFUN xmlNodePtr XMLCALL
1045 xmlStringLenGetNodeList (const xmlDoc *doc,
1046 const xmlChar *value,
1048 XMLPUBFUN xmlChar * XMLCALL
1049 xmlNodeListGetString (xmlDocPtr doc,
1050 const xmlNode *list,
1052 #ifdef LIBXML_TREE_ENABLED
1053 XMLPUBFUN xmlChar * XMLCALL
1054 xmlNodeListGetRawString (const xmlDoc *doc,
1055 const xmlNode *list,
1057 #endif /* LIBXML_TREE_ENABLED */
1058 XMLPUBFUN void XMLCALL
1059 xmlNodeSetContent (xmlNodePtr cur,
1060 const xmlChar *content);
1061 #ifdef LIBXML_TREE_ENABLED
1062 XMLPUBFUN void XMLCALL
1063 xmlNodeSetContentLen (xmlNodePtr cur,
1064 const xmlChar *content,
1066 #endif /* LIBXML_TREE_ENABLED */
1067 XMLPUBFUN void XMLCALL
1068 xmlNodeAddContent (xmlNodePtr cur,
1069 const xmlChar *content);
1070 XMLPUBFUN void XMLCALL
1071 xmlNodeAddContentLen (xmlNodePtr cur,
1072 const xmlChar *content,
1074 XMLPUBFUN xmlChar * XMLCALL
1075 xmlNodeGetContent (const xmlNode *cur);
1077 XMLPUBFUN int XMLCALL
1078 xmlNodeBufGetContent (xmlBufferPtr buffer,
1079 const xmlNode *cur);
1080 XMLPUBFUN int XMLCALL
1081 xmlBufGetNodeContent (xmlBufPtr buf,
1082 const xmlNode *cur);
1084 XMLPUBFUN xmlChar * XMLCALL
1085 xmlNodeGetLang (const xmlNode *cur);
1086 XMLPUBFUN int XMLCALL
1087 xmlNodeGetSpacePreserve (const xmlNode *cur);
1088 #ifdef LIBXML_TREE_ENABLED
1089 XMLPUBFUN void XMLCALL
1090 xmlNodeSetLang (xmlNodePtr cur,
1091 const xmlChar *lang);
1092 XMLPUBFUN void XMLCALL
1093 xmlNodeSetSpacePreserve (xmlNodePtr cur,
1095 #endif /* LIBXML_TREE_ENABLED */
1096 XMLPUBFUN xmlChar * XMLCALL
1097 xmlNodeGetBase (const xmlDoc *doc,
1098 const xmlNode *cur);
1099 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
1100 XMLPUBFUN void XMLCALL
1101 xmlNodeSetBase (xmlNodePtr cur,
1102 const xmlChar *uri);
1108 XMLPUBFUN int XMLCALL
1109 xmlRemoveProp (xmlAttrPtr cur);
1110 #if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
1111 XMLPUBFUN int XMLCALL
1112 xmlUnsetNsProp (xmlNodePtr node,
1114 const xmlChar *name);
1115 XMLPUBFUN int XMLCALL
1116 xmlUnsetProp (xmlNodePtr node,
1117 const xmlChar *name);
1118 #endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
1121 * Internal, don't use.
1123 XMLPUBFUN void XMLCALL
1124 xmlBufferWriteCHAR (xmlBufferPtr buf,
1125 const xmlChar *string);
1126 XMLPUBFUN void XMLCALL
1127 xmlBufferWriteChar (xmlBufferPtr buf,
1128 const char *string);
1129 XMLPUBFUN void XMLCALL
1130 xmlBufferWriteQuotedString(xmlBufferPtr buf,
1131 const xmlChar *string);
1133 #ifdef LIBXML_OUTPUT_ENABLED
1134 XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf,
1137 const xmlChar *string);
1138 #endif /* LIBXML_OUTPUT_ENABLED */
1140 #ifdef LIBXML_TREE_ENABLED
1142 * Namespace handling.
1144 XMLPUBFUN int XMLCALL
1145 xmlReconciliateNs (xmlDocPtr doc,
1149 #ifdef LIBXML_OUTPUT_ENABLED
1153 XMLPUBFUN void XMLCALL
1154 xmlDocDumpFormatMemory (xmlDocPtr cur,
1158 XMLPUBFUN void XMLCALL
1159 xmlDocDumpMemory (xmlDocPtr cur,
1162 XMLPUBFUN void XMLCALL
1163 xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
1164 xmlChar **doc_txt_ptr,
1166 const char *txt_encoding);
1167 XMLPUBFUN void XMLCALL
1168 xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
1169 xmlChar **doc_txt_ptr,
1171 const char *txt_encoding,
1173 XMLPUBFUN int XMLCALL
1174 xmlDocFormatDump (FILE *f,
1177 XMLPUBFUN int XMLCALL
1178 xmlDocDump (FILE *f,
1180 XMLPUBFUN void XMLCALL
1181 xmlElemDump (FILE *f,
1184 XMLPUBFUN int XMLCALL
1185 xmlSaveFile (const char *filename,
1187 XMLPUBFUN int XMLCALL
1188 xmlSaveFormatFile (const char *filename,
1191 XMLPUBFUN size_t XMLCALL
1192 xmlBufNodeDump (xmlBufPtr buf,
1197 XMLPUBFUN int XMLCALL
1198 xmlNodeDump (xmlBufferPtr buf,
1204 XMLPUBFUN int XMLCALL
1205 xmlSaveFileTo (xmlOutputBufferPtr buf,
1207 const char *encoding);
1208 XMLPUBFUN int XMLCALL
1209 xmlSaveFormatFileTo (xmlOutputBufferPtr buf,
1211 const char *encoding,
1213 XMLPUBFUN void XMLCALL
1214 xmlNodeDumpOutput (xmlOutputBufferPtr buf,
1219 const char *encoding);
1221 XMLPUBFUN int XMLCALL
1222 xmlSaveFormatFileEnc (const char *filename,
1224 const char *encoding,
1227 XMLPUBFUN int XMLCALL
1228 xmlSaveFileEnc (const char *filename,
1230 const char *encoding);
1232 #endif /* LIBXML_OUTPUT_ENABLED */
1236 XMLPUBFUN int XMLCALL
1237 xmlIsXHTML (const xmlChar *systemID,
1238 const xmlChar *publicID);
1243 XMLPUBFUN int XMLCALL
1244 xmlGetDocCompressMode (const xmlDoc *doc);
1245 XMLPUBFUN void XMLCALL
1246 xmlSetDocCompressMode (xmlDocPtr doc,
1248 XMLPUBFUN int XMLCALL
1249 xmlGetCompressMode (void);
1250 XMLPUBFUN void XMLCALL
1251 xmlSetCompressMode (int mode);
1254 * DOM-wrapper helper functions.
1256 XMLPUBFUN xmlDOMWrapCtxtPtr XMLCALL
1257 xmlDOMWrapNewCtxt (void);
1258 XMLPUBFUN void XMLCALL
1259 xmlDOMWrapFreeCtxt (xmlDOMWrapCtxtPtr ctxt);
1260 XMLPUBFUN int XMLCALL
1261 xmlDOMWrapReconcileNamespaces(xmlDOMWrapCtxtPtr ctxt,
1264 XMLPUBFUN int XMLCALL
1265 xmlDOMWrapAdoptNode (xmlDOMWrapCtxtPtr ctxt,
1266 xmlDocPtr sourceDoc,
1269 xmlNodePtr destParent,
1271 XMLPUBFUN int XMLCALL
1272 xmlDOMWrapRemoveNode (xmlDOMWrapCtxtPtr ctxt,
1276 XMLPUBFUN int XMLCALL
1277 xmlDOMWrapCloneNode (xmlDOMWrapCtxtPtr ctxt,
1278 xmlDocPtr sourceDoc,
1280 xmlNodePtr *clonedNode,
1282 xmlNodePtr destParent,
1286 #ifdef LIBXML_TREE_ENABLED
1288 * 5 interfaces from DOM ElementTraversal, but different in entities
1291 XMLPUBFUN unsigned long XMLCALL
1292 xmlChildElementCount (xmlNodePtr parent);
1293 XMLPUBFUN xmlNodePtr XMLCALL
1294 xmlNextElementSibling (xmlNodePtr node);
1295 XMLPUBFUN xmlNodePtr XMLCALL
1296 xmlFirstElementChild (xmlNodePtr parent);
1297 XMLPUBFUN xmlNodePtr XMLCALL
1298 xmlLastElementChild (xmlNodePtr parent);
1299 XMLPUBFUN xmlNodePtr XMLCALL
1300 xmlPreviousElementSibling (xmlNodePtr node);
1305 #ifndef __XML_PARSER_H__
1306 #include <libxml/xmlmemory.h>
1309 #endif /* __XML_TREE_H__ */