blob: 604f88114fae8e61858acade1dfe70f2ba30e21d [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
316/*
317 * A node in an XML tree.
318 */
319typedef struct _xmlNode xmlNode;
320typedef xmlNode *xmlNodePtr;
321struct _xmlNode {
322#ifndef XML_WITHOUT_CORBA
323 void *_private; /* for Corba, must be first ! */
324#endif
325 xmlElementType type; /* type number, must be second ! */
326 const xmlChar *name; /* the name of the node, or the entity */
327 struct _xmlNode *children; /* parent->childs link */
328 struct _xmlNode *last; /* last child link */
329 struct _xmlNode *parent; /* child->parent link */
330 struct _xmlNode *next; /* next sibling link */
331 struct _xmlNode *prev; /* previous sibling link */
332 struct _xmlDoc *doc; /* the containing document */
333 xmlNs *ns; /* pointer to the associated namespace */
334#ifndef XML_USE_BUFFER_CONTENT
335 xmlChar *content; /* the content */
336#else
337 xmlBufferPtr content; /* the content in a buffer */
338#endif
339
340 /* End of common part */
341 struct _xmlAttr *properties;/* properties list */
342 xmlNs *nsDef; /* namespace definitions on this node */
343};
344
345/*
346 * An XML document.
347 */
348typedef struct _xmlDoc xmlDoc;
349typedef xmlDoc *xmlDocPtr;
350struct _xmlDoc {
351#ifndef XML_WITHOUT_CORBA
352 void *_private; /* for Corba, must be first ! */
353#endif
354 xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
355 char *name; /* name/filename/URI of the document */
356 struct _xmlNode *children; /* the document tree */
357 struct _xmlNode *last; /* last child link */
358 struct _xmlNode *parent; /* child->parent link */
359 struct _xmlNode *next; /* next sibling link */
360 struct _xmlNode *prev; /* previous sibling link */
361 struct _xmlDoc *doc; /* autoreference to itself */
362
363 /* End of common part */
364 int compression;/* level of zlib compression */
365 int standalone; /* standalone document (no external refs) */
366 struct _xmlDtd *intSubset; /* the document internal subset */
367 struct _xmlDtd *extSubset; /* the document external subset */
368 struct _xmlNs *oldNs; /* Global namespace, the old way */
369 const xmlChar *version; /* the XML version string */
370 const xmlChar *encoding; /* external initial encoding, if any */
371 void *ids; /* Hash table for ID attributes if any */
372 void *refs; /* Hash table for IDREFs attributes if any */
373 const xmlChar *URL; /* The URI for that document */
374 int charset; /* encoding of the in-memory content
375 actually an xmlCharEncoding */
376};
377
378/*
379 * Compatibility naming layer with libxml1
380 */
381#ifndef xmlChildrenNode
382#define xmlChildrenNode children
383#define xmlRootNode children
384#endif
385
386/*
387 * Variables.
388 */
389LIBXML_DLL_IMPORT extern xmlNsPtr baseDTD;
390LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
391LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
392LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
Daniel Veillarde356c282001-03-10 12:32:04 +0000393LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as <empty></empty> */
394LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */
Owen Taylor3473f882001-02-23 17:55:21 +0000395
396/*
397 * Handling Buffers.
398 */
399
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000400void xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme);
401xmlBufferAllocationScheme xmlGetBufferAllocationScheme(void);
402
Owen Taylor3473f882001-02-23 17:55:21 +0000403xmlBufferPtr xmlBufferCreate (void);
404xmlBufferPtr xmlBufferCreateSize (size_t size);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000405int xmlBufferResize (xmlBufferPtr buf,
406 unsigned int size);
Owen Taylor3473f882001-02-23 17:55:21 +0000407void xmlBufferFree (xmlBufferPtr buf);
408int xmlBufferDump (FILE *file,
409 xmlBufferPtr buf);
410void xmlBufferAdd (xmlBufferPtr buf,
411 const xmlChar *str,
412 int len);
413void xmlBufferAddHead (xmlBufferPtr buf,
414 const xmlChar *str,
415 int len);
416void xmlBufferCat (xmlBufferPtr buf,
417 const xmlChar *str);
418void xmlBufferCCat (xmlBufferPtr buf,
419 const char *str);
420int xmlBufferShrink (xmlBufferPtr buf,
421 unsigned int len);
422int xmlBufferGrow (xmlBufferPtr buf,
423 unsigned int len);
424void xmlBufferEmpty (xmlBufferPtr buf);
425const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
426int xmlBufferUse (const xmlBufferPtr buf);
427void xmlBufferSetAllocationScheme(xmlBufferPtr buf,
428 xmlBufferAllocationScheme scheme);
429int xmlBufferLength (const xmlBufferPtr buf);
430
431/*
432 * Creating/freeing new structures
433 */
434xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
435 const xmlChar *name,
436 const xmlChar *ExternalID,
437 const xmlChar *SystemID);
438xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
439 const xmlChar *name,
440 const xmlChar *ExternalID,
441 const xmlChar *SystemID);
442xmlDtdPtr xmlGetIntSubset (xmlDocPtr doc);
443void xmlFreeDtd (xmlDtdPtr cur);
444xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
445 const xmlChar *href,
446 const xmlChar *prefix);
447xmlNsPtr xmlNewNs (xmlNodePtr node,
448 const xmlChar *href,
449 const xmlChar *prefix);
450void xmlFreeNs (xmlNsPtr cur);
Daniel Veillard56a4cb82001-03-24 17:00:36 +0000451void xmlFreeNsList (xmlNsPtr cur);
Owen Taylor3473f882001-02-23 17:55:21 +0000452xmlDocPtr xmlNewDoc (const xmlChar *version);
453void xmlFreeDoc (xmlDocPtr cur);
454xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
455 const xmlChar *name,
456 const xmlChar *value);
457xmlAttrPtr xmlNewProp (xmlNodePtr node,
458 const xmlChar *name,
459 const xmlChar *value);
460xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
461 xmlNsPtr ns,
462 const xmlChar *name,
463 const xmlChar *value);
464void xmlFreePropList (xmlAttrPtr cur);
465void xmlFreeProp (xmlAttrPtr cur);
466xmlAttrPtr xmlCopyProp (xmlNodePtr target,
467 xmlAttrPtr cur);
468xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
469 xmlAttrPtr cur);
470xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
471xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
472 int recursive);
473
474/*
475 * Creating new nodes
476 */
477xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
478 xmlNsPtr ns,
479 const xmlChar *name,
480 const xmlChar *content);
481xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
482 xmlNsPtr ns,
483 const xmlChar *name,
484 const xmlChar *content);
485xmlNodePtr xmlNewNode (xmlNsPtr ns,
486 const xmlChar *name);
487xmlNodePtr xmlNewChild (xmlNodePtr parent,
488 xmlNsPtr ns,
489 const xmlChar *name,
490 const xmlChar *content);
491xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
492 xmlNsPtr ns,
493 const xmlChar *name,
494 const xmlChar *content);
495xmlNodePtr xmlNewDocText (xmlDocPtr doc,
496 const xmlChar *content);
497xmlNodePtr xmlNewText (const xmlChar *content);
498xmlNodePtr xmlNewPI (const xmlChar *name,
499 const xmlChar *content);
500xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
501 const xmlChar *content,
502 int len);
503xmlNodePtr xmlNewTextLen (const xmlChar *content,
504 int len);
505xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
506 const xmlChar *content);
507xmlNodePtr xmlNewComment (const xmlChar *content);
508xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
509 const xmlChar *content,
510 int len);
511xmlNodePtr xmlNewCharRef (xmlDocPtr doc,
512 const xmlChar *name);
513xmlNodePtr xmlNewReference (xmlDocPtr doc,
514 const xmlChar *name);
515xmlNodePtr xmlCopyNode (xmlNodePtr node,
516 int recursive);
Daniel Veillard82daa812001-04-12 08:55:36 +0000517xmlNodePtr xmlDocCopyNode (xmlNodePtr node,
518 xmlDocPtr doc,
519 int recursive);
Owen Taylor3473f882001-02-23 17:55:21 +0000520xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
521xmlNodePtr xmlNewDocFragment (xmlDocPtr doc);
522
523/*
524 * Navigating
525 */
526xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc);
527xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
528int xmlNodeIsText (xmlNodePtr node);
529int xmlIsBlankNode (xmlNodePtr node);
530
531/*
532 * Changing the structure
533 */
534xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc,
535 xmlNodePtr root);
536void xmlNodeSetName (xmlNodePtr cur,
537 const xmlChar *name);
538xmlNodePtr xmlAddChild (xmlNodePtr parent,
539 xmlNodePtr cur);
540xmlNodePtr xmlAddChildList (xmlNodePtr parent,
541 xmlNodePtr cur);
542xmlNodePtr xmlReplaceNode (xmlNodePtr old,
543 xmlNodePtr cur);
544xmlNodePtr xmlAddSibling (xmlNodePtr cur,
545 xmlNodePtr elem);
546xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur,
547 xmlNodePtr elem);
548xmlNodePtr xmlAddNextSibling (xmlNodePtr cur,
549 xmlNodePtr elem);
550void xmlUnlinkNode (xmlNodePtr cur);
551xmlNodePtr xmlTextMerge (xmlNodePtr first,
552 xmlNodePtr second);
553void xmlTextConcat (xmlNodePtr node,
554 const xmlChar *content,
555 int len);
556void xmlFreeNodeList (xmlNodePtr cur);
557void xmlFreeNode (xmlNodePtr cur);
558void xmlSetTreeDoc (xmlNodePtr tree,
559 xmlDocPtr doc);
560void xmlSetListDoc (xmlNodePtr list,
561 xmlDocPtr doc);
562
563/*
564 * Namespaces
565 */
566xmlNsPtr xmlSearchNs (xmlDocPtr doc,
567 xmlNodePtr node,
568 const xmlChar *nameSpace);
569xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
570 xmlNodePtr node,
571 const xmlChar *href);
572xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
573 xmlNodePtr node);
574void xmlSetNs (xmlNodePtr node,
575 xmlNsPtr ns);
576xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
577xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
578
579/*
580 * Changing the content.
581 */
582xmlAttrPtr xmlSetProp (xmlNodePtr node,
583 const xmlChar *name,
584 const xmlChar *value);
585xmlChar * xmlGetProp (xmlNodePtr node,
586 const xmlChar *name);
587xmlAttrPtr xmlHasProp (xmlNodePtr node,
588 const xmlChar *name);
589xmlAttrPtr xmlSetNsProp (xmlNodePtr node,
590 xmlNsPtr ns,
591 const xmlChar *name,
592 const xmlChar *value);
593xmlChar * xmlGetNsProp (xmlNodePtr node,
594 const xmlChar *name,
595 const xmlChar *nameSpace);
596xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
597 const xmlChar *value);
598xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
599 const xmlChar *value,
600 int len);
601xmlChar * xmlNodeListGetString (xmlDocPtr doc,
602 xmlNodePtr list,
603 int inLine);
604xmlChar * xmlNodeListGetRawString (xmlDocPtr doc,
605 xmlNodePtr list,
606 int inLine);
607void xmlNodeSetContent (xmlNodePtr cur,
608 const xmlChar *content);
609void xmlNodeSetContentLen (xmlNodePtr cur,
610 const xmlChar *content,
611 int len);
612void xmlNodeAddContent (xmlNodePtr cur,
613 const xmlChar *content);
614void xmlNodeAddContentLen (xmlNodePtr cur,
615 const xmlChar *content,
616 int len);
617xmlChar * xmlNodeGetContent (xmlNodePtr cur);
618xmlChar * xmlNodeGetLang (xmlNodePtr cur);
619void xmlNodeSetLang (xmlNodePtr cur,
620 const xmlChar *lang);
621int xmlNodeGetSpacePreserve (xmlNodePtr cur);
622void xmlNodeSetSpacePreserve (xmlNodePtr cur, int
623 val);
624xmlChar * xmlNodeGetBase (xmlDocPtr doc,
625 xmlNodePtr cur);
626void xmlNodeSetBase (xmlNodePtr cur,
627 xmlChar *uri);
628
629/*
630 * Removing content.
631 */
632int xmlRemoveProp (xmlAttrPtr attr);
633int xmlRemoveNode (xmlNodePtr node); /* TODO */
634
635/*
636 * Internal, don't use
637 */
638#ifdef VMS
639void xmlBufferWriteXmlCHAR (xmlBufferPtr buf,
640 const xmlChar *string);
641#define xmlBufferWriteCHAR xmlBufferWriteXmlCHAR
642#else
643void xmlBufferWriteCHAR (xmlBufferPtr buf,
644 const xmlChar *string);
645#endif
646void xmlBufferWriteChar (xmlBufferPtr buf,
647 const char *string);
648void xmlBufferWriteQuotedString(xmlBufferPtr buf,
649 const xmlChar *string);
650
651/*
652 * Namespace handling
653 */
654int xmlReconciliateNs (xmlDocPtr doc,
655 xmlNodePtr tree);
656
657/*
658 * Saving
659 */
660void xmlDocDumpFormatMemory (xmlDocPtr cur,
661 xmlChar**mem,
662 int *size,
663 int format);
664void xmlDocDumpMemory (xmlDocPtr cur,
665 xmlChar**mem,
666 int *size);
667void xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
668 xmlChar **doc_txt_ptr,
669 int * doc_txt_len,
670 const char *txt_encoding);
671void xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
672 xmlChar **doc_txt_ptr,
673 int * doc_txt_len,
674 const char *txt_encoding,
675 int format);
676int xmlDocDump (FILE *f,
677 xmlDocPtr cur);
678void xmlElemDump (FILE *f,
679 xmlDocPtr doc,
680 xmlNodePtr cur);
681int xmlSaveFile (const char *filename,
682 xmlDocPtr cur);
Daniel Veillard67fee942001-04-26 18:59:03 +0000683int xmlSaveFormatFile (const char *filename,
684 xmlDocPtr cur,
685 int format);
Owen Taylor3473f882001-02-23 17:55:21 +0000686void xmlNodeDump (xmlBufferPtr buf,
687 xmlDocPtr doc,
688 xmlNodePtr cur,
689 int level,
690 int format);
691
Daniel Veillardeefd4492001-04-28 16:55:50 +0000692/* These are exported from xmlIO.h
Owen Taylor3473f882001-02-23 17:55:21 +0000693
694int xmlSaveFileTo (xmlOutputBuffer *buf,
695 xmlDocPtr cur,
696 const char *encoding);
Daniel Veillardeefd4492001-04-28 16:55:50 +0000697int xmlSaveFormatFileTo (xmlOutputBuffer *buf,
698 xmlDocPtr cur,
699 const char *encoding,
700 int format);
Owen Taylor3473f882001-02-23 17:55:21 +0000701 */
702
703int xmlSaveFileEnc (const char *filename,
704 xmlDocPtr cur,
705 const char *encoding);
706
707/*
708 * Compression
709 */
710int xmlGetDocCompressMode (xmlDocPtr doc);
711void xmlSetDocCompressMode (xmlDocPtr doc,
712 int mode);
713int xmlGetCompressMode (void);
714void xmlSetCompressMode (int mode);
715
716#ifdef __cplusplus
717}
718#endif
719
720#endif /* __XML_TREE_H__ */
721