blob: 4be4c5fac31ff7af596b1921f4a1cc1d689ce728 [file] [log] [blame]
Owen Taylor3473f882001-02-23 17:55:21 +00001/*
2 * tree.h : describes the structures found in an tree resulting
3 * from an XML parsing.
4 *
5 * See Copyright for the status of this software.
6 *
7 * Daniel.Veillard@w3.org
8 *
9 * 14 Nov 2000 ht - added redefinition of xmlBufferWriteChar for VMS
10 *
11 */
12
13#ifndef __XML_TREE_H__
14#define __XML_TREE_H__
15
16#include <stdio.h>
17#include <libxml/xmlversion.h>
Daniel Veillard67a21302001-04-11 14:39:16 +000018#include <libxml/xmlmemory.h>
Owen Taylor3473f882001-02-23 17:55:21 +000019
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#define XML_XML_NAMESPACE \
25 (const xmlChar *) "http://www.w3.org/XML/1998/namespace"
26
27/*
28 * The different element types carried by an XML tree
29 *
30 * NOTE: This is synchronized with DOM Level1 values
31 * See http://www.w3.org/TR/REC-DOM-Level-1/
32 *
33 * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
34 * be deprecated to use an XML_DTD_NODE.
35 */
36typedef enum {
37 XML_ELEMENT_NODE= 1,
38 XML_ATTRIBUTE_NODE= 2,
39 XML_TEXT_NODE= 3,
40 XML_CDATA_SECTION_NODE= 4,
41 XML_ENTITY_REF_NODE= 5,
42 XML_ENTITY_NODE= 6,
43 XML_PI_NODE= 7,
44 XML_COMMENT_NODE= 8,
45 XML_DOCUMENT_NODE= 9,
46 XML_DOCUMENT_TYPE_NODE= 10,
47 XML_DOCUMENT_FRAG_NODE= 11,
48 XML_NOTATION_NODE= 12,
49 XML_HTML_DOCUMENT_NODE= 13,
50 XML_DTD_NODE= 14,
51 XML_ELEMENT_DECL= 15,
52 XML_ATTRIBUTE_DECL= 16,
53 XML_ENTITY_DECL= 17,
54 XML_NAMESPACE_DECL= 18,
55 XML_XINCLUDE_START= 19,
56 XML_XINCLUDE_END= 20
Daniel Veillardeae522a2001-04-23 13:41:34 +000057#ifdef LIBXML_DOCB_ENABLED
58 ,XML_DOCB_DOCUMENT_NODE= 21
Owen Taylor3473f882001-02-23 17:55:21 +000059#endif
60} xmlElementType;
61
62/*
63 * Size of an internal character representation.
64 *
65 * We use 8bit chars internal representation for memory efficiency,
66 * Note that with 8 bits wide xmlChars one can still use UTF-8 to handle
67 * correctly non ISO-Latin input.
68 */
69
70typedef unsigned char xmlChar;
71
72#ifndef WIN32
73#ifndef CHAR
74#define CHAR xmlChar
75#endif
76#endif
77
78#define BAD_CAST (xmlChar *)
79
80/*
81 * a DTD Notation definition
82 */
83
84typedef struct _xmlNotation xmlNotation;
85typedef xmlNotation *xmlNotationPtr;
86struct _xmlNotation {
Daniel Veillard9e7160d2001-03-18 23:17:47 +000087 const xmlChar *name; /* Notation name */
Owen Taylor3473f882001-02-23 17:55:21 +000088 const xmlChar *PublicID; /* Public identifier, if any */
89 const xmlChar *SystemID; /* System identifier, if any */
90};
91
92/*
93 * a DTD Attribute definition
94 */
95
96typedef enum {
97 XML_ATTRIBUTE_CDATA = 1,
98 XML_ATTRIBUTE_ID,
99 XML_ATTRIBUTE_IDREF ,
100 XML_ATTRIBUTE_IDREFS,
101 XML_ATTRIBUTE_ENTITY,
102 XML_ATTRIBUTE_ENTITIES,
103 XML_ATTRIBUTE_NMTOKEN,
104 XML_ATTRIBUTE_NMTOKENS,
105 XML_ATTRIBUTE_ENUMERATION,
106 XML_ATTRIBUTE_NOTATION
107} xmlAttributeType;
108
109typedef enum {
110 XML_ATTRIBUTE_NONE = 1,
111 XML_ATTRIBUTE_REQUIRED,
112 XML_ATTRIBUTE_IMPLIED,
113 XML_ATTRIBUTE_FIXED
114} xmlAttributeDefault;
115
116typedef struct _xmlEnumeration xmlEnumeration;
117typedef xmlEnumeration *xmlEnumerationPtr;
118struct _xmlEnumeration {
119 struct _xmlEnumeration *next; /* next one */
120 const xmlChar *name; /* Enumeration name */
121};
122
123typedef struct _xmlAttribute xmlAttribute;
124typedef xmlAttribute *xmlAttributePtr;
125struct _xmlAttribute {
126#ifndef XML_WITHOUT_CORBA
127 void *_private; /* for Corba, must be first ! */
128#endif
129 xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
130 const xmlChar *name; /* Attribute name */
131 struct _xmlNode *children; /* NULL */
132 struct _xmlNode *last; /* NULL */
133 struct _xmlDtd *parent; /* -> DTD */
134 struct _xmlNode *next; /* next sibling link */
135 struct _xmlNode *prev; /* previous sibling link */
136 struct _xmlDoc *doc; /* the containing document */
137
138 struct _xmlAttribute *nexth; /* next in hash table */
139 xmlAttributeType atype; /* The attribute type */
140 xmlAttributeDefault def; /* the default */
141 const xmlChar *defaultValue; /* or the default value */
142 xmlEnumerationPtr tree; /* or the enumeration tree if any */
143 const xmlChar *prefix; /* the namespace prefix if any */
144 const xmlChar *elem; /* Element holding the attribute */
145};
146
147/*
148 * a DTD Element definition.
149 */
150typedef enum {
151 XML_ELEMENT_CONTENT_PCDATA = 1,
152 XML_ELEMENT_CONTENT_ELEMENT,
153 XML_ELEMENT_CONTENT_SEQ,
154 XML_ELEMENT_CONTENT_OR
155} xmlElementContentType;
156
157typedef enum {
158 XML_ELEMENT_CONTENT_ONCE = 1,
159 XML_ELEMENT_CONTENT_OPT,
160 XML_ELEMENT_CONTENT_MULT,
161 XML_ELEMENT_CONTENT_PLUS
162} xmlElementContentOccur;
163
164typedef struct _xmlElementContent xmlElementContent;
165typedef xmlElementContent *xmlElementContentPtr;
166struct _xmlElementContent {
167 xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
168 xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
169 const xmlChar *name; /* Element name */
170 struct _xmlElementContent *c1; /* first child */
171 struct _xmlElementContent *c2; /* second child */
Daniel Veillarddab4cb32001-04-20 13:03:48 +0000172 struct _xmlElementContent *parent; /* parent */
Owen Taylor3473f882001-02-23 17:55:21 +0000173};
174
175typedef enum {
Daniel Veillarda10efa82001-04-18 13:09:01 +0000176 XML_ELEMENT_TYPE_UNDEFINED = 0,
Owen Taylor3473f882001-02-23 17:55:21 +0000177 XML_ELEMENT_TYPE_EMPTY = 1,
178 XML_ELEMENT_TYPE_ANY,
179 XML_ELEMENT_TYPE_MIXED,
180 XML_ELEMENT_TYPE_ELEMENT
181} xmlElementTypeVal;
182
183typedef struct _xmlElement xmlElement;
184typedef xmlElement *xmlElementPtr;
185struct _xmlElement {
186#ifndef XML_WITHOUT_CORBA
187 void *_private; /* for Corba, must be first ! */
188#endif
189 xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */
190 const xmlChar *name; /* Element name */
191 struct _xmlNode *children; /* NULL */
192 struct _xmlNode *last; /* NULL */
193 struct _xmlDtd *parent; /* -> DTD */
194 struct _xmlNode *next; /* next sibling link */
195 struct _xmlNode *prev; /* previous sibling link */
196 struct _xmlDoc *doc; /* the containing document */
197
198 xmlElementTypeVal etype; /* The type */
199 xmlElementContentPtr content; /* the allowed element content */
200 xmlAttributePtr attributes; /* List of the declared attributes */
201 const xmlChar *prefix; /* the namespace prefix if any */
202};
203
204/*
205 * An XML namespace.
206 * Note that prefix == NULL is valid, it defines the default namespace
207 * within the subtree (until overriden).
208 *
209 * XML_GLOBAL_NAMESPACE is now deprecated for good
210 * xmlNsType is unified with xmlElementType
211 */
212
213#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
214typedef xmlElementType xmlNsType;
215
216typedef struct _xmlNs xmlNs;
217typedef xmlNs *xmlNsPtr;
218struct _xmlNs {
219 struct _xmlNs *next; /* next Ns link for this node */
220 xmlNsType type; /* global or local */
221 const xmlChar *href; /* URL for the namespace */
222 const xmlChar *prefix; /* prefix for the namespace */
223};
224
225/*
226 * An XML DtD, as defined by <!DOCTYPE.
227 */
228typedef struct _xmlDtd xmlDtd;
229typedef xmlDtd *xmlDtdPtr;
230struct _xmlDtd {
231#ifndef XML_WITHOUT_CORBA
232 void *_private; /* for Corba, must be first ! */
233#endif
234 xmlElementType type; /* XML_DTD_NODE, must be second ! */
235 const xmlChar *name; /* Name of the DTD */
236 struct _xmlNode *children; /* the value of the property link */
237 struct _xmlNode *last; /* last child link */
238 struct _xmlDoc *parent; /* child->parent link */
239 struct _xmlNode *next; /* next sibling link */
240 struct _xmlNode *prev; /* previous sibling link */
241 struct _xmlDoc *doc; /* the containing document */
242
243 /* End of common part */
244 void *notations; /* Hash table for notations if any */
245 void *elements; /* Hash table for elements if any */
246 void *attributes; /* Hash table for attributes if any */
247 void *entities; /* Hash table for entities if any */
248 const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
249 const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
250 void *pentities; /* Hash table for param entities if any */
251};
252
253/*
254 * A attribute of an XML node.
255 */
256typedef struct _xmlAttr xmlAttr;
257typedef xmlAttr *xmlAttrPtr;
258struct _xmlAttr {
259#ifndef XML_WITHOUT_CORBA
260 void *_private; /* for Corba, must be first ! */
261#endif
262 xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */
263 const xmlChar *name; /* the name of the property */
264 struct _xmlNode *children; /* the value of the property */
265 struct _xmlNode *last; /* NULL */
266 struct _xmlNode *parent; /* child->parent link */
267 struct _xmlAttr *next; /* next sibling link */
268 struct _xmlAttr *prev; /* previous sibling link */
269 struct _xmlDoc *doc; /* the containing document */
270 xmlNs *ns; /* pointer to the associated namespace */
271 xmlAttributeType atype; /* the attribute type if validating */
272};
273
274/*
275 * An XML ID instance.
276 */
277
278typedef struct _xmlID xmlID;
279typedef xmlID *xmlIDPtr;
280struct _xmlID {
281 struct _xmlID *next; /* next ID */
282 const xmlChar *value; /* The ID name */
283 xmlAttrPtr attr; /* The attribut holding it */
284};
285
286/*
287 * An XML IDREF instance.
288 */
289
290typedef struct _xmlRef xmlRef;
291typedef xmlRef *xmlRefPtr;
292struct _xmlRef {
293 struct _xmlRef *next; /* next Ref */
294 const xmlChar *value; /* The Ref name */
295 xmlAttrPtr attr; /* The attribut holding it */
296};
297
298/*
299 * A buffer structure
300 */
301
302typedef enum {
303 XML_BUFFER_ALLOC_DOUBLEIT,
304 XML_BUFFER_ALLOC_EXACT
305} xmlBufferAllocationScheme;
306
307typedef struct _xmlBuffer xmlBuffer;
308typedef xmlBuffer *xmlBufferPtr;
309struct _xmlBuffer {
310 xmlChar *content; /* The buffer content UTF8 */
311 unsigned int use; /* The buffer size used */
312 unsigned int size; /* The buffer size */
313 xmlBufferAllocationScheme alloc; /* The realloc method */
314};
315
Daniel Veillardf69bb4b2001-05-19 13:24:56 +0000316/**
317 * xmlNode:
318 *
Owen Taylor3473f882001-02-23 17:55:21 +0000319 * A node in an XML tree.
320 */
321typedef struct _xmlNode xmlNode;
322typedef xmlNode *xmlNodePtr;
323struct _xmlNode {
324#ifndef XML_WITHOUT_CORBA
325 void *_private; /* for Corba, must be first ! */
326#endif
327 xmlElementType type; /* type number, must be second ! */
328 const xmlChar *name; /* the name of the node, or the entity */
329 struct _xmlNode *children; /* parent->childs link */
330 struct _xmlNode *last; /* last child link */
331 struct _xmlNode *parent; /* child->parent link */
332 struct _xmlNode *next; /* next sibling link */
333 struct _xmlNode *prev; /* previous sibling link */
334 struct _xmlDoc *doc; /* the containing document */
335 xmlNs *ns; /* pointer to the associated namespace */
336#ifndef XML_USE_BUFFER_CONTENT
337 xmlChar *content; /* the content */
338#else
339 xmlBufferPtr content; /* the content in a buffer */
340#endif
341
342 /* End of common part */
343 struct _xmlAttr *properties;/* properties list */
344 xmlNs *nsDef; /* namespace definitions on this node */
345};
346
347/*
348 * An XML document.
349 */
350typedef struct _xmlDoc xmlDoc;
351typedef xmlDoc *xmlDocPtr;
352struct _xmlDoc {
353#ifndef XML_WITHOUT_CORBA
354 void *_private; /* for Corba, must be first ! */
355#endif
356 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
357 char *name; /* name/filename/URI of the document */
358 struct _xmlNode *children; /* the document tree */
359 struct _xmlNode *last; /* last child link */
360 struct _xmlNode *parent; /* child->parent link */
361 struct _xmlNode *next; /* next sibling link */
362 struct _xmlNode *prev; /* previous sibling link */
363 struct _xmlDoc *doc; /* autoreference to itself */
364
365 /* End of common part */
366 int compression;/* level of zlib compression */
367 int standalone; /* standalone document (no external refs) */
368 struct _xmlDtd *intSubset; /* the document internal subset */
369 struct _xmlDtd *extSubset; /* the document external subset */
370 struct _xmlNs *oldNs; /* Global namespace, the old way */
371 const xmlChar *version; /* the XML version string */
372 const xmlChar *encoding; /* external initial encoding, if any */
373 void *ids; /* Hash table for ID attributes if any */
374 void *refs; /* Hash table for IDREFs attributes if any */
375 const xmlChar *URL; /* The URI for that document */
376 int charset; /* encoding of the in-memory content
377 actually an xmlCharEncoding */
378};
379
380/*
381 * Compatibility naming layer with libxml1
382 */
383#ifndef xmlChildrenNode
384#define xmlChildrenNode children
385#define xmlRootNode children
386#endif
387
388/*
389 * Variables.
390 */
391LIBXML_DLL_IMPORT extern xmlNsPtr baseDTD;
392LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
393LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
394LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
Daniel Veillarde356c282001-03-10 12:32:04 +0000395LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as <empty></empty> */
396LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */
Owen Taylor3473f882001-02-23 17:55:21 +0000397
398/*
399 * Handling Buffers.
400 */
401
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000402void xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
403xmlBufferAllocationScheme xmlGetBufferAllocationScheme(void);
404
Owen Taylor3473f882001-02-23 17:55:21 +0000405xmlBufferPtr xmlBufferCreate (void);
406xmlBufferPtr xmlBufferCreateSize (size_t size);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000407int xmlBufferResize (xmlBufferPtr buf,
408 unsigned int size);
Owen Taylor3473f882001-02-23 17:55:21 +0000409void xmlBufferFree (xmlBufferPtr buf);
410int xmlBufferDump (FILE *file,
411 xmlBufferPtr buf);
412void xmlBufferAdd (xmlBufferPtr buf,
413 const xmlChar *str,
414 int len);
415void xmlBufferAddHead (xmlBufferPtr buf,
416 const xmlChar *str,
417 int len);
418void xmlBufferCat (xmlBufferPtr buf,
419 const xmlChar *str);
420void xmlBufferCCat (xmlBufferPtr buf,
421 const char *str);
422int xmlBufferShrink (xmlBufferPtr buf,
423 unsigned int len);
424int xmlBufferGrow (xmlBufferPtr buf,
425 unsigned int len);
426void xmlBufferEmpty (xmlBufferPtr buf);
427const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
428int xmlBufferUse (const xmlBufferPtr buf);
429void xmlBufferSetAllocationScheme(xmlBufferPtr buf,
430 xmlBufferAllocationScheme scheme);
431int xmlBufferLength (const xmlBufferPtr buf);
432
433/*
434 * Creating/freeing new structures
435 */
436xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
437 const xmlChar *name,
438 const xmlChar *ExternalID,
439 const xmlChar *SystemID);
440xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
441 const xmlChar *name,
442 const xmlChar *ExternalID,
443 const xmlChar *SystemID);
444xmlDtdPtr xmlGetIntSubset (xmlDocPtr doc);
445void xmlFreeDtd (xmlDtdPtr cur);
446xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
447 const xmlChar *href,
448 const xmlChar *prefix);
449xmlNsPtr xmlNewNs (xmlNodePtr node,
450 const xmlChar *href,
451 const xmlChar *prefix);
452void xmlFreeNs (xmlNsPtr cur);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000453void xmlFreeNsList (xmlNsPtr cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000454xmlDocPtr xmlNewDoc (const xmlChar *version);
455void xmlFreeDoc (xmlDocPtr cur);
456xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
457 const xmlChar *name,
458 const xmlChar *value);
459xmlAttrPtr xmlNewProp (xmlNodePtr node,
460 const xmlChar *name,
461 const xmlChar *value);
462xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
463 xmlNsPtr ns,
464 const xmlChar *name,
465 const xmlChar *value);
466void xmlFreePropList (xmlAttrPtr cur);
467void xmlFreeProp (xmlAttrPtr cur);
468xmlAttrPtr xmlCopyProp (xmlNodePtr target,
469 xmlAttrPtr cur);
470xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
471 xmlAttrPtr cur);
472xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
473xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
474 int recursive);
475
476/*
477 * Creating new nodes
478 */
479xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
480 xmlNsPtr ns,
481 const xmlChar *name,
482 const xmlChar *content);
483xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
484 xmlNsPtr ns,
485 const xmlChar *name,
486 const xmlChar *content);
487xmlNodePtr xmlNewNode (xmlNsPtr ns,
488 const xmlChar *name);
489xmlNodePtr xmlNewChild (xmlNodePtr parent,
490 xmlNsPtr ns,
491 const xmlChar *name,
492 const xmlChar *content);
493xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
494 xmlNsPtr ns,
495 const xmlChar *name,
496 const xmlChar *content);
497xmlNodePtr xmlNewDocText (xmlDocPtr doc,
498 const xmlChar *content);
499xmlNodePtr xmlNewText (const xmlChar *content);
500xmlNodePtr xmlNewPI (const xmlChar *name,
501 const xmlChar *content);
502xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
503 const xmlChar *content,
504 int len);
505xmlNodePtr xmlNewTextLen (const xmlChar *content,
506 int len);
507xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
508 const xmlChar *content);
509xmlNodePtr xmlNewComment (const xmlChar *content);
510xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
511 const xmlChar *content,
512 int len);
513xmlNodePtr xmlNewCharRef (xmlDocPtr doc,
514 const xmlChar *name);
515xmlNodePtr xmlNewReference (xmlDocPtr doc,
516 const xmlChar *name);
517xmlNodePtr xmlCopyNode (xmlNodePtr node,
518 int recursive);
Daniel Veillard82daa812001-04-12 08:55:36 +0000519xmlNodePtr xmlDocCopyNode (xmlNodePtr node,
520 xmlDocPtr doc,
521 int recursive);
Owen Taylor3473f882001-02-23 17:55:21 +0000522xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
523xmlNodePtr xmlNewDocFragment (xmlDocPtr doc);
524
525/*
526 * Navigating
527 */
528xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc);
529xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
530int xmlNodeIsText (xmlNodePtr node);
531int xmlIsBlankNode (xmlNodePtr node);
532
533/*
534 * Changing the structure
535 */
536xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc,
537 xmlNodePtr root);
538void xmlNodeSetName (xmlNodePtr cur,
539 const xmlChar *name);
540xmlNodePtr xmlAddChild (xmlNodePtr parent,
541 xmlNodePtr cur);
542xmlNodePtr xmlAddChildList (xmlNodePtr parent,
543 xmlNodePtr cur);
544xmlNodePtr xmlReplaceNode (xmlNodePtr old,
545 xmlNodePtr cur);
546xmlNodePtr xmlAddSibling (xmlNodePtr cur,
547 xmlNodePtr elem);
548xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur,
549 xmlNodePtr elem);
550xmlNodePtr xmlAddNextSibling (xmlNodePtr cur,
551 xmlNodePtr elem);
552void xmlUnlinkNode (xmlNodePtr cur);
553xmlNodePtr xmlTextMerge (xmlNodePtr first,
554 xmlNodePtr second);
555void xmlTextConcat (xmlNodePtr node,
556 const xmlChar *content,
557 int len);
558void xmlFreeNodeList (xmlNodePtr cur);
559void xmlFreeNode (xmlNodePtr cur);
560void xmlSetTreeDoc (xmlNodePtr tree,
561 xmlDocPtr doc);
562void xmlSetListDoc (xmlNodePtr list,
563 xmlDocPtr doc);
564
565/*
566 * Namespaces
567 */
568xmlNsPtr xmlSearchNs (xmlDocPtr doc,
569 xmlNodePtr node,
570 const xmlChar *nameSpace);
571xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
572 xmlNodePtr node,
573 const xmlChar *href);
574xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
575 xmlNodePtr node);
576void xmlSetNs (xmlNodePtr node,
577 xmlNsPtr ns);
578xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
579xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
580
581/*
582 * Changing the content.
583 */
584xmlAttrPtr xmlSetProp (xmlNodePtr node,
585 const xmlChar *name,
586 const xmlChar *value);
587xmlChar * xmlGetProp (xmlNodePtr node,
588 const xmlChar *name);
Daniel Veillard75bea542001-05-11 17:41:21 +0000589int xmlUnsetProp (xmlNodePtr node,
590 const xmlChar *name);
Owen Taylor3473f882001-02-23 17:55:21 +0000591xmlAttrPtr xmlHasProp (xmlNodePtr node,
592 const xmlChar *name);
593xmlAttrPtr xmlSetNsProp (xmlNodePtr node,
594 xmlNsPtr ns,
595 const xmlChar *name,
596 const xmlChar *value);
597xmlChar * xmlGetNsProp (xmlNodePtr node,
598 const xmlChar *name,
599 const xmlChar *nameSpace);
Daniel Veillard75bea542001-05-11 17:41:21 +0000600int xmlUnsetNsProp (xmlNodePtr node,
601 xmlNsPtr ns,
602 const xmlChar *name);
Owen Taylor3473f882001-02-23 17:55:21 +0000603xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
604 const xmlChar *value);
605xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
606 const xmlChar *value,
607 int len);
608xmlChar * xmlNodeListGetString (xmlDocPtr doc,
609 xmlNodePtr list,
610 int inLine);
611xmlChar * xmlNodeListGetRawString (xmlDocPtr doc,
612 xmlNodePtr list,
613 int inLine);
614void xmlNodeSetContent (xmlNodePtr cur,
615 const xmlChar *content);
616void xmlNodeSetContentLen (xmlNodePtr cur,
617 const xmlChar *content,
618 int len);
619void xmlNodeAddContent (xmlNodePtr cur,
620 const xmlChar *content);
621void xmlNodeAddContentLen (xmlNodePtr cur,
622 const xmlChar *content,
623 int len);
624xmlChar * xmlNodeGetContent (xmlNodePtr cur);
625xmlChar * xmlNodeGetLang (xmlNodePtr cur);
626void xmlNodeSetLang (xmlNodePtr cur,
627 const xmlChar *lang);
628int xmlNodeGetSpacePreserve (xmlNodePtr cur);
629void xmlNodeSetSpacePreserve (xmlNodePtr cur, int
630 val);
631xmlChar * xmlNodeGetBase (xmlDocPtr doc,
632 xmlNodePtr cur);
633void xmlNodeSetBase (xmlNodePtr cur,
634 xmlChar *uri);
635
636/*
637 * Removing content.
638 */
639int xmlRemoveProp (xmlAttrPtr attr);
640int xmlRemoveNode (xmlNodePtr node); /* TODO */
641
642/*
643 * Internal, don't use
644 */
645#ifdef VMS
646void xmlBufferWriteXmlCHAR (xmlBufferPtr buf,
647 const xmlChar *string);
648#define xmlBufferWriteCHAR xmlBufferWriteXmlCHAR
649#else
650void xmlBufferWriteCHAR (xmlBufferPtr buf,
651 const xmlChar *string);
652#endif
653void xmlBufferWriteChar (xmlBufferPtr buf,
654 const char *string);
655void xmlBufferWriteQuotedString(xmlBufferPtr buf,
656 const xmlChar *string);
657
658/*
659 * Namespace handling
660 */
661int xmlReconciliateNs (xmlDocPtr doc,
662 xmlNodePtr tree);
663
664/*
665 * Saving
666 */
667void xmlDocDumpFormatMemory (xmlDocPtr cur,
668 xmlChar**mem,
669 int *size,
670 int format);
671void xmlDocDumpMemory (xmlDocPtr cur,
672 xmlChar**mem,
673 int *size);
674void xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
675 xmlChar **doc_txt_ptr,
676 int * doc_txt_len,
677 const char *txt_encoding);
678void xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
679 xmlChar **doc_txt_ptr,
680 int * doc_txt_len,
681 const char *txt_encoding,
682 int format);
683int xmlDocDump (FILE *f,
684 xmlDocPtr cur);
685void xmlElemDump (FILE *f,
686 xmlDocPtr doc,
687 xmlNodePtr cur);
688int xmlSaveFile (const char *filename,
689 xmlDocPtr cur);
Daniel Veillard67fee942001-04-26 18:59:03 +0000690int xmlSaveFormatFile (const char *filename,
691 xmlDocPtr cur,
692 int format);
Owen Taylor3473f882001-02-23 17:55:21 +0000693void xmlNodeDump (xmlBufferPtr buf,
694 xmlDocPtr doc,
695 xmlNodePtr cur,
696 int level,
697 int format);
698
Daniel Veillardeefd4492001-04-28 16:55:50 +0000699/* These are exported from xmlIO.h
Owen Taylor3473f882001-02-23 17:55:21 +0000700
701int xmlSaveFileTo (xmlOutputBuffer *buf,
702 xmlDocPtr cur,
703 const char *encoding);
Daniel Veillardeefd4492001-04-28 16:55:50 +0000704int xmlSaveFormatFileTo (xmlOutputBuffer *buf,
705 xmlDocPtr cur,
706 const char *encoding,
707 int format);
Owen Taylor3473f882001-02-23 17:55:21 +0000708 */
709
710int xmlSaveFileEnc (const char *filename,
711 xmlDocPtr cur,
712 const char *encoding);
713
714/*
715 * Compression
716 */
717int xmlGetDocCompressMode (xmlDocPtr doc);
718void xmlSetDocCompressMode (xmlDocPtr doc,
719 int mode);
720int xmlGetCompressMode (void);
721void xmlSetCompressMode (int mode);
722
723#ifdef __cplusplus
724}
725#endif
726
727#endif /* __XML_TREE_H__ */
728