Revert directory structure changes
diff --git a/include/libxml/HTMLparser.h b/include/libxml/HTMLparser.h
new file mode 100644
index 0000000..c79ad09
--- /dev/null
+++ b/include/libxml/HTMLparser.h
@@ -0,0 +1,115 @@
+/*
+ * HTMLparser.h : inf=terface for an HTML 4.0 non-verifying parser
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __HTML_PARSER_H__
+#define __HTML_PARSER_H__
+#include <libxml/parser.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Most of the back-end structures from XML and HTML are shared
+ */
+typedef xmlParserCtxt htmlParserCtxt;
+typedef xmlParserCtxtPtr htmlParserCtxtPtr;
+typedef xmlParserNodeInfo htmlParserNodeInfo;
+typedef xmlSAXHandler htmlSAXHandler;
+typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
+typedef xmlParserInput htmlParserInput;
+typedef xmlParserInputPtr htmlParserInputPtr;
+typedef xmlDocPtr htmlDocPtr;
+typedef xmlNodePtr htmlNodePtr;
+
+/*
+ * Internal description of an HTML element
+ */
+typedef struct _htmlElemDesc htmlElemDesc;
+typedef htmlElemDesc *htmlElemDescPtr;
+struct _htmlElemDesc {
+ const char *name; /* The tag name */
+ char startTag; /* Whether the start tag can be implied */
+ char endTag; /* Whether the end tag can be implied */
+ char saveEndTag; /* Whether the end tag should be saved */
+ char empty; /* Is this an empty element ? */
+ char depr; /* Is this a deprecated element ? */
+ char dtd; /* 1: only in Loose DTD, 2: only Frameset one */
+ const char *desc; /* the description */
+};
+
+/*
+ * Internal description of an HTML entity
+ */
+typedef struct _htmlEntityDesc htmlEntityDesc;
+typedef htmlEntityDesc *htmlEntityDescPtr;
+struct _htmlEntityDesc {
+ int value; /* the UNICODE value for the character */
+ const char *name; /* The entity name */
+ const char *desc; /* the description */
+};
+
+/*
+ * There is only few public functions.
+ */
+htmlElemDescPtr htmlTagLookup (const xmlChar *tag);
+htmlEntityDescPtr htmlEntityLookup(const xmlChar *name);
+htmlEntityDescPtr htmlEntityValueLookup(int value);
+
+int htmlIsAutoClosed(htmlDocPtr doc,
+ htmlNodePtr elem);
+int htmlAutoCloseTag(htmlDocPtr doc,
+ const xmlChar *name,
+ htmlNodePtr elem);
+htmlEntityDescPtr htmlParseEntityRef(htmlParserCtxtPtr ctxt,
+ xmlChar **str);
+int htmlParseCharRef(htmlParserCtxtPtr ctxt);
+void htmlParseElement(htmlParserCtxtPtr ctxt);
+
+htmlDocPtr htmlSAXParseDoc (xmlChar *cur,
+ const char *encoding,
+ htmlSAXHandlerPtr sax,
+ void *userData);
+htmlDocPtr htmlParseDoc (xmlChar *cur,
+ const char *encoding);
+htmlDocPtr htmlSAXParseFile(const char *filename,
+ const char *encoding,
+ htmlSAXHandlerPtr sax,
+ void *userData);
+htmlDocPtr htmlParseFile (const char *filename,
+ const char *encoding);
+int UTF8ToHtml (unsigned char* out,
+ int *outlen,
+ const unsigned char* in,
+ int *inlen);
+int htmlEncodeEntities(unsigned char* out,
+ int *outlen,
+ const unsigned char* in,
+ int *inlen, int quoteChar);
+int htmlIsScriptAttribute(const xmlChar *name);
+int htmlHandleOmittedElem(int val);
+
+/**
+ * Interfaces for the Push mode
+ */
+void htmlFreeParserCtxt (htmlParserCtxtPtr ctxt);
+htmlParserCtxtPtr htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
+ void *user_data,
+ const char *chunk,
+ int size,
+ const char *filename,
+ xmlCharEncoding enc);
+int htmlParseChunk (htmlParserCtxtPtr ctxt,
+ const char *chunk,
+ int size,
+ int terminate);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HTML_PARSER_H__ */
diff --git a/include/libxml/HTMLtree.h b/include/libxml/HTMLtree.h
new file mode 100644
index 0000000..543d693
--- /dev/null
+++ b/include/libxml/HTMLtree.h
@@ -0,0 +1,61 @@
+/*
+ * tree.h : describes the structures found in an tree resulting
+ * from an XML parsing.
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __HTML_TREE_H__
+#define __HTML_TREE_H__
+
+#include <stdio.h>
+#include <libxml/tree.h>
+#include <libxml/HTMLparser.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define HTML_TEXT_NODE XML_TEXT_NODE
+#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE
+#define HTML_COMMENT_NODE XML_COMMENT_NODE
+#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE
+
+htmlDocPtr htmlNewDoc (const xmlChar *URI,
+ const xmlChar *ExternalID);
+htmlDocPtr htmlNewDocNoDtD (const xmlChar *URI,
+ const xmlChar *ExternalID);
+const xmlChar * htmlGetMetaEncoding (htmlDocPtr doc);
+int htmlSetMetaEncoding (htmlDocPtr doc,
+ const xmlChar *encoding);
+void htmlDocDumpMemory (xmlDocPtr cur,
+ xmlChar**mem,
+ int *size);
+int htmlDocDump (FILE *f,
+ xmlDocPtr cur);
+int htmlSaveFile (const char *filename,
+ xmlDocPtr cur);
+void htmlNodeDump (xmlBufferPtr buf,
+ xmlDocPtr doc,
+ xmlNodePtr cur);
+void htmlNodeDumpFile (FILE *out,
+ xmlDocPtr doc,
+ xmlNodePtr cur);
+int htmlSaveFileEnc (const char *filename,
+ xmlDocPtr cur,
+ const char *encoding);
+
+/* This one is imported from xmlIO.h
+void htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
+ xmlDocPtr cur,
+ const char *encoding);
+ */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __HTML_TREE_H__ */
+
diff --git a/include/libxml/SAX.h b/include/libxml/SAX.h
new file mode 100644
index 0000000..4fabbdf
--- /dev/null
+++ b/include/libxml/SAX.h
@@ -0,0 +1,120 @@
+/*
+ * SAX.h : Default SAX handler interfaces.
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel Veillard <Daniel.Veillard@w3.org>
+ */
+
+
+#ifndef __XML_SAX_H__
+#define __XML_SAX_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <libxml/parser.h>
+#include <libxml/xlink.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+const xmlChar * getPublicId (void *ctx);
+const xmlChar * getSystemId (void *ctx);
+void setDocumentLocator (void *ctx,
+ xmlSAXLocatorPtr loc);
+
+int getLineNumber (void *ctx);
+int getColumnNumber (void *ctx);
+
+int isStandalone (void *ctx);
+int hasInternalSubset (void *ctx);
+int hasExternalSubset (void *ctx);
+
+void internalSubset (void *ctx,
+ const xmlChar *name,
+ const xmlChar *ExternalID,
+ const xmlChar *SystemID);
+void externalSubset (void *ctx,
+ const xmlChar *name,
+ const xmlChar *ExternalID,
+ const xmlChar *SystemID);
+xmlEntityPtr getEntity (void *ctx,
+ const xmlChar *name);
+xmlEntityPtr getParameterEntity (void *ctx,
+ const xmlChar *name);
+xmlParserInputPtr resolveEntity (void *ctx,
+ const xmlChar *publicId,
+ const xmlChar *systemId);
+
+void entityDecl (void *ctx,
+ const xmlChar *name,
+ int type,
+ const xmlChar *publicId,
+ const xmlChar *systemId,
+ xmlChar *content);
+void attributeDecl (void *ctx,
+ const xmlChar *elem,
+ const xmlChar *name,
+ int type,
+ int def,
+ const xmlChar *defaultValue,
+ xmlEnumerationPtr tree);
+void elementDecl (void *ctx,
+ const xmlChar *name,
+ int type,
+ xmlElementContentPtr content);
+void notationDecl (void *ctx,
+ const xmlChar *name,
+ const xmlChar *publicId,
+ const xmlChar *systemId);
+void unparsedEntityDecl (void *ctx,
+ const xmlChar *name,
+ const xmlChar *publicId,
+ const xmlChar *systemId,
+ const xmlChar *notationName);
+
+void startDocument (void *ctx);
+void endDocument (void *ctx);
+void attribute (void *ctx,
+ const xmlChar *fullname,
+ const xmlChar *value);
+void startElement (void *ctx,
+ const xmlChar *fullname,
+ const xmlChar **atts);
+void endElement (void *ctx,
+ const xmlChar *name);
+void reference (void *ctx,
+ const xmlChar *name);
+void characters (void *ctx,
+ const xmlChar *ch,
+ int len);
+void ignorableWhitespace (void *ctx,
+ const xmlChar *ch,
+ int len);
+void processingInstruction (void *ctx,
+ const xmlChar *target,
+ const xmlChar *data);
+void globalNamespace (void *ctx,
+ const xmlChar *href,
+ const xmlChar *prefix);
+void setNamespace (void *ctx,
+ const xmlChar *name);
+xmlNsPtr getNamespace (void *ctx);
+int checkNamespace (void *ctx,
+ xmlChar *nameSpace);
+void namespaceDecl (void *ctx,
+ const xmlChar *href,
+ const xmlChar *prefix);
+void comment (void *ctx,
+ const xmlChar *value);
+void cdataBlock (void *ctx,
+ const xmlChar *value,
+ int len);
+
+void xmlDefaultSAXHandlerInit (void);
+void htmlDefaultSAXHandlerInit (void);
+void sgmlDefaultSAXHandlerInit (void);
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_SAX_H__ */
diff --git a/include/libxml/debugXML.h b/include/libxml/debugXML.h
new file mode 100644
index 0000000..4a55fa8
--- /dev/null
+++ b/include/libxml/debugXML.h
@@ -0,0 +1,113 @@
+/*
+ * debugXML.h : Interfaces to a set of routines used for debugging the tree
+ * produced by the XML parser.
+ *
+ * Daniel Veillard <Daniel.Veillard@w3.org>
+ */
+
+#ifndef __DEBUG_XML__
+#define __DEBUG_XML__
+#include <stdio.h>
+#include <libxml/tree.h>
+
+#ifdef LIBXML_DEBUG_ENABLED
+
+#include <libxml/xpath.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The standard Dump routines
+ */
+void xmlDebugDumpString (FILE *output,
+ const xmlChar *str);
+void xmlDebugDumpAttr (FILE *output,
+ xmlAttrPtr attr,
+ int depth);
+void xmlDebugDumpAttrList (FILE *output,
+ xmlAttrPtr attr,
+ int depth);
+void xmlDebugDumpOneNode (FILE *output,
+ xmlNodePtr node,
+ int depth);
+void xmlDebugDumpNode (FILE *output,
+ xmlNodePtr node,
+ int depth);
+void xmlDebugDumpNodeList (FILE *output,
+ xmlNodePtr node,
+ int depth);
+void xmlDebugDumpDocumentHead(FILE *output,
+ xmlDocPtr doc);
+void xmlDebugDumpDocument (FILE *output,
+ xmlDocPtr doc);
+void xmlDebugDumpDTD (FILE *output,
+ xmlDtdPtr doc);
+void xmlDebugDumpEntities (FILE *output,
+ xmlDocPtr doc);
+void xmlLsOneNode (FILE *output,
+ xmlNodePtr node);
+
+/****************************************************************
+ * *
+ * The XML shell related structures and functions *
+ * *
+ ****************************************************************/
+
+/**
+ * xmlShellReadlineFunc:
+ * @prompt: a string prompt
+ *
+ * This is a generic signature for the XML shell input function
+ *
+ * Returns a string which will be freed by the Shell
+ */
+typedef char * (* xmlShellReadlineFunc)(char *prompt);
+
+/*
+ * The shell context itself
+ * TODO: add the defined function tables.
+ */
+typedef struct _xmlShellCtxt xmlShellCtxt;
+typedef xmlShellCtxt *xmlShellCtxtPtr;
+struct _xmlShellCtxt {
+ char *filename;
+ xmlDocPtr doc;
+ xmlNodePtr node;
+ xmlXPathContextPtr pctxt;
+ int loaded;
+ FILE *output;
+ xmlShellReadlineFunc input;
+};
+
+/**
+ * xmlShellCmd:
+ * @ctxt: a shell context
+ * @arg: a string argument
+ * @node: a first node
+ * @node2: a second node
+ *
+ * This is a generic signature for the XML shell functions
+ *
+ * Returns an int, negative returns indicating errors
+ */
+typedef int (* xmlShellCmd) (xmlShellCtxtPtr ctxt,
+ char *arg,
+ xmlNodePtr node,
+ xmlNodePtr node2);
+
+/*
+ * The Shell interface.
+ */
+void xmlShell (xmlDocPtr doc,
+ char *filename,
+ xmlShellReadlineFunc input,
+ FILE *output);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* LIBXML_DEBUG_ENABLED */
+#endif /* __DEBUG_XML__ */
diff --git a/include/libxml/encoding.h b/include/libxml/encoding.h
new file mode 100644
index 0000000..62e81e3
--- /dev/null
+++ b/include/libxml/encoding.h
@@ -0,0 +1,187 @@
+/*
+ * encoding.h : interface for the encoding conversion functions needed for
+ * XML
+ *
+ * Related specs:
+ * rfc2044 (UTF-8 and UTF-16) F. Yergeau Alis Technologies
+ * [ISO-10646] UTF-8 and UTF-16 in Annexes
+ * [ISO-8859-1] ISO Latin-1 characters codes.
+ * [UNICODE] The Unicode Consortium, "The Unicode Standard --
+ * Worldwide Character Encoding -- Version 1.0", Addison-
+ * Wesley, Volume 1, 1991, Volume 2, 1992. UTF-8 is
+ * described in Unicode Technical Report #4.
+ * [US-ASCII] Coded Character Set--7-bit American Standard Code for
+ * Information Interchange, ANSI X3.4-1986.
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __XML_CHAR_ENCODING_H__
+#define __XML_CHAR_ENCODING_H__
+
+#include <libxml/xmlversion.h>
+#ifdef LIBXML_ICONV_ENABLED
+#include <iconv.h>
+#endif
+#include <libxml/tree.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Predefined values for some standard encodings
+ * Libxml don't do beforehand translation on UTF8, ISOLatinX
+ * It also support UTF16 (LE and BE) by default.
+ *
+ * Anything else would have to be translated to UTF8 before being
+ * given to the parser itself. The BOM for UTF16 and the encoding
+ * declaration are looked at and a converter is looked for at that
+ * point. If not found the parser stops here as asked by the XML REC
+ * Converter can be registered by the user using xmlRegisterCharEncodingHandler
+ * but the currentl form doesn't allow stateful transcoding (a serious
+ * problem agreed !). If iconv has been found it will be used
+ * automatically and allow stateful transcoding, the simplest is then
+ * to be sure to enable icon and to provide iconv libs for the encoding
+ * support needed.
+ */
+typedef enum {
+ XML_CHAR_ENCODING_ERROR= -1, /* No char encoding detected */
+ XML_CHAR_ENCODING_NONE= 0, /* No char encoding detected */
+ XML_CHAR_ENCODING_UTF8= 1, /* UTF-8 */
+ XML_CHAR_ENCODING_UTF16LE= 2, /* UTF-16 little endian */
+ XML_CHAR_ENCODING_UTF16BE= 3, /* UTF-16 big endian */
+ XML_CHAR_ENCODING_UCS4LE= 4, /* UCS-4 little endian */
+ XML_CHAR_ENCODING_UCS4BE= 5, /* UCS-4 big endian */
+ XML_CHAR_ENCODING_EBCDIC= 6, /* EBCDIC uh! */
+ XML_CHAR_ENCODING_UCS4_2143=7, /* UCS-4 unusual ordering */
+ XML_CHAR_ENCODING_UCS4_3412=8, /* UCS-4 unusual ordering */
+ XML_CHAR_ENCODING_UCS2= 9, /* UCS-2 */
+ XML_CHAR_ENCODING_8859_1= 10,/* ISO-8859-1 ISO Latin 1 */
+ XML_CHAR_ENCODING_8859_2= 11,/* ISO-8859-2 ISO Latin 2 */
+ XML_CHAR_ENCODING_8859_3= 12,/* ISO-8859-3 */
+ XML_CHAR_ENCODING_8859_4= 13,/* ISO-8859-4 */
+ XML_CHAR_ENCODING_8859_5= 14,/* ISO-8859-5 */
+ XML_CHAR_ENCODING_8859_6= 15,/* ISO-8859-6 */
+ XML_CHAR_ENCODING_8859_7= 16,/* ISO-8859-7 */
+ XML_CHAR_ENCODING_8859_8= 17,/* ISO-8859-8 */
+ XML_CHAR_ENCODING_8859_9= 18,/* ISO-8859-9 */
+ XML_CHAR_ENCODING_2022_JP= 19,/* ISO-2022-JP */
+ XML_CHAR_ENCODING_SHIFT_JIS=20,/* Shift_JIS */
+ XML_CHAR_ENCODING_EUC_JP= 21,/* EUC-JP */
+ XML_CHAR_ENCODING_ASCII= 22 /* pure ASCII */
+} xmlCharEncoding;
+
+/**
+ * xmlCharEncodingInputFunc:
+ * @out: a pointer ot an array of bytes to store the UTF-8 result
+ * @outlen: the lenght of @out
+ * @in: a pointer ot an array of chars in the original encoding
+ * @inlen: the lenght of @in
+ *
+ * Take a block of chars in the original encoding and try to convert
+ * it to an UTF-8 block of chars out.
+ *
+ * Returns the number of byte written, or -1 by lack of space, or -2
+ * if the transcoding failed.
+ * The value of @inlen after return is the number of octets consumed
+ * as the return value is positive, else unpredictiable.
+ * The value of @outlen after return is the number of ocetes consumed.
+ */
+typedef int (* xmlCharEncodingInputFunc)(unsigned char* out, int *outlen,
+ const unsigned char* in, int *inlen);
+
+
+/**
+ * xmlCharEncodingOutputFunc:
+ * @out: a pointer ot an array of bytes to store the result
+ * @outlen: the lenght of @out
+ * @in: a pointer ot an array of UTF-8 chars
+ * @inlen: the lenght of @in
+ *
+ * Take a block of UTF-8 chars in and try to convert it to an other
+ * encoding.
+ * Note: a first call designed to produce heading info is called with
+ * in = NULL. If stateful this should also initialize the encoder state
+ *
+ * Returns the number of byte written, or -1 by lack of space, or -2
+ * if the transcoding failed.
+ * The value of @inlen after return is the number of octets consumed
+ * as the return value is positive, else unpredictiable.
+ * The value of @outlen after return is the number of ocetes consumed.
+ */
+typedef int (* xmlCharEncodingOutputFunc)(unsigned char* out, int *outlen,
+ const unsigned char* in, int *inlen);
+
+
+/*
+ * Block defining the handlers for non UTF-8 encodings.
+ * If iconv is supported, there is two extra fields
+ */
+
+typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
+typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
+struct _xmlCharEncodingHandler {
+ char *name;
+ xmlCharEncodingInputFunc input;
+ xmlCharEncodingOutputFunc output;
+#ifdef LIBXML_ICONV_ENABLED
+ iconv_t iconv_in;
+ iconv_t iconv_out;
+#endif /* LIBXML_ICONV_ENABLED */
+};
+
+/*
+ * Interfaces for encoding handlers
+ */
+void xmlInitCharEncodingHandlers (void);
+void xmlCleanupCharEncodingHandlers (void);
+void xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler);
+xmlCharEncodingHandlerPtr
+ xmlGetCharEncodingHandler (xmlCharEncoding enc);
+xmlCharEncodingHandlerPtr
+ xmlFindCharEncodingHandler (const char *name);
+
+
+/*
+ * Interfaces for encoding names and aliases
+ */
+int xmlAddEncodingAlias (const char *name,
+ const char *alias);
+int xmlDelEncodingAlias (const char *alias);
+const char *
+ xmlGetEncodingAlias (const char *alias);
+void xmlCleanupEncodingAliases (void);
+xmlCharEncoding
+ xmlParseCharEncoding (const char* name);
+const char*
+ xmlGetCharEncodingName (xmlCharEncoding enc);
+
+/*
+ * Interfaces directly used by the parsers.
+ */
+xmlCharEncoding
+ xmlDetectCharEncoding (const unsigned char* in,
+ int len);
+
+int xmlCheckUTF8 (const unsigned char *utf);
+
+int xmlCharEncOutFunc (xmlCharEncodingHandler *handler,
+ xmlBufferPtr out,
+ xmlBufferPtr in);
+
+int xmlCharEncInFunc (xmlCharEncodingHandler *handler,
+ xmlBufferPtr out,
+ xmlBufferPtr in);
+int xmlCharEncFirstLine (xmlCharEncodingHandler *handler,
+ xmlBufferPtr out,
+ xmlBufferPtr in);
+int xmlCharEncCloseFunc (xmlCharEncodingHandler *handler);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_CHAR_ENCODING_H__ */
diff --git a/include/libxml/entities.h b/include/libxml/entities.h
new file mode 100644
index 0000000..305d043
--- /dev/null
+++ b/include/libxml/entities.h
@@ -0,0 +1,114 @@
+/*
+ * entities.h : interface for the XML entities handking
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __XML_ENTITIES_H__
+#define __XML_ENTITIES_H__
+
+#include <libxml/tree.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The different valid entity types
+ */
+typedef enum {
+ XML_INTERNAL_GENERAL_ENTITY = 1,
+ XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
+ XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
+ XML_INTERNAL_PARAMETER_ENTITY = 4,
+ XML_EXTERNAL_PARAMETER_ENTITY = 5,
+ XML_INTERNAL_PREDEFINED_ENTITY = 6
+} xmlEntityType;
+
+/*
+ * An unit of storage for an entity, contains the string, the value
+ * and the linkind data needed for the linking in the hash table.
+ */
+
+typedef struct _xmlEntity xmlEntity;
+typedef xmlEntity *xmlEntityPtr;
+struct _xmlEntity {
+#ifndef XML_WITHOUT_CORBA
+ void *_private; /* for Corba, must be first ! */
+#endif
+ xmlElementType type; /* XML_ENTITY_DECL, must be second ! */
+ const xmlChar *name; /* Attribute name */
+ struct _xmlNode *children; /* NULL */
+ struct _xmlNode *last; /* NULL */
+ struct _xmlDtd *parent; /* -> DTD */
+ struct _xmlNode *next; /* next sibling link */
+ struct _xmlNode *prev; /* previous sibling link */
+ struct _xmlDoc *doc; /* the containing document */
+
+ xmlChar *orig; /* content without ref substitution */
+ xmlChar *content; /* content or ndata if unparsed */
+ int length; /* the content length */
+ xmlEntityType etype; /* The entity type */
+ const xmlChar *ExternalID; /* External identifier for PUBLIC */
+ const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC Entity */
+
+ struct _xmlEntity *nexte; /* unused */
+ const xmlChar *URI; /* the full URI as computed */
+};
+
+/*
+ * ALl entities are stored in an hash table
+ * there is 2 separate hash tables for global and parmeter entities
+ */
+
+typedef struct _xmlHashTable xmlEntitiesTable;
+typedef xmlEntitiesTable *xmlEntitiesTablePtr;
+
+/*
+ * External functions :
+ */
+
+void xmlInitializePredefinedEntities (void);
+xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc,
+ const xmlChar *name,
+ int type,
+ const xmlChar *ExternalID,
+ const xmlChar *SystemID,
+ const xmlChar *content);
+xmlEntityPtr xmlAddDtdEntity (xmlDocPtr doc,
+ const xmlChar *name,
+ int type,
+ const xmlChar *ExternalID,
+ const xmlChar *SystemID,
+ const xmlChar *content);
+xmlEntityPtr xmlGetPredefinedEntity (const xmlChar *name);
+xmlEntityPtr xmlGetDocEntity (xmlDocPtr doc,
+ const xmlChar *name);
+xmlEntityPtr xmlGetDtdEntity (xmlDocPtr doc,
+ const xmlChar *name);
+xmlEntityPtr xmlGetParameterEntity (xmlDocPtr doc,
+ const xmlChar *name);
+const xmlChar * xmlEncodeEntities (xmlDocPtr doc,
+ const xmlChar *input);
+xmlChar * xmlEncodeEntitiesReentrant(xmlDocPtr doc,
+ const xmlChar *input);
+xmlChar * xmlEncodeSpecialChars (xmlDocPtr doc,
+ const xmlChar *input);
+xmlEntitiesTablePtr xmlCreateEntitiesTable (void);
+xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
+void xmlFreeEntitiesTable (xmlEntitiesTablePtr table);
+void xmlDumpEntitiesTable (xmlBufferPtr buf,
+ xmlEntitiesTablePtr table);
+void xmlDumpEntityDecl (xmlBufferPtr buf,
+ xmlEntityPtr ent);
+xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table);
+void xmlCleanupPredefinedEntities(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+# endif /* __XML_ENTITIES_H__ */
diff --git a/include/libxml/hash.h b/include/libxml/hash.h
new file mode 100644
index 0000000..c88fffd
--- /dev/null
+++ b/include/libxml/hash.h
@@ -0,0 +1,129 @@
+/*
+ * hash.c: chained hash tables
+ *
+ * Copyright (C) 2000 Bjorn Reese and Daniel Veillard.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
+ * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
+ *
+ * Author: bjorn.reese@systematic.dk
+ */
+
+#ifndef __XML_HASH_H__
+#define __XML_HASH_H__
+
+#include <libxml/parser.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The hash table
+ */
+typedef struct _xmlHashTable xmlHashTable;
+typedef xmlHashTable *xmlHashTablePtr;
+
+/*
+ * function types:
+ */
+typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name);
+typedef void *(*xmlHashCopier)(void *payload, xmlChar *name);
+typedef void *(*xmlHashScanner)(void *payload, void *data, xmlChar *name);
+
+/*
+ * Constructor and destructor
+ */
+xmlHashTablePtr xmlHashCreate (int size);
+void xmlHashFree (xmlHashTablePtr table,
+ xmlHashDeallocator f);
+
+/*
+ * Add a new entry to the hash table
+ */
+int xmlHashAddEntry (xmlHashTablePtr table,
+ const xmlChar *name,
+ void *userdata);
+int xmlHashUpdateEntry(xmlHashTablePtr table,
+ const xmlChar *name,
+ void *userdata,
+ xmlHashDeallocator f);
+int xmlHashAddEntry2(xmlHashTablePtr table,
+ const xmlChar *name,
+ const xmlChar *name2,
+ void *userdata);
+int xmlHashUpdateEntry2(xmlHashTablePtr table,
+ const xmlChar *name,
+ const xmlChar *name2,
+ void *userdata,
+ xmlHashDeallocator f);
+int xmlHashAddEntry3(xmlHashTablePtr table,
+ const xmlChar *name,
+ const xmlChar *name2,
+ const xmlChar *name3,
+ void *userdata);
+int xmlHashUpdateEntry3(xmlHashTablePtr table,
+ const xmlChar *name,
+ const xmlChar *name2,
+ const xmlChar *name3,
+ void *userdata,
+ xmlHashDeallocator f);
+
+/*
+ * Remove an entry from the hash table
+ */
+int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name,
+ xmlHashDeallocator f);
+int xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name,
+ const xmlChar *name2, xmlHashDeallocator f);
+int xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name,
+ const xmlChar *name2, const xmlChar *name3,
+ xmlHashDeallocator f);
+
+/*
+ * Retrieve the userdata
+ */
+void * xmlHashLookup (xmlHashTablePtr table,
+ const xmlChar *name);
+void * xmlHashLookup2 (xmlHashTablePtr table,
+ const xmlChar *name,
+ const xmlChar *name2);
+void * xmlHashLookup3 (xmlHashTablePtr table,
+ const xmlChar *name,
+ const xmlChar *name2,
+ const xmlChar *name3);
+
+/*
+ * Helpers
+ */
+xmlHashTablePtr xmlHashCopy (xmlHashTablePtr table,
+ xmlHashCopier f);
+int xmlHashSize (xmlHashTablePtr);
+void xmlHashScan (xmlHashTablePtr table,
+ xmlHashScanner f,
+ void *data);
+void xmlHashScan1 (xmlHashTablePtr table,
+ const xmlChar *name,
+ xmlHashScanner f,
+ void *data);
+void xmlHashScan2 (xmlHashTablePtr table,
+ const xmlChar *name,
+ const xmlChar *name2,
+ xmlHashScanner f,
+ void *data);
+void xmlHashScan3 (xmlHashTablePtr table,
+ const xmlChar *name,
+ const xmlChar *name2,
+ const xmlChar *name3,
+ xmlHashScanner f,
+ void *data);
+#ifdef __cplusplus
+}
+#endif
+#endif /* ! __XML_HASH_H__ */
diff --git a/include/libxml/list.h b/include/libxml/list.h
new file mode 100644
index 0000000..a708ef2
--- /dev/null
+++ b/include/libxml/list.h
@@ -0,0 +1,81 @@
+/*
+ * list.h: lists interfaces
+ *
+ * Copyright (C) 2000 Gary Pennington and Daniel Veillard.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+ * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND
+ * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER.
+ *
+ * Author: Gary.Pennington@uk.sun.com
+ */
+
+typedef struct _xmlLink xmlLink;
+typedef xmlLink *xmlLinkPtr;
+
+typedef struct _xmlList xmlList;
+typedef xmlList *xmlListPtr;
+
+typedef void (*xmlListDeallocator) (xmlLinkPtr lk);
+typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
+typedef int (*xmlListWalker) (const void *data, const void *user);
+
+/* Creation/Deletion */
+xmlListPtr xmlListCreate (xmlListDeallocator deallocator,
+ xmlListDataCompare compare);
+void xmlListDelete (xmlListPtr l);
+
+/* Basic Operators */
+void * xmlListSearch (xmlListPtr l,
+ void *data);
+void * xmlListReverseSearch (xmlListPtr l,
+ void *data);
+int xmlListInsert (xmlListPtr l,
+ void *data) ;
+int xmlListAppend (xmlListPtr l,
+ void *data) ;
+int xmlListRemoveFirst (xmlListPtr l,
+ void *data);
+int xmlListRemoveLast (xmlListPtr l,
+ void *data);
+int xmlListRemoveAll (xmlListPtr l,
+ void *data);
+void xmlListClear (xmlListPtr l);
+int xmlListEmpty (xmlListPtr l);
+xmlLinkPtr xmlListFront (xmlListPtr l);
+xmlLinkPtr xmlListEnd (xmlListPtr l);
+int xmlListSize (xmlListPtr l);
+
+void xmlListPopFront (xmlListPtr l);
+void xmlListPopBack (xmlListPtr l);
+int xmlListPushFront (xmlListPtr l,
+ void *data);
+int xmlListPushBack (xmlListPtr l,
+ void *data);
+
+/* Advanced Operators */
+void xmlListReverse (xmlListPtr l);
+void xmlListSort (xmlListPtr l);
+void xmlListWalk (xmlListPtr l,
+ xmlListWalker walker,
+ const void *user);
+void xmlListReverseWalk (xmlListPtr l,
+ xmlListWalker walker,
+ const void *user);
+void xmlListMerge (xmlListPtr l1,
+ xmlListPtr l2);
+xmlListPtr xmlListDup (const xmlListPtr old);
+int xmlListCopy (xmlListPtr cur,
+ const xmlListPtr old);
+/* Link operators */
+void * xmlLinkGetData (xmlLinkPtr lk);
+
+/* xmlListUnique() */
+/* xmlListSwap */
+
+
diff --git a/include/libxml/nanoftp.h b/include/libxml/nanoftp.h
new file mode 100644
index 0000000..5346528
--- /dev/null
+++ b/include/libxml/nanoftp.h
@@ -0,0 +1,110 @@
+/*
+ * nanohttp.c: minimalist FTP implementation to fetch external subsets.
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __NANO_FTP_H__
+#define __NANO_FTP_H__
+
+#include <libxml/xmlversion.h>
+#ifdef LIBXML_FTP_ENABLED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * ftpListCallback:
+ * @userData: user provided data for the callback
+ * @filename: the file name (including "->" when links are shown)
+ * @attrib: the attribute string
+ * @owner: the owner string
+ * @group: the group string
+ * @size: the file size
+ * @links: the link count
+ * @year: the year
+ * @month: the month
+ * @day: the day
+ * @hour: the hour
+ * @minute: the minute
+ *
+ * A callback for the xmlNanoFTPList command
+ * Note that only one of year and day:minute are specified
+ */
+typedef void (*ftpListCallback) (void *userData,
+ const char *filename, const char* attrib,
+ const char *owner, const char *group,
+ unsigned long size, int links, int year,
+ const char *month, int day, int hour,
+ int minute);
+/**
+ * ftpDataCallback:
+ * A callback for the xmlNanoFTPGet command
+ */
+typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
+
+/*
+ * Init
+ */
+void xmlNanoFTPInit (void);
+void xmlNanoFTPCleanup (void);
+
+/*
+ * Creating/freeing contexts
+ */
+void * xmlNanoFTPNewCtxt (const char *URL);
+void xmlNanoFTPFreeCtxt (void * ctx);
+void * xmlNanoFTPConnectTo (const char *server,
+ int port);
+/*
+ * Opening/closing session connections
+ */
+void * xmlNanoFTPOpen (const char *URL);
+int xmlNanoFTPConnect (void *ctx);
+int xmlNanoFTPClose (void *ctx);
+int xmlNanoFTPQuit (void *ctx);
+void xmlNanoFTPScanProxy (const char *URL);
+void xmlNanoFTPProxy (const char *host,
+ int port,
+ const char *user,
+ const char *passwd,
+ int type);
+int xmlNanoFTPUpdateURL (void *ctx,
+ const char *URL);
+
+/*
+ * Rathern internal commands
+ */
+int xmlNanoFTPGetResponse (void *ctx);
+int xmlNanoFTPCheckResponse (void *ctx);
+
+/*
+ * CD/DIR/GET handlers
+ */
+int xmlNanoFTPCwd (void *ctx,
+ char *directory);
+
+int xmlNanoFTPGetConnection (void *ctx);
+int xmlNanoFTPCloseConnection(void *ctx);
+int xmlNanoFTPList (void *ctx,
+ ftpListCallback callback,
+ void *userData,
+ char *filename);
+int xmlNanoFTPGetSocket (void *ctx,
+ const char *filename);
+int xmlNanoFTPGet (void *ctx,
+ ftpDataCallback callback,
+ void *userData,
+ const char *filename);
+int xmlNanoFTPRead (void *ctx,
+ void *dest,
+ int len);
+
+#ifdef __cplusplus
+}
+#endif /* LIBXML_FTP_ENABLED */
+#endif
+#endif /* __NANO_FTP_H__ */
diff --git a/include/libxml/nanohttp.h b/include/libxml/nanohttp.h
new file mode 100644
index 0000000..78d1c44
--- /dev/null
+++ b/include/libxml/nanohttp.h
@@ -0,0 +1,44 @@
+/*
+ * nanohttp.c: minimalist HTTP implementation to fetch external subsets.
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __NANO_HTTP_H__
+#define __NANO_HTTP_H__
+
+#include <libxml/xmlversion.h>
+#ifdef LIBXML_HTTP_ENABLED
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void xmlNanoHTTPInit (void);
+void xmlNanoHTTPCleanup (void);
+void xmlNanoHTTPScanProxy (const char *URL);
+int xmlNanoHTTPFetch (const char *URL,
+ const char *filename,
+ char **contentType);
+void * xmlNanoHTTPMethod (const char *URL,
+ const char *method,
+ const char *input,
+ char **contentType,
+ const char *headers);
+void * xmlNanoHTTPOpen (const char *URL,
+ char **contentType);
+int xmlNanoHTTPReturnCode (void *ctx);
+const char * xmlNanoHTTPAuthHeader(void *ctx);
+int xmlNanoHTTPRead (void *ctx,
+ void *dest,
+ int len);
+int xmlNanoHTTPSave (void *ctxt,
+ const char *filename);
+void xmlNanoHTTPClose (void *ctx);
+#ifdef __cplusplus
+}
+
+#endif /* LIBXML_HTTP_ENABLED */
+#endif
+#endif /* __NANO_HTTP_H__ */
diff --git a/include/libxml/parser.h b/include/libxml/parser.h
new file mode 100644
index 0000000..b98f2a3
--- /dev/null
+++ b/include/libxml/parser.h
@@ -0,0 +1,527 @@
+/*
+ * parser.h : Interfaces, constants and types related to the XML parser.
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __XML_PARSER_H__
+#define __XML_PARSER_H__
+
+#include <libxml/tree.h>
+#include <libxml/valid.h>
+#include <libxml/xmlIO.h>
+#include <libxml/entities.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Constants.
+ */
+#define XML_DEFAULT_VERSION "1.0"
+
+/**
+ * an xmlParserInput is an input flow for the XML processor.
+ * Each entity parsed is associated an xmlParserInput (except the
+ * few predefined ones). This is the case both for internal entities
+ * - in which case the flow is already completely in memory - or
+ * external entities - in which case we use the buf structure for
+ * progressive reading and I18N conversions to the internal UTF-8 format.
+ */
+
+typedef void (* xmlParserInputDeallocate)(xmlChar *);
+typedef struct _xmlParserInput xmlParserInput;
+typedef xmlParserInput *xmlParserInputPtr;
+struct _xmlParserInput {
+ /* Input buffer */
+ xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */
+
+ const char *filename; /* The file analyzed, if any */
+ const char *directory; /* the directory/base of teh file */
+ const xmlChar *base; /* Base of the array to parse */
+ const xmlChar *cur; /* Current char being parsed */
+ int length; /* length if known */
+ int line; /* Current line */
+ int col; /* Current column */
+ int consumed; /* How many xmlChars already consumed */
+ xmlParserInputDeallocate free; /* function to deallocate the base */
+ const xmlChar *encoding; /* the encoding string for entity */
+ const xmlChar *version; /* the version string for entity */
+ int standalone; /* Was that entity marked standalone */
+};
+
+/**
+ * the parser can be asked to collect Node informations, i.e. at what
+ * place in the file they were detected.
+ * NOTE: This is off by default and not very well tested.
+ */
+typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
+typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
+
+struct _xmlParserNodeInfo {
+ const struct _xmlNode* node;
+ /* Position & line # that text that created the node begins & ends on */
+ unsigned long begin_pos;
+ unsigned long begin_line;
+ unsigned long end_pos;
+ unsigned long end_line;
+};
+
+typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
+typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
+struct _xmlParserNodeInfoSeq {
+ unsigned long maximum;
+ unsigned long length;
+ xmlParserNodeInfo* buffer;
+};
+
+/**
+ * The parser is now working also as a state based parser
+ * The recursive one use the stagte info for entities processing
+ */
+typedef enum {
+ XML_PARSER_EOF = -1, /* nothing is to be parsed */
+ XML_PARSER_START = 0, /* nothing has been parsed */
+ XML_PARSER_MISC, /* Misc* before int subset */
+ XML_PARSER_PI, /* Whithin a processing instruction */
+ XML_PARSER_DTD, /* within some DTD content */
+ XML_PARSER_PROLOG, /* Misc* after internal subset */
+ XML_PARSER_COMMENT, /* within a comment */
+ XML_PARSER_START_TAG, /* within a start tag */
+ XML_PARSER_CONTENT, /* within the content */
+ XML_PARSER_CDATA_SECTION, /* within a CDATA section */
+ XML_PARSER_END_TAG, /* within a closing tag */
+ XML_PARSER_ENTITY_DECL, /* within an entity declaration */
+ XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
+ XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
+ XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
+ XML_PARSER_EPILOG, /* the Misc* after the last end tag */
+ XML_PARSER_IGNORE /* within an IGNORED section */
+} xmlParserInputState;
+
+/**
+ * The parser context.
+ * NOTE This doesn't completely defines the parser state, the (current ?)
+ * design of the parser uses recursive function calls since this allow
+ * and easy mapping from the production rules of the specification
+ * to the actual code. The drawback is that the actual function call
+ * also reflect the parser state. However most of the parsing routines
+ * takes as the only argument the parser context pointer, so migrating
+ * to a state based parser for progressive parsing shouldn't be too hard.
+ */
+typedef struct _xmlParserCtxt xmlParserCtxt;
+typedef xmlParserCtxt *xmlParserCtxtPtr;
+struct _xmlParserCtxt {
+ struct _xmlSAXHandler *sax; /* The SAX handler */
+ void *userData; /* For SAX interface only, used by DOM build */
+ xmlDocPtr myDoc; /* the document being built */
+ int wellFormed; /* is the document well formed */
+ int replaceEntities; /* shall we replace entities ? */
+ const xmlChar *version; /* the XML version string */
+ const xmlChar *encoding; /* the declared encoding, if any */
+ int standalone; /* standalone document */
+ int html; /* an HTML(1)/Docbook(2) document */
+
+ /* Input stream stack */
+ xmlParserInputPtr input; /* Current input stream */
+ int inputNr; /* Number of current input streams */
+ int inputMax; /* Max number of input streams */
+ xmlParserInputPtr *inputTab; /* stack of inputs */
+
+ /* Node analysis stack only used for DOM building */
+ xmlNodePtr node; /* Current parsed Node */
+ int nodeNr; /* Depth of the parsing stack */
+ int nodeMax; /* Max depth of the parsing stack */
+ xmlNodePtr *nodeTab; /* array of nodes */
+
+ int record_info; /* Whether node info should be kept */
+ xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
+
+ int errNo; /* error code */
+
+ int hasExternalSubset; /* reference and external subset */
+ int hasPErefs; /* the internal subset has PE refs */
+ int external; /* are we parsing an external entity */
+
+ int valid; /* is the document valid */
+ int validate; /* shall we try to validate ? */
+ xmlValidCtxt vctxt; /* The validity context */
+
+ xmlParserInputState instate; /* current type of input */
+ int token; /* next char look-ahead */
+
+ char *directory; /* the data directory */
+
+ /* Node name stack */
+ xmlChar *name; /* Current parsed Node */
+ int nameNr; /* Depth of the parsing stack */
+ int nameMax; /* Max depth of the parsing stack */
+ xmlChar * *nameTab; /* array of nodes */
+
+ long nbChars; /* number of xmlChar processed */
+ long checkIndex; /* used by progressive parsing lookup */
+ int keepBlanks; /* ugly but ... */
+ int disableSAX; /* SAX callbacks are disabled */
+ int inSubset; /* Parsing is in int 1/ext 2 subset */
+ xmlChar * intSubName; /* name of subset */
+ xmlChar * extSubURI; /* URI of external subset */
+ xmlChar * extSubSystem; /* SYSTEM ID of external subset */
+
+ /* xml:space values */
+ int * space; /* Should the parser preserve spaces */
+ int spaceNr; /* Depth of the parsing stack */
+ int spaceMax; /* Max depth of the parsing stack */
+ int * spaceTab; /* array of space infos */
+
+ int depth; /* to prevent entity substitution loops */
+ xmlParserInputPtr entity; /* used to check entities boundaries */
+ int charset; /* encoding of the in-memory content
+ actually an xmlCharEncoding */
+ int nodelen; /* Those two fields are there to */
+ int nodemem; /* Speed up large node parsing */
+ int pedantic; /* signal pedantic warnings */
+ void *_private; /* For user data, libxml won't touch it */
+
+ int loadsubset; /* should the external subset be loaded */
+};
+
+/**
+ * a SAX Locator.
+ */
+typedef struct _xmlSAXLocator xmlSAXLocator;
+typedef xmlSAXLocator *xmlSAXLocatorPtr;
+struct _xmlSAXLocator {
+ const xmlChar *(*getPublicId)(void *ctx);
+ const xmlChar *(*getSystemId)(void *ctx);
+ int (*getLineNumber)(void *ctx);
+ int (*getColumnNumber)(void *ctx);
+};
+
+/**
+ * a SAX handler is bunch of callbacks called by the parser when processing
+ * of the input generate data or structure informations.
+ */
+
+typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
+ const xmlChar *publicId, const xmlChar *systemId);
+typedef void (*internalSubsetSAXFunc) (void *ctx, const xmlChar *name,
+ const xmlChar *ExternalID, const xmlChar *SystemID);
+typedef void (*externalSubsetSAXFunc) (void *ctx, const xmlChar *name,
+ const xmlChar *ExternalID, const xmlChar *SystemID);
+typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
+ const xmlChar *name);
+typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
+ const xmlChar *name);
+typedef void (*entityDeclSAXFunc) (void *ctx,
+ const xmlChar *name, int type, const xmlChar *publicId,
+ const xmlChar *systemId, xmlChar *content);
+typedef void (*notationDeclSAXFunc)(void *ctx, const xmlChar *name,
+ const xmlChar *publicId, const xmlChar *systemId);
+typedef void (*attributeDeclSAXFunc)(void *ctx, const xmlChar *elem,
+ const xmlChar *name, int type, int def,
+ const xmlChar *defaultValue, xmlEnumerationPtr tree);
+typedef void (*elementDeclSAXFunc)(void *ctx, const xmlChar *name,
+ int type, xmlElementContentPtr content);
+typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
+ const xmlChar *name, const xmlChar *publicId,
+ const xmlChar *systemId, const xmlChar *notationName);
+typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
+ xmlSAXLocatorPtr loc);
+typedef void (*startDocumentSAXFunc) (void *ctx);
+typedef void (*endDocumentSAXFunc) (void *ctx);
+typedef void (*startElementSAXFunc) (void *ctx, const xmlChar *name,
+ const xmlChar **atts);
+typedef void (*endElementSAXFunc) (void *ctx, const xmlChar *name);
+typedef void (*attributeSAXFunc) (void *ctx, const xmlChar *name,
+ const xmlChar *value);
+typedef void (*referenceSAXFunc) (void *ctx, const xmlChar *name);
+typedef void (*charactersSAXFunc) (void *ctx, const xmlChar *ch,
+ int len);
+typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
+ const xmlChar *ch, int len);
+typedef void (*processingInstructionSAXFunc) (void *ctx,
+ const xmlChar *target, const xmlChar *data);
+typedef void (*commentSAXFunc) (void *ctx, const xmlChar *value);
+typedef void (*cdataBlockSAXFunc) (void *ctx, const xmlChar *value, int len);
+typedef void (*warningSAXFunc) (void *ctx, const char *msg, ...);
+typedef void (*errorSAXFunc) (void *ctx, const char *msg, ...);
+typedef void (*fatalErrorSAXFunc) (void *ctx, const char *msg, ...);
+typedef int (*isStandaloneSAXFunc) (void *ctx);
+typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
+typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
+
+typedef struct _xmlSAXHandler xmlSAXHandler;
+typedef xmlSAXHandler *xmlSAXHandlerPtr;
+struct _xmlSAXHandler {
+ internalSubsetSAXFunc internalSubset;
+ isStandaloneSAXFunc isStandalone;
+ hasInternalSubsetSAXFunc hasInternalSubset;
+ hasExternalSubsetSAXFunc hasExternalSubset;
+ resolveEntitySAXFunc resolveEntity;
+ getEntitySAXFunc getEntity;
+ entityDeclSAXFunc entityDecl;
+ notationDeclSAXFunc notationDecl;
+ attributeDeclSAXFunc attributeDecl;
+ elementDeclSAXFunc elementDecl;
+ unparsedEntityDeclSAXFunc unparsedEntityDecl;
+ setDocumentLocatorSAXFunc setDocumentLocator;
+ startDocumentSAXFunc startDocument;
+ endDocumentSAXFunc endDocument;
+ startElementSAXFunc startElement;
+ endElementSAXFunc endElement;
+ referenceSAXFunc reference;
+ charactersSAXFunc characters;
+ ignorableWhitespaceSAXFunc ignorableWhitespace;
+ processingInstructionSAXFunc processingInstruction;
+ commentSAXFunc comment;
+ warningSAXFunc warning;
+ errorSAXFunc error;
+ fatalErrorSAXFunc fatalError;
+ getParameterEntitySAXFunc getParameterEntity;
+ cdataBlockSAXFunc cdataBlock;
+ externalSubsetSAXFunc externalSubset;
+};
+
+/**
+ * External entity loaders types
+ */
+typedef xmlParserInputPtr (*xmlExternalEntityLoader)(const char *URL,
+ const char *ID,
+ xmlParserCtxtPtr context);
+
+/**
+ * Global variables: just the default SAX interface tables and XML
+ * version infos.
+ */
+LIBXML_DLL_IMPORT extern const char *xmlParserVersion;
+
+LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator;
+LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler;
+LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler;
+LIBXML_DLL_IMPORT extern xmlSAXHandler sgmlDefaultSAXHandler;
+
+/**
+ * entity substitution default behaviour.
+ */
+
+#ifdef VMS
+LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultVal;
+#define xmlSubstituteEntitiesDefaultValue xmlSubstituteEntitiesDefaultVal
+#else
+LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
+#endif
+LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
+
+
+/**
+ * Init/Cleanup
+ */
+void xmlInitParser (void);
+void xmlCleanupParser (void);
+
+/**
+ * Input functions
+ */
+int xmlParserInputRead (xmlParserInputPtr in,
+ int len);
+int xmlParserInputGrow (xmlParserInputPtr in,
+ int len);
+
+/**
+ * xmlChar handling
+ */
+xmlChar * xmlStrdup (const xmlChar *cur);
+xmlChar * xmlStrndup (const xmlChar *cur,
+ int len);
+xmlChar * xmlStrsub (const xmlChar *str,
+ int start,
+ int len);
+const xmlChar * xmlStrchr (const xmlChar *str,
+ xmlChar val);
+const xmlChar * xmlStrstr (const xmlChar *str,
+ xmlChar *val);
+const xmlChar * xmlStrcasestr (const xmlChar *str,
+ xmlChar *val);
+int xmlStrcmp (const xmlChar *str1,
+ const xmlChar *str2);
+int xmlStrncmp (const xmlChar *str1,
+ const xmlChar *str2,
+ int len);
+int xmlStrcasecmp (const xmlChar *str1,
+ const xmlChar *str2);
+int xmlStrncasecmp (const xmlChar *str1,
+ const xmlChar *str2,
+ int len);
+int xmlStrEqual (const xmlChar *str1,
+ const xmlChar *str2);
+int xmlStrlen (const xmlChar *str);
+xmlChar * xmlStrcat (xmlChar *cur,
+ const xmlChar *add);
+xmlChar * xmlStrncat (xmlChar *cur,
+ const xmlChar *add,
+ int len);
+
+/**
+ * Basic parsing Interfaces
+ */
+xmlDocPtr xmlParseDoc (xmlChar *cur);
+xmlDocPtr xmlParseMemory (char *buffer,
+ int size);
+xmlDocPtr xmlParseFile (const char *filename);
+int xmlSubstituteEntitiesDefault(int val);
+int xmlKeepBlanksDefault (int val);
+void xmlStopParser (xmlParserCtxtPtr ctxt);
+int xmlPedanticParserDefault(int val);
+
+/**
+ * Recovery mode
+ */
+xmlDocPtr xmlRecoverDoc (xmlChar *cur);
+xmlDocPtr xmlRecoverMemory (char *buffer,
+ int size);
+xmlDocPtr xmlRecoverFile (const char *filename);
+
+/**
+ * Less common routines and SAX interfaces
+ */
+int xmlParseDocument (xmlParserCtxtPtr ctxt);
+int xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
+xmlDocPtr xmlSAXParseDoc (xmlSAXHandlerPtr sax,
+ xmlChar *cur,
+ int recovery);
+int xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
+ void *user_data,
+ const char *filename);
+int xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
+ void *user_data,
+ char *buffer,
+ int size);
+xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax,
+ char *buffer,
+ int size,
+ int recovery);
+xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax,
+ const char *filename,
+ int recovery);
+xmlDocPtr xmlSAXParseEntity (xmlSAXHandlerPtr sax,
+ const char *filename);
+xmlDocPtr xmlParseEntity (const char *filename);
+xmlDtdPtr xmlParseDTD (const xmlChar *ExternalID,
+ const xmlChar *SystemID);
+xmlDtdPtr xmlSAXParseDTD (xmlSAXHandlerPtr sax,
+ const xmlChar *ExternalID,
+ const xmlChar *SystemID);
+xmlDtdPtr xmlIOParseDTD (xmlSAXHandlerPtr sax,
+ xmlParserInputBufferPtr input,
+ xmlCharEncoding enc);
+int xmlParseBalancedChunkMemory(xmlDocPtr doc,
+ xmlSAXHandlerPtr sax,
+ void *user_data,
+ int depth,
+ const xmlChar *string,
+ xmlNodePtr *list);
+int xmlParseExternalEntity (xmlDocPtr doc,
+ xmlSAXHandlerPtr sax,
+ void *user_data,
+ int depth,
+ const xmlChar *URL,
+ const xmlChar *ID,
+ xmlNodePtr *list);
+int xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
+ const xmlChar *URL,
+ const xmlChar *ID,
+ xmlNodePtr *list);
+
+/**
+ * SAX initialization routines
+ */
+void xmlDefaultSAXHandlerInit(void);
+void htmlDefaultSAXHandlerInit(void);
+
+/**
+ * Parser contexts handling.
+ */
+void xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
+void xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
+void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
+void xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
+ const xmlChar* buffer,
+ const char* filename);
+xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur);
+
+/**
+ * Reading/setting optional parsing features.
+ */
+
+int xmlGetFeaturesList (int *len,
+ const char **result);
+int xmlGetFeature (xmlParserCtxtPtr ctxt,
+ const char *name,
+ void *result);
+int xmlSetFeature (xmlParserCtxtPtr ctxt,
+ const char *name,
+ void *value);
+
+/**
+ * Interfaces for the Push mode
+ */
+xmlParserCtxtPtr xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
+ void *user_data,
+ const char *chunk,
+ int size,
+ const char *filename);
+int xmlParseChunk (xmlParserCtxtPtr ctxt,
+ const char *chunk,
+ int size,
+ int terminate);
+
+/**
+ * Special I/O mode
+ */
+
+xmlParserCtxtPtr xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
+ void *user_data,
+ xmlInputReadCallback ioread,
+ xmlInputCloseCallback ioclose,
+ void *ioctx,
+ xmlCharEncoding enc);
+
+xmlParserInputPtr xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
+ xmlParserInputBufferPtr input,
+ xmlCharEncoding enc);
+
+/**
+ * Node infos
+ */
+const xmlParserNodeInfo*
+ xmlParserFindNodeInfo (const xmlParserCtxt* ctxt,
+ const xmlNode* node);
+void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
+void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
+unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeq* seq,
+ const xmlNode* node);
+void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
+ const xmlParserNodeInfo* info);
+
+/*
+ * External entities handling actually implemented in xmlIO
+ */
+
+void xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
+xmlExternalEntityLoader
+ xmlGetExternalEntityLoader(void);
+xmlParserInputPtr
+ xmlLoadExternalEntity (const char *URL,
+ const char *ID,
+ xmlParserCtxtPtr context);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_PARSER_H__ */
+
diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h
new file mode 100644
index 0000000..3fdb8f6
--- /dev/null
+++ b/include/libxml/parserInternals.h
@@ -0,0 +1,314 @@
+/*
+ * parserInternals.h : internals routines exported by the parser.
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ *
+ * 14 Nov 2000 ht - truncated declaration of xmlParseElementChildrenContentDecl
+ * for VMS
+ *
+ */
+
+#ifndef __XML_PARSER_INTERNALS_H__
+#define __XML_PARSER_INTERNALS_H__
+
+#include <libxml/parser.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /*
+ * Identifiers can be longer, but this will be more costly
+ * at runtime.
+ */
+#define XML_MAX_NAMELEN 100
+
+/*
+ * The parser tries to always have that amount of input ready
+ * one of the point is providing context when reporting errors
+ */
+#define INPUT_CHUNK 250
+
+/************************************************************************
+ * *
+ * UNICODE version of the macros. *
+ * *
+ ************************************************************************/
+/*
+ * [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD]
+ * | [#x10000-#x10FFFF]
+ * any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
+ */
+#define IS_CHAR(c) \
+ ((((c) >= 0x20) && ((c) <= 0xD7FF)) || \
+ ((c) == 0x09) || ((c) == 0x0A) || ((c) == 0x0D) || \
+ (((c) >= 0xE000) && ((c) <= 0xFFFD)) || \
+ (((c) >= 0x10000) && ((c) <= 0x10FFFF)))
+
+/*
+ * [3] S ::= (#x20 | #x9 | #xD | #xA)+
+ */
+#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \
+ ((c) == 0x0D))
+
+/*
+ * [85] BaseChar ::= ... long list see REC ...
+ */
+#define IS_BASECHAR(c) xmlIsBaseChar(c)
+
+/*
+ * [88] Digit ::= ... long list see REC ...
+ */
+#define IS_DIGIT(c) xmlIsDigit(c)
+
+/*
+ * [87] CombiningChar ::= ... long list see REC ...
+ */
+#define IS_COMBINING(c) xmlIsCombining(c)
+
+/*
+ * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
+ * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
+ * [#x309D-#x309E] | [#x30FC-#x30FE]
+ */
+#define IS_EXTENDER(c) xmlIsExtender(c)
+
+/*
+ * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
+ */
+#define IS_IDEOGRAPHIC(c) xmlIsIdeographic(c)
+
+/*
+ * [84] Letter ::= BaseChar | Ideographic
+ */
+#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
+
+
+/*
+ * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%]
+ */
+#define IS_PUBIDCHAR(c) xmlIsPubidChar(c)
+
+#define SKIP_EOL(p) \
+ if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \
+ if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; }
+
+#define MOVETO_ENDTAG(p) \
+ while ((*p) && (*(p) != '>')) (p)++
+
+#define MOVETO_STARTTAG(p) \
+ while ((*p) && (*(p) != '<')) (p)++
+
+/**
+ * Global vaiables affecting the default parser behaviour.
+ */
+
+LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
+LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlParserDebugEntities;
+LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue;
+LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue;
+LIBXML_DLL_IMPORT extern xmlChar xmlStringText[];
+LIBXML_DLL_IMPORT extern xmlChar xmlStringTextNoenc[];
+LIBXML_DLL_IMPORT extern xmlChar xmlStringComment[];
+
+/*
+ * Function to finish teh work of the macros where needed
+ */
+int xmlIsBaseChar (int c);
+int xmlIsBlank (int c);
+int xmlIsPubidChar (int c);
+int xmlIsLetter (int c);
+int xmlIsDigit (int c);
+int xmlIsIdeographic(int c);
+int xmlIsCombining (int c);
+int xmlIsExtender (int c);
+int xmlIsCombining (int c);
+int xmlIsChar (int c);
+
+/**
+ * Parser context
+ */
+xmlParserCtxtPtr xmlCreateDocParserCtxt (xmlChar *cur);
+xmlParserCtxtPtr xmlCreateFileParserCtxt (const char *filename);
+xmlParserCtxtPtr xmlCreateMemoryParserCtxt(char *buffer,
+ int size);
+xmlParserCtxtPtr xmlNewParserCtxt (void);
+xmlParserCtxtPtr xmlCreateEntityParserCtxt(const xmlChar *URL,
+ const xmlChar *ID,
+ const xmlChar *base);
+int xmlSwitchEncoding (xmlParserCtxtPtr ctxt,
+ xmlCharEncoding enc);
+int xmlSwitchToEncoding (xmlParserCtxtPtr ctxt,
+ xmlCharEncodingHandlerPtr handler);
+void xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
+
+/**
+ * Entities
+ */
+void xmlHandleEntity (xmlParserCtxtPtr ctxt,
+ xmlEntityPtr entity);
+
+/**
+ * Input Streams
+ */
+xmlParserInputPtr xmlNewEntityInputStream (xmlParserCtxtPtr ctxt,
+ xmlEntityPtr entity);
+void xmlPushInput (xmlParserCtxtPtr ctxt,
+ xmlParserInputPtr input);
+xmlChar xmlPopInput (xmlParserCtxtPtr ctxt);
+void xmlFreeInputStream (xmlParserInputPtr input);
+xmlParserInputPtr xmlNewInputFromFile (xmlParserCtxtPtr ctxt,
+ const char *filename);
+xmlParserInputPtr xmlNewInputStream (xmlParserCtxtPtr ctxt);
+
+/**
+ * Namespaces.
+ */
+xmlChar * xmlSplitQName (xmlParserCtxtPtr ctxt,
+ const xmlChar *name,
+ xmlChar **prefix);
+xmlChar * xmlNamespaceParseNCName (xmlParserCtxtPtr ctxt);
+xmlChar * xmlNamespaceParseQName (xmlParserCtxtPtr ctxt,
+ xmlChar **prefix);
+xmlChar * xmlNamespaceParseNSDef (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParseQuotedString (xmlParserCtxtPtr ctxt);
+void xmlParseNamespace (xmlParserCtxtPtr ctxt);
+
+/**
+ * Generic production rules
+ */
+xmlChar * xmlScanName (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParseName (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParseNmtoken (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParseEntityValue (xmlParserCtxtPtr ctxt,
+ xmlChar **orig);
+xmlChar * xmlParseAttValue (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParseSystemLiteral (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParsePubidLiteral (xmlParserCtxtPtr ctxt);
+void xmlParseCharData (xmlParserCtxtPtr ctxt,
+ int cdata);
+xmlChar * xmlParseExternalID (xmlParserCtxtPtr ctxt,
+ xmlChar **publicID,
+ int strict);
+void xmlParseComment (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParsePITarget (xmlParserCtxtPtr ctxt);
+void xmlParsePI (xmlParserCtxtPtr ctxt);
+void xmlParseNotationDecl (xmlParserCtxtPtr ctxt);
+void xmlParseEntityDecl (xmlParserCtxtPtr ctxt);
+int xmlParseDefaultDecl (xmlParserCtxtPtr ctxt,
+ xmlChar **value);
+xmlEnumerationPtr xmlParseNotationType (xmlParserCtxtPtr ctxt);
+xmlEnumerationPtr xmlParseEnumerationType (xmlParserCtxtPtr ctxt);
+int xmlParseEnumeratedType (xmlParserCtxtPtr ctxt,
+ xmlEnumerationPtr *tree);
+int xmlParseAttributeType (xmlParserCtxtPtr ctxt,
+ xmlEnumerationPtr *tree);
+void xmlParseAttributeListDecl(xmlParserCtxtPtr ctxt);
+xmlElementContentPtr xmlParseElementMixedContentDecl
+ (xmlParserCtxtPtr ctxt);
+#ifdef VMS
+xmlElementContentPtr xmlParseElementChildrenContentD
+ (xmlParserCtxtPtr ctxt);
+#define xmlParseElementChildrenContentDecl xmlParseElementChildrenContentD
+#else
+xmlElementContentPtr xmlParseElementChildrenContentDecl
+ (xmlParserCtxtPtr ctxt);
+#endif
+int xmlParseElementContentDecl(xmlParserCtxtPtr ctxt,
+ xmlChar *name,
+ xmlElementContentPtr *result);
+int xmlParseElementDecl (xmlParserCtxtPtr ctxt);
+void xmlParseMarkupDecl (xmlParserCtxtPtr ctxt);
+int xmlParseCharRef (xmlParserCtxtPtr ctxt);
+xmlEntityPtr xmlParseEntityRef (xmlParserCtxtPtr ctxt);
+void xmlParseReference (xmlParserCtxtPtr ctxt);
+void xmlParsePEReference (xmlParserCtxtPtr ctxt);
+void xmlParseDocTypeDecl (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParseAttribute (xmlParserCtxtPtr ctxt,
+ xmlChar **value);
+xmlChar * xmlParseStartTag (xmlParserCtxtPtr ctxt);
+void xmlParseEndTag (xmlParserCtxtPtr ctxt);
+void xmlParseCDSect (xmlParserCtxtPtr ctxt);
+void xmlParseContent (xmlParserCtxtPtr ctxt);
+void xmlParseElement (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParseVersionNum (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParseVersionInfo (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParseEncName (xmlParserCtxtPtr ctxt);
+xmlChar * xmlParseEncodingDecl (xmlParserCtxtPtr ctxt);
+int xmlParseSDDecl (xmlParserCtxtPtr ctxt);
+void xmlParseXMLDecl (xmlParserCtxtPtr ctxt);
+void xmlParseTextDecl (xmlParserCtxtPtr ctxt);
+void xmlParseMisc (xmlParserCtxtPtr ctxt);
+void xmlParseExternalSubset (xmlParserCtxtPtr ctxt,
+ const xmlChar *ExternalID,
+ const xmlChar *SystemID);
+/*
+ * Entities substitution
+ */
+#define XML_SUBSTITUTE_NONE 0
+#define XML_SUBSTITUTE_REF 1
+#define XML_SUBSTITUTE_PEREF 2
+#define XML_SUBSTITUTE_BOTH 3
+
+xmlChar * xmlDecodeEntities (xmlParserCtxtPtr ctxt,
+ int len,
+ int what,
+ xmlChar end,
+ xmlChar end2,
+ xmlChar end3);
+xmlChar * xmlStringDecodeEntities (xmlParserCtxtPtr ctxt,
+ const xmlChar *str,
+ int what,
+ xmlChar end,
+ xmlChar end2,
+ xmlChar end3);
+
+/*
+ * Generated by MACROS on top of parser.c c.f. PUSH_AND_POP
+ */
+int nodePush (xmlParserCtxtPtr ctxt,
+ xmlNodePtr value);
+xmlNodePtr nodePop (xmlParserCtxtPtr ctxt);
+int inputPush (xmlParserCtxtPtr ctxt,
+ xmlParserInputPtr value);
+xmlParserInputPtr inputPop (xmlParserCtxtPtr ctxt);
+
+/*
+ * other comodities shared between parser.c and parserInternals
+ */
+int xmlSkipBlankChars (xmlParserCtxtPtr ctxt);
+int xmlStringCurrentChar (xmlParserCtxtPtr ctxt,
+ const xmlChar *cur,
+ int *len);
+void xmlParserHandlePEReference(xmlParserCtxtPtr ctxt);
+void xmlParserHandleReference(xmlParserCtxtPtr ctxt);
+xmlChar *namePop (xmlParserCtxtPtr ctxt);
+int xmlCheckLanguageID (const xmlChar *lang);
+
+/*
+ * Really core function shared with HTML parser
+ */
+int xmlCurrentChar (xmlParserCtxtPtr ctxt,
+ int *len);
+int xmlCopyChar (int len,
+ xmlChar *out,
+ int val);
+void xmlNextChar (xmlParserCtxtPtr ctxt);
+void xmlParserInputShrink (xmlParserInputPtr in);
+
+#ifdef LIBXML_HTML_ENABLED
+/*
+ * Actually comes from the HTML parser but launched from the init stuff
+ */
+void htmlInitAutoClose (void);
+#endif
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_PARSER_INTERNALS_H__ */
diff --git a/include/libxml/tree.h b/include/libxml/tree.h
new file mode 100644
index 0000000..648817d
--- /dev/null
+++ b/include/libxml/tree.h
@@ -0,0 +1,701 @@
+/*
+ * tree.h : describes the structures found in an tree resulting
+ * from an XML parsing.
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ *
+ * 14 Nov 2000 ht - added redefinition of xmlBufferWriteChar for VMS
+ *
+ */
+
+#ifndef __XML_TREE_H__
+#define __XML_TREE_H__
+
+#include <stdio.h>
+#include <libxml/xmlversion.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define XML_XML_NAMESPACE \
+ (const xmlChar *) "http://www.w3.org/XML/1998/namespace"
+
+/*
+ * The different element types carried by an XML tree
+ *
+ * NOTE: This is synchronized with DOM Level1 values
+ * See http://www.w3.org/TR/REC-DOM-Level-1/
+ *
+ * Actually this had diverged a bit, and now XML_DOCUMENT_TYPE_NODE should
+ * be deprecated to use an XML_DTD_NODE.
+ */
+typedef enum {
+ XML_ELEMENT_NODE= 1,
+ XML_ATTRIBUTE_NODE= 2,
+ XML_TEXT_NODE= 3,
+ XML_CDATA_SECTION_NODE= 4,
+ XML_ENTITY_REF_NODE= 5,
+ XML_ENTITY_NODE= 6,
+ XML_PI_NODE= 7,
+ XML_COMMENT_NODE= 8,
+ XML_DOCUMENT_NODE= 9,
+ XML_DOCUMENT_TYPE_NODE= 10,
+ XML_DOCUMENT_FRAG_NODE= 11,
+ XML_NOTATION_NODE= 12,
+ XML_HTML_DOCUMENT_NODE= 13,
+ XML_DTD_NODE= 14,
+ XML_ELEMENT_DECL= 15,
+ XML_ATTRIBUTE_DECL= 16,
+ XML_ENTITY_DECL= 17,
+ XML_NAMESPACE_DECL= 18,
+ XML_XINCLUDE_START= 19,
+ XML_XINCLUDE_END= 20
+#ifdef LIBXML_SGML_ENABLED
+ ,XML_SGML_DOCUMENT_NODE= 21
+#endif
+} xmlElementType;
+
+/*
+ * Size of an internal character representation.
+ *
+ * We use 8bit chars internal representation for memory efficiency,
+ * Note that with 8 bits wide xmlChars one can still use UTF-8 to handle
+ * correctly non ISO-Latin input.
+ */
+
+typedef unsigned char xmlChar;
+
+#ifndef WIN32
+#ifndef CHAR
+#define CHAR xmlChar
+#endif
+#endif
+
+#define BAD_CAST (xmlChar *)
+
+/*
+ * a DTD Notation definition
+ */
+
+typedef struct _xmlNotation xmlNotation;
+typedef xmlNotation *xmlNotationPtr;
+struct _xmlNotation {
+ const xmlChar *name; /* Notation name */
+ const xmlChar *PublicID; /* Public identifier, if any */
+ const xmlChar *SystemID; /* System identifier, if any */
+};
+
+/*
+ * a DTD Attribute definition
+ */
+
+typedef enum {
+ XML_ATTRIBUTE_CDATA = 1,
+ XML_ATTRIBUTE_ID,
+ XML_ATTRIBUTE_IDREF ,
+ XML_ATTRIBUTE_IDREFS,
+ XML_ATTRIBUTE_ENTITY,
+ XML_ATTRIBUTE_ENTITIES,
+ XML_ATTRIBUTE_NMTOKEN,
+ XML_ATTRIBUTE_NMTOKENS,
+ XML_ATTRIBUTE_ENUMERATION,
+ XML_ATTRIBUTE_NOTATION
+} xmlAttributeType;
+
+typedef enum {
+ XML_ATTRIBUTE_NONE = 1,
+ XML_ATTRIBUTE_REQUIRED,
+ XML_ATTRIBUTE_IMPLIED,
+ XML_ATTRIBUTE_FIXED
+} xmlAttributeDefault;
+
+typedef struct _xmlEnumeration xmlEnumeration;
+typedef xmlEnumeration *xmlEnumerationPtr;
+struct _xmlEnumeration {
+ struct _xmlEnumeration *next; /* next one */
+ const xmlChar *name; /* Enumeration name */
+};
+
+typedef struct _xmlAttribute xmlAttribute;
+typedef xmlAttribute *xmlAttributePtr;
+struct _xmlAttribute {
+#ifndef XML_WITHOUT_CORBA
+ void *_private; /* for Corba, must be first ! */
+#endif
+ xmlElementType type; /* XML_ATTRIBUTE_DECL, must be second ! */
+ const xmlChar *name; /* Attribute name */
+ struct _xmlNode *children; /* NULL */
+ struct _xmlNode *last; /* NULL */
+ struct _xmlDtd *parent; /* -> DTD */
+ struct _xmlNode *next; /* next sibling link */
+ struct _xmlNode *prev; /* previous sibling link */
+ struct _xmlDoc *doc; /* the containing document */
+
+ struct _xmlAttribute *nexth; /* next in hash table */
+ xmlAttributeType atype; /* The attribute type */
+ xmlAttributeDefault def; /* the default */
+ const xmlChar *defaultValue; /* or the default value */
+ xmlEnumerationPtr tree; /* or the enumeration tree if any */
+ const xmlChar *prefix; /* the namespace prefix if any */
+ const xmlChar *elem; /* Element holding the attribute */
+};
+
+/*
+ * a DTD Element definition.
+ */
+typedef enum {
+ XML_ELEMENT_CONTENT_PCDATA = 1,
+ XML_ELEMENT_CONTENT_ELEMENT,
+ XML_ELEMENT_CONTENT_SEQ,
+ XML_ELEMENT_CONTENT_OR
+} xmlElementContentType;
+
+typedef enum {
+ XML_ELEMENT_CONTENT_ONCE = 1,
+ XML_ELEMENT_CONTENT_OPT,
+ XML_ELEMENT_CONTENT_MULT,
+ XML_ELEMENT_CONTENT_PLUS
+} xmlElementContentOccur;
+
+typedef struct _xmlElementContent xmlElementContent;
+typedef xmlElementContent *xmlElementContentPtr;
+struct _xmlElementContent {
+ xmlElementContentType type; /* PCDATA, ELEMENT, SEQ or OR */
+ xmlElementContentOccur ocur; /* ONCE, OPT, MULT or PLUS */
+ const xmlChar *name; /* Element name */
+ struct _xmlElementContent *c1; /* first child */
+ struct _xmlElementContent *c2; /* second child */
+};
+
+typedef enum {
+ XML_ELEMENT_TYPE_EMPTY = 1,
+ XML_ELEMENT_TYPE_ANY,
+ XML_ELEMENT_TYPE_MIXED,
+ XML_ELEMENT_TYPE_ELEMENT
+} xmlElementTypeVal;
+
+typedef struct _xmlElement xmlElement;
+typedef xmlElement *xmlElementPtr;
+struct _xmlElement {
+#ifndef XML_WITHOUT_CORBA
+ void *_private; /* for Corba, must be first ! */
+#endif
+ xmlElementType type; /* XML_ELEMENT_DECL, must be second ! */
+ const xmlChar *name; /* Element name */
+ struct _xmlNode *children; /* NULL */
+ struct _xmlNode *last; /* NULL */
+ struct _xmlDtd *parent; /* -> DTD */
+ struct _xmlNode *next; /* next sibling link */
+ struct _xmlNode *prev; /* previous sibling link */
+ struct _xmlDoc *doc; /* the containing document */
+
+ xmlElementTypeVal etype; /* The type */
+ xmlElementContentPtr content; /* the allowed element content */
+ xmlAttributePtr attributes; /* List of the declared attributes */
+ const xmlChar *prefix; /* the namespace prefix if any */
+};
+
+/*
+ * An XML namespace.
+ * Note that prefix == NULL is valid, it defines the default namespace
+ * within the subtree (until overriden).
+ *
+ * XML_GLOBAL_NAMESPACE is now deprecated for good
+ * xmlNsType is unified with xmlElementType
+ */
+
+#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL
+typedef xmlElementType xmlNsType;
+
+typedef struct _xmlNs xmlNs;
+typedef xmlNs *xmlNsPtr;
+struct _xmlNs {
+ struct _xmlNs *next; /* next Ns link for this node */
+ xmlNsType type; /* global or local */
+ const xmlChar *href; /* URL for the namespace */
+ const xmlChar *prefix; /* prefix for the namespace */
+};
+
+/*
+ * An XML DtD, as defined by <!DOCTYPE.
+ */
+typedef struct _xmlDtd xmlDtd;
+typedef xmlDtd *xmlDtdPtr;
+struct _xmlDtd {
+#ifndef XML_WITHOUT_CORBA
+ void *_private; /* for Corba, must be first ! */
+#endif
+ xmlElementType type; /* XML_DTD_NODE, must be second ! */
+ const xmlChar *name; /* Name of the DTD */
+ struct _xmlNode *children; /* the value of the property link */
+ struct _xmlNode *last; /* last child link */
+ struct _xmlDoc *parent; /* child->parent link */
+ struct _xmlNode *next; /* next sibling link */
+ struct _xmlNode *prev; /* previous sibling link */
+ struct _xmlDoc *doc; /* the containing document */
+
+ /* End of common part */
+ void *notations; /* Hash table for notations if any */
+ void *elements; /* Hash table for elements if any */
+ void *attributes; /* Hash table for attributes if any */
+ void *entities; /* Hash table for entities if any */
+ const xmlChar *ExternalID; /* External identifier for PUBLIC DTD */
+ const xmlChar *SystemID; /* URI for a SYSTEM or PUBLIC DTD */
+ void *pentities; /* Hash table for param entities if any */
+};
+
+/*
+ * A attribute of an XML node.
+ */
+typedef struct _xmlAttr xmlAttr;
+typedef xmlAttr *xmlAttrPtr;
+struct _xmlAttr {
+#ifndef XML_WITHOUT_CORBA
+ void *_private; /* for Corba, must be first ! */
+#endif
+ xmlElementType type; /* XML_ATTRIBUTE_NODE, must be second ! */
+ const xmlChar *name; /* the name of the property */
+ struct _xmlNode *children; /* the value of the property */
+ struct _xmlNode *last; /* NULL */
+ struct _xmlNode *parent; /* child->parent link */
+ struct _xmlAttr *next; /* next sibling link */
+ struct _xmlAttr *prev; /* previous sibling link */
+ struct _xmlDoc *doc; /* the containing document */
+ xmlNs *ns; /* pointer to the associated namespace */
+ xmlAttributeType atype; /* the attribute type if validating */
+};
+
+/*
+ * An XML ID instance.
+ */
+
+typedef struct _xmlID xmlID;
+typedef xmlID *xmlIDPtr;
+struct _xmlID {
+ struct _xmlID *next; /* next ID */
+ const xmlChar *value; /* The ID name */
+ xmlAttrPtr attr; /* The attribut holding it */
+};
+
+/*
+ * An XML IDREF instance.
+ */
+
+typedef struct _xmlRef xmlRef;
+typedef xmlRef *xmlRefPtr;
+struct _xmlRef {
+ struct _xmlRef *next; /* next Ref */
+ const xmlChar *value; /* The Ref name */
+ xmlAttrPtr attr; /* The attribut holding it */
+};
+
+/*
+ * A buffer structure
+ */
+
+typedef enum {
+ XML_BUFFER_ALLOC_DOUBLEIT,
+ XML_BUFFER_ALLOC_EXACT
+} xmlBufferAllocationScheme;
+
+typedef struct _xmlBuffer xmlBuffer;
+typedef xmlBuffer *xmlBufferPtr;
+struct _xmlBuffer {
+ xmlChar *content; /* The buffer content UTF8 */
+ unsigned int use; /* The buffer size used */
+ unsigned int size; /* The buffer size */
+ xmlBufferAllocationScheme alloc; /* The realloc method */
+};
+
+/*
+ * A node in an XML tree.
+ */
+typedef struct _xmlNode xmlNode;
+typedef xmlNode *xmlNodePtr;
+struct _xmlNode {
+#ifndef XML_WITHOUT_CORBA
+ void *_private; /* for Corba, must be first ! */
+#endif
+ xmlElementType type; /* type number, must be second ! */
+ const xmlChar *name; /* the name of the node, or the entity */
+ struct _xmlNode *children; /* parent->childs link */
+ struct _xmlNode *last; /* last child link */
+ struct _xmlNode *parent; /* child->parent link */
+ struct _xmlNode *next; /* next sibling link */
+ struct _xmlNode *prev; /* previous sibling link */
+ struct _xmlDoc *doc; /* the containing document */
+ xmlNs *ns; /* pointer to the associated namespace */
+#ifndef XML_USE_BUFFER_CONTENT
+ xmlChar *content; /* the content */
+#else
+ xmlBufferPtr content; /* the content in a buffer */
+#endif
+
+ /* End of common part */
+ struct _xmlAttr *properties;/* properties list */
+ xmlNs *nsDef; /* namespace definitions on this node */
+};
+
+/*
+ * An XML document.
+ */
+typedef struct _xmlDoc xmlDoc;
+typedef xmlDoc *xmlDocPtr;
+struct _xmlDoc {
+#ifndef XML_WITHOUT_CORBA
+ void *_private; /* for Corba, must be first ! */
+#endif
+ xmlElementType type; /* XML_DOCUMENT_NODE, must be second ! */
+ char *name; /* name/filename/URI of the document */
+ struct _xmlNode *children; /* the document tree */
+ struct _xmlNode *last; /* last child link */
+ struct _xmlNode *parent; /* child->parent link */
+ struct _xmlNode *next; /* next sibling link */
+ struct _xmlNode *prev; /* previous sibling link */
+ struct _xmlDoc *doc; /* autoreference to itself */
+
+ /* End of common part */
+ int compression;/* level of zlib compression */
+ int standalone; /* standalone document (no external refs) */
+ struct _xmlDtd *intSubset; /* the document internal subset */
+ struct _xmlDtd *extSubset; /* the document external subset */
+ struct _xmlNs *oldNs; /* Global namespace, the old way */
+ const xmlChar *version; /* the XML version string */
+ const xmlChar *encoding; /* external initial encoding, if any */
+ void *ids; /* Hash table for ID attributes if any */
+ void *refs; /* Hash table for IDREFs attributes if any */
+ const xmlChar *URL; /* The URI for that document */
+ int charset; /* encoding of the in-memory content
+ actually an xmlCharEncoding */
+};
+
+/*
+ * Compatibility naming layer with libxml1
+ */
+#ifndef xmlChildrenNode
+#define xmlChildrenNode children
+#define xmlRootNode children
+#endif
+
+/*
+ * Variables.
+ */
+LIBXML_DLL_IMPORT extern xmlNsPtr baseDTD;
+LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility;/* maintain compatibility with old WD */
+LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; /* try to indent the tree dumps */
+LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; /* alloc scheme to use */
+LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; /* save empty tags as <empty></empty> */
+
+/*
+ * Handling Buffers.
+ */
+
+xmlBufferPtr xmlBufferCreate (void);
+xmlBufferPtr xmlBufferCreateSize (size_t size);
+void xmlBufferFree (xmlBufferPtr buf);
+int xmlBufferDump (FILE *file,
+ xmlBufferPtr buf);
+void xmlBufferAdd (xmlBufferPtr buf,
+ const xmlChar *str,
+ int len);
+void xmlBufferAddHead (xmlBufferPtr buf,
+ const xmlChar *str,
+ int len);
+void xmlBufferCat (xmlBufferPtr buf,
+ const xmlChar *str);
+void xmlBufferCCat (xmlBufferPtr buf,
+ const char *str);
+int xmlBufferShrink (xmlBufferPtr buf,
+ unsigned int len);
+int xmlBufferGrow (xmlBufferPtr buf,
+ unsigned int len);
+void xmlBufferEmpty (xmlBufferPtr buf);
+const xmlChar* xmlBufferContent (const xmlBufferPtr buf);
+int xmlBufferUse (const xmlBufferPtr buf);
+void xmlBufferSetAllocationScheme(xmlBufferPtr buf,
+ xmlBufferAllocationScheme scheme);
+int xmlBufferLength (const xmlBufferPtr buf);
+
+/*
+ * Creating/freeing new structures
+ */
+xmlDtdPtr xmlCreateIntSubset (xmlDocPtr doc,
+ const xmlChar *name,
+ const xmlChar *ExternalID,
+ const xmlChar *SystemID);
+xmlDtdPtr xmlNewDtd (xmlDocPtr doc,
+ const xmlChar *name,
+ const xmlChar *ExternalID,
+ const xmlChar *SystemID);
+xmlDtdPtr xmlGetIntSubset (xmlDocPtr doc);
+void xmlFreeDtd (xmlDtdPtr cur);
+xmlNsPtr xmlNewGlobalNs (xmlDocPtr doc,
+ const xmlChar *href,
+ const xmlChar *prefix);
+xmlNsPtr xmlNewNs (xmlNodePtr node,
+ const xmlChar *href,
+ const xmlChar *prefix);
+void xmlFreeNs (xmlNsPtr cur);
+xmlDocPtr xmlNewDoc (const xmlChar *version);
+void xmlFreeDoc (xmlDocPtr cur);
+xmlAttrPtr xmlNewDocProp (xmlDocPtr doc,
+ const xmlChar *name,
+ const xmlChar *value);
+xmlAttrPtr xmlNewProp (xmlNodePtr node,
+ const xmlChar *name,
+ const xmlChar *value);
+xmlAttrPtr xmlNewNsProp (xmlNodePtr node,
+ xmlNsPtr ns,
+ const xmlChar *name,
+ const xmlChar *value);
+void xmlFreePropList (xmlAttrPtr cur);
+void xmlFreeProp (xmlAttrPtr cur);
+xmlAttrPtr xmlCopyProp (xmlNodePtr target,
+ xmlAttrPtr cur);
+xmlAttrPtr xmlCopyPropList (xmlNodePtr target,
+ xmlAttrPtr cur);
+xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd);
+xmlDocPtr xmlCopyDoc (xmlDocPtr doc,
+ int recursive);
+
+/*
+ * Creating new nodes
+ */
+xmlNodePtr xmlNewDocNode (xmlDocPtr doc,
+ xmlNsPtr ns,
+ const xmlChar *name,
+ const xmlChar *content);
+xmlNodePtr xmlNewDocRawNode (xmlDocPtr doc,
+ xmlNsPtr ns,
+ const xmlChar *name,
+ const xmlChar *content);
+xmlNodePtr xmlNewNode (xmlNsPtr ns,
+ const xmlChar *name);
+xmlNodePtr xmlNewChild (xmlNodePtr parent,
+ xmlNsPtr ns,
+ const xmlChar *name,
+ const xmlChar *content);
+xmlNodePtr xmlNewTextChild (xmlNodePtr parent,
+ xmlNsPtr ns,
+ const xmlChar *name,
+ const xmlChar *content);
+xmlNodePtr xmlNewDocText (xmlDocPtr doc,
+ const xmlChar *content);
+xmlNodePtr xmlNewText (const xmlChar *content);
+xmlNodePtr xmlNewPI (const xmlChar *name,
+ const xmlChar *content);
+xmlNodePtr xmlNewDocTextLen (xmlDocPtr doc,
+ const xmlChar *content,
+ int len);
+xmlNodePtr xmlNewTextLen (const xmlChar *content,
+ int len);
+xmlNodePtr xmlNewDocComment (xmlDocPtr doc,
+ const xmlChar *content);
+xmlNodePtr xmlNewComment (const xmlChar *content);
+xmlNodePtr xmlNewCDataBlock (xmlDocPtr doc,
+ const xmlChar *content,
+ int len);
+xmlNodePtr xmlNewCharRef (xmlDocPtr doc,
+ const xmlChar *name);
+xmlNodePtr xmlNewReference (xmlDocPtr doc,
+ const xmlChar *name);
+xmlNodePtr xmlCopyNode (xmlNodePtr node,
+ int recursive);
+xmlNodePtr xmlCopyNodeList (xmlNodePtr node);
+xmlNodePtr xmlNewDocFragment (xmlDocPtr doc);
+
+/*
+ * Navigating
+ */
+xmlNodePtr xmlDocGetRootElement (xmlDocPtr doc);
+xmlNodePtr xmlGetLastChild (xmlNodePtr parent);
+int xmlNodeIsText (xmlNodePtr node);
+int xmlIsBlankNode (xmlNodePtr node);
+
+/*
+ * Changing the structure
+ */
+xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc,
+ xmlNodePtr root);
+void xmlNodeSetName (xmlNodePtr cur,
+ const xmlChar *name);
+xmlNodePtr xmlAddChild (xmlNodePtr parent,
+ xmlNodePtr cur);
+xmlNodePtr xmlAddChildList (xmlNodePtr parent,
+ xmlNodePtr cur);
+xmlNodePtr xmlReplaceNode (xmlNodePtr old,
+ xmlNodePtr cur);
+xmlNodePtr xmlAddSibling (xmlNodePtr cur,
+ xmlNodePtr elem);
+xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur,
+ xmlNodePtr elem);
+xmlNodePtr xmlAddNextSibling (xmlNodePtr cur,
+ xmlNodePtr elem);
+void xmlUnlinkNode (xmlNodePtr cur);
+xmlNodePtr xmlTextMerge (xmlNodePtr first,
+ xmlNodePtr second);
+void xmlTextConcat (xmlNodePtr node,
+ const xmlChar *content,
+ int len);
+void xmlFreeNodeList (xmlNodePtr cur);
+void xmlFreeNode (xmlNodePtr cur);
+void xmlSetTreeDoc (xmlNodePtr tree,
+ xmlDocPtr doc);
+void xmlSetListDoc (xmlNodePtr list,
+ xmlDocPtr doc);
+
+/*
+ * Namespaces
+ */
+xmlNsPtr xmlSearchNs (xmlDocPtr doc,
+ xmlNodePtr node,
+ const xmlChar *nameSpace);
+xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc,
+ xmlNodePtr node,
+ const xmlChar *href);
+xmlNsPtr * xmlGetNsList (xmlDocPtr doc,
+ xmlNodePtr node);
+void xmlSetNs (xmlNodePtr node,
+ xmlNsPtr ns);
+xmlNsPtr xmlCopyNamespace (xmlNsPtr cur);
+xmlNsPtr xmlCopyNamespaceList (xmlNsPtr cur);
+
+/*
+ * Changing the content.
+ */
+xmlAttrPtr xmlSetProp (xmlNodePtr node,
+ const xmlChar *name,
+ const xmlChar *value);
+xmlChar * xmlGetProp (xmlNodePtr node,
+ const xmlChar *name);
+xmlAttrPtr xmlHasProp (xmlNodePtr node,
+ const xmlChar *name);
+xmlAttrPtr xmlSetNsProp (xmlNodePtr node,
+ xmlNsPtr ns,
+ const xmlChar *name,
+ const xmlChar *value);
+xmlChar * xmlGetNsProp (xmlNodePtr node,
+ const xmlChar *name,
+ const xmlChar *nameSpace);
+xmlNodePtr xmlStringGetNodeList (xmlDocPtr doc,
+ const xmlChar *value);
+xmlNodePtr xmlStringLenGetNodeList (xmlDocPtr doc,
+ const xmlChar *value,
+ int len);
+xmlChar * xmlNodeListGetString (xmlDocPtr doc,
+ xmlNodePtr list,
+ int inLine);
+xmlChar * xmlNodeListGetRawString (xmlDocPtr doc,
+ xmlNodePtr list,
+ int inLine);
+void xmlNodeSetContent (xmlNodePtr cur,
+ const xmlChar *content);
+void xmlNodeSetContentLen (xmlNodePtr cur,
+ const xmlChar *content,
+ int len);
+void xmlNodeAddContent (xmlNodePtr cur,
+ const xmlChar *content);
+void xmlNodeAddContentLen (xmlNodePtr cur,
+ const xmlChar *content,
+ int len);
+xmlChar * xmlNodeGetContent (xmlNodePtr cur);
+xmlChar * xmlNodeGetLang (xmlNodePtr cur);
+void xmlNodeSetLang (xmlNodePtr cur,
+ const xmlChar *lang);
+int xmlNodeGetSpacePreserve (xmlNodePtr cur);
+void xmlNodeSetSpacePreserve (xmlNodePtr cur, int
+ val);
+xmlChar * xmlNodeGetBase (xmlDocPtr doc,
+ xmlNodePtr cur);
+void xmlNodeSetBase (xmlNodePtr cur,
+ xmlChar *uri);
+
+/*
+ * Removing content.
+ */
+int xmlRemoveProp (xmlAttrPtr attr);
+int xmlRemoveNode (xmlNodePtr node); /* TODO */
+
+/*
+ * Internal, don't use
+ */
+#ifdef VMS
+void xmlBufferWriteXmlCHAR (xmlBufferPtr buf,
+ const xmlChar *string);
+#define xmlBufferWriteCHAR xmlBufferWriteXmlCHAR
+#else
+void xmlBufferWriteCHAR (xmlBufferPtr buf,
+ const xmlChar *string);
+#endif
+void xmlBufferWriteChar (xmlBufferPtr buf,
+ const char *string);
+void xmlBufferWriteQuotedString(xmlBufferPtr buf,
+ const xmlChar *string);
+
+/*
+ * Namespace handling
+ */
+int xmlReconciliateNs (xmlDocPtr doc,
+ xmlNodePtr tree);
+
+/*
+ * Saving
+ */
+void xmlDocDumpFormatMemory (xmlDocPtr cur,
+ xmlChar**mem,
+ int *size,
+ int format);
+void xmlDocDumpMemory (xmlDocPtr cur,
+ xmlChar**mem,
+ int *size);
+void xmlDocDumpMemoryEnc (xmlDocPtr out_doc,
+ xmlChar **doc_txt_ptr,
+ int * doc_txt_len,
+ const char *txt_encoding);
+void xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc,
+ xmlChar **doc_txt_ptr,
+ int * doc_txt_len,
+ const char *txt_encoding,
+ int format);
+int xmlDocDump (FILE *f,
+ xmlDocPtr cur);
+void xmlElemDump (FILE *f,
+ xmlDocPtr doc,
+ xmlNodePtr cur);
+int xmlSaveFile (const char *filename,
+ xmlDocPtr cur);
+void xmlNodeDump (xmlBufferPtr buf,
+ xmlDocPtr doc,
+ xmlNodePtr cur,
+ int level,
+ int format);
+
+/* This one is exported from xmlIO.h
+
+int xmlSaveFileTo (xmlOutputBuffer *buf,
+ xmlDocPtr cur,
+ const char *encoding);
+ */
+
+int xmlSaveFileEnc (const char *filename,
+ xmlDocPtr cur,
+ const char *encoding);
+
+/*
+ * Compression
+ */
+int xmlGetDocCompressMode (xmlDocPtr doc);
+void xmlSetDocCompressMode (xmlDocPtr doc,
+ int mode);
+int xmlGetCompressMode (void);
+void xmlSetCompressMode (int mode);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_TREE_H__ */
+
diff --git a/include/libxml/uri.h b/include/libxml/uri.h
new file mode 100644
index 0000000..e7aeda4
--- /dev/null
+++ b/include/libxml/uri.h
@@ -0,0 +1,61 @@
+/**
+ * uri.c: library of generic URI related routines
+ *
+ * Reference: RFC 2396
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __XML_URI_H__
+#define __XML_URI_H__
+
+#include <libxml/tree.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *
+ */
+typedef struct _xmlURI xmlURI;
+typedef xmlURI *xmlURIPtr;
+struct _xmlURI {
+ char *scheme;
+ char *opaque;
+ char *authority;
+ char *server;
+ char *user;
+ int port;
+ char *path;
+ char *query;
+ char *fragment;
+};
+
+/*
+ * This function is in tree.h:
+ * xmlChar * xmlNodeGetBase (xmlDocPtr doc,
+ * xmlNodePtr cur);
+ */
+xmlURIPtr xmlCreateURI (void);
+xmlChar * xmlBuildURI (const xmlChar *URI,
+ const xmlChar *base);
+xmlURIPtr xmlParseURI (const char *URI);
+int xmlParseURIReference (xmlURIPtr uri,
+ const char *str);
+xmlChar * xmlSaveUri (xmlURIPtr uri);
+void xmlPrintURI (FILE *stream,
+ xmlURIPtr uri);
+char * xmlURIUnescapeString (const char *str,
+ int len,
+ char *target);
+int xmlNormalizeURIPath (char *path);
+xmlChar * xmlURIEscape (const xmlChar *str);
+void xmlFreeURI (xmlURIPtr uri);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_URI_H__ */
diff --git a/include/libxml/valid.h b/include/libxml/valid.h
new file mode 100644
index 0000000..a7eb675
--- /dev/null
+++ b/include/libxml/valid.h
@@ -0,0 +1,236 @@
+/*
+ * valid.h : interface to the DTD handling and the validity checking
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+
+#ifndef __XML_VALID_H__
+#define __XML_VALID_H__
+
+#include <libxml/tree.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * an xmlValidCtxt is used for error reporting when validating
+ */
+
+typedef void (*xmlValidityErrorFunc) (void *ctx, const char *msg, ...);
+typedef void (*xmlValidityWarningFunc) (void *ctx, const char *msg, ...);
+
+typedef struct _xmlValidCtxt xmlValidCtxt;
+typedef xmlValidCtxt *xmlValidCtxtPtr;
+struct _xmlValidCtxt {
+ void *userData; /* user specific data block */
+ xmlValidityErrorFunc error; /* the callback in case of errors */
+ xmlValidityWarningFunc warning; /* the callback in case of warning */
+
+ /* Node analysis stack used when validating within entities */
+ xmlNodePtr node; /* Current parsed Node */
+ int nodeNr; /* Depth of the parsing stack */
+ int nodeMax; /* Max depth of the parsing stack */
+ xmlNodePtr *nodeTab; /* array of nodes */
+
+ int finishDtd; /* finished validating the Dtd ? */
+ xmlDocPtr doc; /* the document */
+ int valid; /* temporary validity check result */
+};
+
+/*
+ * ALl notation declarations are stored in a table
+ * there is one table per DTD
+ */
+
+typedef struct _xmlHashTable xmlNotationTable;
+typedef xmlNotationTable *xmlNotationTablePtr;
+
+/*
+ * ALl element declarations are stored in a table
+ * there is one table per DTD
+ */
+
+typedef struct _xmlHashTable xmlElementTable;
+typedef xmlElementTable *xmlElementTablePtr;
+
+/*
+ * ALl attribute declarations are stored in a table
+ * there is one table per DTD
+ */
+
+typedef struct _xmlHashTable xmlAttributeTable;
+typedef xmlAttributeTable *xmlAttributeTablePtr;
+
+/*
+ * ALl IDs attributes are stored in a table
+ * there is one table per document
+ */
+
+typedef struct _xmlHashTable xmlIDTable;
+typedef xmlIDTable *xmlIDTablePtr;
+
+/*
+ * ALl Refs attributes are stored in a table
+ * there is one table per document
+ */
+
+typedef struct _xmlHashTable xmlRefTable;
+typedef xmlRefTable *xmlRefTablePtr;
+
+/* helper */
+xmlChar * xmlSplitQName2 (const xmlChar *name,
+ xmlChar **prefix);
+
+/* Notation */
+xmlNotationPtr xmlAddNotationDecl (xmlValidCtxtPtr ctxt,
+ xmlDtdPtr dtd,
+ const xmlChar *name,
+ const xmlChar *PublicID,
+ const xmlChar *SystemID);
+xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table);
+void xmlFreeNotationTable(xmlNotationTablePtr table);
+void xmlDumpNotationDecl (xmlBufferPtr buf,
+ xmlNotationPtr nota);
+void xmlDumpNotationTable(xmlBufferPtr buf,
+ xmlNotationTablePtr table);
+
+/* Element Content */
+xmlElementContentPtr xmlNewElementContent (xmlChar *name,
+ xmlElementContentType type);
+xmlElementContentPtr xmlCopyElementContent(xmlElementContentPtr content);
+void xmlFreeElementContent(xmlElementContentPtr cur);
+void xmlSprintfElementContent(char *buf,
+ xmlElementContentPtr content,
+ int glob);
+
+/* Element */
+xmlElementPtr xmlAddElementDecl (xmlValidCtxtPtr ctxt,
+ xmlDtdPtr dtd,
+ const xmlChar *name,
+ xmlElementTypeVal type,
+ xmlElementContentPtr content);
+xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table);
+void xmlFreeElementTable (xmlElementTablePtr table);
+void xmlDumpElementTable (xmlBufferPtr buf,
+ xmlElementTablePtr table);
+void xmlDumpElementDecl (xmlBufferPtr buf,
+ xmlElementPtr elem);
+
+/* Enumeration */
+xmlEnumerationPtr xmlCreateEnumeration (xmlChar *name);
+void xmlFreeEnumeration (xmlEnumerationPtr cur);
+xmlEnumerationPtr xmlCopyEnumeration (xmlEnumerationPtr cur);
+
+/* Attribute */
+xmlAttributePtr xmlAddAttributeDecl (xmlValidCtxtPtr ctxt,
+ xmlDtdPtr dtd,
+ const xmlChar *elem,
+ const xmlChar *name,
+ const xmlChar *ns,
+ xmlAttributeType type,
+ xmlAttributeDefault def,
+ const xmlChar *defaultValue,
+ xmlEnumerationPtr tree);
+xmlAttributeTablePtr xmlCopyAttributeTable (xmlAttributeTablePtr table);
+void xmlFreeAttributeTable (xmlAttributeTablePtr table);
+void xmlDumpAttributeTable (xmlBufferPtr buf,
+ xmlAttributeTablePtr table);
+void xmlDumpAttributeDecl (xmlBufferPtr buf,
+ xmlAttributePtr attr);
+
+/* IDs */
+xmlIDPtr xmlAddID (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc,
+ const xmlChar *value,
+ xmlAttrPtr attr);
+xmlIDTablePtr xmlCopyIDTable (xmlIDTablePtr table);
+void xmlFreeIDTable (xmlIDTablePtr table);
+xmlAttrPtr xmlGetID (xmlDocPtr doc,
+ const xmlChar *ID);
+int xmlIsID (xmlDocPtr doc,
+ xmlNodePtr elem,
+ xmlAttrPtr attr);
+int xmlRemoveID (xmlDocPtr doc, xmlAttrPtr attr);
+
+/* IDREFs */
+xmlRefPtr xmlAddRef (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc,
+ const xmlChar *value,
+ xmlAttrPtr attr);
+xmlRefTablePtr xmlCopyRefTable (xmlRefTablePtr table);
+void xmlFreeRefTable (xmlRefTablePtr table);
+int xmlIsRef (xmlDocPtr doc,
+ xmlNodePtr elem,
+ xmlAttrPtr attr);
+int xmlRemoveRef (xmlDocPtr doc, xmlAttrPtr attr);
+
+/**
+ * The public function calls related to validity checking
+ */
+
+int xmlValidateRoot (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc);
+int xmlValidateElementDecl (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc,
+ xmlElementPtr elem);
+xmlChar * xmlValidNormalizeAttributeValue(xmlDocPtr doc,
+ xmlNodePtr elem,
+ const xmlChar *name,
+ const xmlChar *value);
+int xmlValidateAttributeDecl(xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc,
+ xmlAttributePtr attr);
+int xmlValidateAttributeValue(xmlAttributeType type,
+ const xmlChar *value);
+int xmlValidateNotationDecl (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc,
+ xmlNotationPtr nota);
+int xmlValidateDtd (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc,
+ xmlDtdPtr dtd);
+int xmlValidateDtdFinal (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc);
+int xmlValidateDocument (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc);
+int xmlValidateElement (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc,
+ xmlNodePtr elem);
+int xmlValidateOneElement (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc,
+ xmlNodePtr elem);
+int xmlValidateOneAttribute (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc,
+ xmlNodePtr elem,
+ xmlAttrPtr attr,
+ const xmlChar *value);
+int xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc);
+int xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
+ xmlDocPtr doc,
+ const xmlChar *notationName);
+int xmlIsMixedElement (xmlDocPtr doc,
+ const xmlChar *name);
+xmlAttributePtr xmlGetDtdAttrDesc (xmlDtdPtr dtd,
+ const xmlChar *elem,
+ const xmlChar *name);
+xmlNotationPtr xmlGetDtdNotationDesc (xmlDtdPtr dtd,
+ const xmlChar *name);
+xmlElementPtr xmlGetDtdElementDesc (xmlDtdPtr dtd,
+ const xmlChar *name);
+
+int xmlValidGetValidElements(xmlNode *prev,
+ xmlNode *next,
+ const xmlChar **list,
+ int max);
+int xmlValidGetPotentialChildren(xmlElementContent *ctree,
+ const xmlChar **list,
+ int *len,
+ int max);
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_VALID_H__ */
diff --git a/include/libxml/xinclude.h b/include/libxml/xinclude.h
new file mode 100644
index 0000000..eca4588
--- /dev/null
+++ b/include/libxml/xinclude.h
@@ -0,0 +1,26 @@
+/*
+ * xinclude.c : API to handle XInclude processing
+ *
+ * World Wide Web Consortium Working Draft 26 October 2000
+ * http://www.w3.org/TR/2000/WD-xinclude-20001026
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __XML_XINCLUDE_H__
+#define __XML_XINCLUDE_H__
+
+#include <libxml/tree.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int xmlXIncludeProcess (xmlDocPtr doc);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_XINCLUDE_H__ */
diff --git a/include/libxml/xlink.h b/include/libxml/xlink.h
new file mode 100644
index 0000000..37a5415
--- /dev/null
+++ b/include/libxml/xlink.h
@@ -0,0 +1,182 @@
+/*
+ * xlink.h : interfaces to the hyperlinks detection module
+ *
+ * See Copyright for the status of this software.
+ *
+ * Related specification: http://www.w3.org/TR/xlink
+ * http://www.w3.org/HTML/
+ * and XBase
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __XML_XLINK_H__
+#define __XML_XLINK_H__
+
+#include <libxml/tree.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * Various defines for the various Link properties.
+ *
+ * NOTE: the link detection layer will try to resolve QName expansion
+ * of namespaces, if "foo" is the prefix for "http://foo.com/"
+ * then the link detection layer will expand role="foo:myrole"
+ * to "http://foo.com/:myrole"
+ * NOTE: the link detection layer will expand URI-Refences found on
+ * href attributes by using the base mechanism if found.
+ */
+typedef xmlChar *xlinkHRef;
+typedef xmlChar *xlinkRole;
+typedef xmlChar *xlinkTitle;
+
+typedef enum {
+ XLINK_TYPE_NONE = 0,
+ XLINK_TYPE_SIMPLE,
+ XLINK_TYPE_EXTENDED,
+ XLINK_TYPE_EXTENDED_SET
+} xlinkType;
+
+typedef enum {
+ XLINK_SHOW_NONE = 0,
+ XLINK_SHOW_NEW,
+ XLINK_SHOW_EMBED,
+ XLINK_SHOW_REPLACE
+} xlinkShow;
+
+typedef enum {
+ XLINK_ACTUATE_NONE = 0,
+ XLINK_ACTUATE_AUTO,
+ XLINK_ACTUATE_ONREQUEST
+} xlinkActuate;
+
+/**
+ * xlinkNodeDetectFunc:
+ * @ctx: user data pointer
+ * @node: the node to check
+ *
+ * This is the prototype for the link detection routine
+ * It calls the default link detection callbacks upon link detection.
+ */
+typedef void
+(*xlinkNodeDetectFunc) (void *ctx,
+ xmlNodePtr node);
+
+/**
+ * The link detection module interract with the upper layers using
+ * a set of callback registered at parsing time.
+ */
+
+/**
+ * xlinkSimpleLinkFunk:
+ * @ctx: user data pointer
+ * @node: the node carrying the link
+ * @href: the target of the link
+ * @role: the role string
+ * @title: the link title
+ *
+ * This is the prototype for a simple link detection callback.
+ */
+typedef void
+(*xlinkSimpleLinkFunk) (void *ctx,
+ xmlNodePtr node,
+ const xlinkHRef href,
+ const xlinkRole role,
+ const xlinkTitle title);
+
+/**
+ * xlinkExtendedLinkFunk:
+ * @ctx: user data pointer
+ * @node: the node carrying the link
+ * @nbLocators: the number of locators detected on the link
+ * @hrefs: pointer to the array of locator hrefs
+ * @roles: pointer to the array of locator roles
+ * @nbArcs: the number of arcs detected on the link
+ * @from: pointer to the array of source roles found on the arcs
+ * @to: pointer to the array of target roles found on the arcs
+ * @show: array of values for the show attributes found on the arcs
+ * @actuate: array of values for the actuate attributes found on the arcs
+ * @nbTitles: the number of titles detected on the link
+ * @title: array of titles detected on the link
+ * @langs: array of xml:lang values for the titles
+ *
+ * This is the prototype for a extended link detection callback.
+ */
+typedef void
+(*xlinkExtendedLinkFunk)(void *ctx,
+ xmlNodePtr node,
+ int nbLocators,
+ const xlinkHRef *hrefs,
+ const xlinkRole *roles,
+ int nbArcs,
+ const xlinkRole *from,
+ const xlinkRole *to,
+ xlinkShow *show,
+ xlinkActuate *actuate,
+ int nbTitles,
+ const xlinkTitle *titles,
+ const xmlChar **langs);
+
+/**
+ * xlinkExtendedLinkSetFunk:
+ * @ctx: user data pointer
+ * @node: the node carrying the link
+ * @nbLocators: the number of locators detected on the link
+ * @hrefs: pointer to the array of locator hrefs
+ * @roles: pointer to the array of locator roles
+ * @nbTitles: the number of titles detected on the link
+ * @title: array of titles detected on the link
+ * @langs: array of xml:lang values for the titles
+ *
+ * This is the prototype for a extended link set detection callback.
+ */
+typedef void
+(*xlinkExtendedLinkSetFunk) (void *ctx,
+ xmlNodePtr node,
+ int nbLocators,
+ const xlinkHRef *hrefs,
+ const xlinkRole *roles,
+ int nbTitles,
+ const xlinkTitle *titles,
+ const xmlChar **langs);
+
+/**
+ * This is the structure containing a set of Links detection callbacks
+ *
+ * There is no default xlink callbacks, if one want to get link
+ * recognition activated, those call backs must be provided before parsing.
+ */
+typedef struct _xlinkHandler xlinkHandler;
+typedef xlinkHandler *xlinkHandlerPtr;
+struct _xlinkHandler {
+ xlinkSimpleLinkFunk simple;
+ xlinkExtendedLinkFunk extended;
+ xlinkExtendedLinkSetFunk set;
+};
+
+/**
+ * the default detection routine, can be overriden, they call the default
+ * detection callbacks.
+ */
+
+xlinkNodeDetectFunc xlinkGetDefaultDetect (void);
+void xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
+
+/**
+ * Routines to set/get the default handlers.
+ */
+xlinkHandlerPtr xlinkGetDefaultHandler (void);
+void xlinkSetDefaultHandler (xlinkHandlerPtr handler);
+
+/*
+ * Link detection module itself.
+ */
+xlinkType xlinkIsLink (xmlDocPtr doc,
+ xmlNodePtr node);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_XLINK_H__ */
diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h
new file mode 100644
index 0000000..ecff73b
--- /dev/null
+++ b/include/libxml/xmlIO.h
@@ -0,0 +1,178 @@
+/*
+ * xmlIO.h : interface for the I/O interfaces used by the parser
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ *
+ * 15 Nov 2000 ht - modified for VMS
+ */
+
+#ifndef __XML_IO_H__
+#define __XML_IO_H__
+
+#include <stdio.h>
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/encoding.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Those are the functions and datatypes for the parser input
+ * I/O structures.
+ */
+
+typedef int (*xmlInputMatchCallback) (char const *filename);
+typedef void * (*xmlInputOpenCallback) (char const *filename);
+typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
+typedef void (*xmlInputCloseCallback) (void * context);
+
+typedef struct _xmlParserInputBuffer xmlParserInputBuffer;
+typedef xmlParserInputBuffer *xmlParserInputBufferPtr;
+struct _xmlParserInputBuffer {
+ void* context;
+ xmlInputReadCallback readcallback;
+ xmlInputCloseCallback closecallback;
+
+ xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
+
+ xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 */
+ xmlBufferPtr raw; /* if encoder != NULL buffer for raw input */
+};
+
+
+/*
+ * Those are the functions and datatypes for the library output
+ * I/O structures.
+ */
+
+typedef int (*xmlOutputMatchCallback) (char const *filename);
+typedef void * (*xmlOutputOpenCallback) (char const *filename);
+typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
+ int len);
+typedef void (*xmlOutputCloseCallback) (void * context);
+
+typedef struct _xmlOutputBuffer xmlOutputBuffer;
+typedef xmlOutputBuffer *xmlOutputBufferPtr;
+struct _xmlOutputBuffer {
+ void* context;
+ xmlOutputWriteCallback writecallback;
+ xmlOutputCloseCallback closecallback;
+
+ xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
+
+ xmlBufferPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */
+ xmlBufferPtr conv; /* if encoder != NULL buffer for output */
+ int written; /* total number of byte written */
+};
+
+/*
+ * Interfaces for input
+ */
+
+void xmlRegisterDefaultInputCallbacks (void);
+xmlParserInputBufferPtr
+ xmlAllocParserInputBuffer (xmlCharEncoding enc);
+
+#ifdef VMS
+xmlParserInputBufferPtr
+ xmlParserInputBufferCreateFname (const char *URI,
+ xmlCharEncoding enc);
+#define xmlParserInputBufferCreateFilename xmlParserInputBufferCreateFname
+#else
+xmlParserInputBufferPtr
+ xmlParserInputBufferCreateFilename (const char *URI,
+ xmlCharEncoding enc);
+#endif
+
+xmlParserInputBufferPtr
+ xmlParserInputBufferCreateFile (FILE *file,
+ xmlCharEncoding enc);
+xmlParserInputBufferPtr
+ xmlParserInputBufferCreateFd (int fd,
+ xmlCharEncoding enc);
+xmlParserInputBufferPtr
+ xmlParserInputBufferCreateMem (const char *mem, int size,
+ xmlCharEncoding enc);
+xmlParserInputBufferPtr
+ xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
+ xmlInputCloseCallback ioclose,
+ void *ioctx,
+ xmlCharEncoding enc);
+int xmlParserInputBufferRead (xmlParserInputBufferPtr in,
+ int len);
+int xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
+ int len);
+int xmlParserInputBufferPush (xmlParserInputBufferPtr in,
+ int len,
+ const char *buf);
+void xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
+char * xmlParserGetDirectory (const char *filename);
+
+int xmlRegisterInputCallbacks (xmlInputMatchCallback match,
+ xmlInputOpenCallback open,
+ xmlInputReadCallback read,
+ xmlInputCloseCallback close);
+/*
+ * Interfaces for output
+ */
+void xmlRegisterDefaultOutputCallbacks(void);
+xmlOutputBufferPtr
+ xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
+
+xmlOutputBufferPtr
+ xmlOutputBufferCreateFilename (const char *URI,
+ xmlCharEncodingHandlerPtr encoder,
+ int compression);
+
+xmlOutputBufferPtr
+ xmlOutputBufferCreateFile (FILE *file,
+ xmlCharEncodingHandlerPtr encoder);
+
+xmlOutputBufferPtr
+ xmlOutputBufferCreateFd (int fd,
+ xmlCharEncodingHandlerPtr encoder);
+
+xmlOutputBufferPtr
+ xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
+ xmlOutputCloseCallback ioclose,
+ void *ioctx,
+ xmlCharEncodingHandlerPtr encoder);
+
+int xmlOutputBufferWrite (xmlOutputBufferPtr out,
+ int len,
+ const char *buf);
+int xmlOutputBufferWriteString (xmlOutputBufferPtr out,
+ const char *str);
+
+int xmlOutputBufferFlush (xmlOutputBufferPtr out);
+int xmlOutputBufferClose (xmlOutputBufferPtr out);
+
+int xmlRegisterOutputCallbacks (xmlOutputMatchCallback match,
+ xmlOutputOpenCallback open,
+ xmlOutputWriteCallback write,
+ xmlOutputCloseCallback close);
+
+/*
+ * This save function are part of tree.h and HTMLtree.h actually
+ */
+int xmlSaveFileTo (xmlOutputBuffer *buf,
+ xmlDocPtr cur,
+ const char *encoding);
+void xmlNodeDumpOutput (xmlOutputBufferPtr buf,
+ xmlDocPtr doc,
+ xmlNodePtr cur,
+ int level,
+ int format,
+ const char *encoding);
+void htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
+ xmlDocPtr cur,
+ const char *encoding);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __XML_IO_H__ */
diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h
new file mode 100644
index 0000000..53c5751
--- /dev/null
+++ b/include/libxml/xmlerror.h
@@ -0,0 +1,180 @@
+#ifndef __XML_ERROR_H__
+#define __XML_ERROR_H__
+
+#include <libxml/parser.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ XML_ERR_OK = 0,
+ XML_ERR_INTERNAL_ERROR,
+ XML_ERR_NO_MEMORY,
+
+ XML_ERR_DOCUMENT_START, /* 3 */
+ XML_ERR_DOCUMENT_EMPTY,
+ XML_ERR_DOCUMENT_END,
+
+ XML_ERR_INVALID_HEX_CHARREF, /* 6 */
+ XML_ERR_INVALID_DEC_CHARREF,
+ XML_ERR_INVALID_CHARREF,
+ XML_ERR_INVALID_CHAR,
+
+ XML_ERR_CHARREF_AT_EOF, /* 10 */
+ XML_ERR_CHARREF_IN_PROLOG,
+ XML_ERR_CHARREF_IN_EPILOG,
+ XML_ERR_CHARREF_IN_DTD,
+ XML_ERR_ENTITYREF_AT_EOF,
+ XML_ERR_ENTITYREF_IN_PROLOG,
+ XML_ERR_ENTITYREF_IN_EPILOG,
+ XML_ERR_ENTITYREF_IN_DTD,
+ XML_ERR_PEREF_AT_EOF,
+ XML_ERR_PEREF_IN_PROLOG,
+ XML_ERR_PEREF_IN_EPILOG,
+ XML_ERR_PEREF_IN_INT_SUBSET,
+
+ XML_ERR_ENTITYREF_NO_NAME, /* 22 */
+ XML_ERR_ENTITYREF_SEMICOL_MISSING,
+
+ XML_ERR_PEREF_NO_NAME, /* 24 */
+ XML_ERR_PEREF_SEMICOL_MISSING,
+
+ XML_ERR_UNDECLARED_ENTITY, /* 26 */
+ XML_WAR_UNDECLARED_ENTITY,
+ XML_ERR_UNPARSED_ENTITY,
+ XML_ERR_ENTITY_IS_EXTERNAL,
+ XML_ERR_ENTITY_IS_PARAMETER,
+
+ XML_ERR_UNKNOWN_ENCODING, /* 31 */
+ XML_ERR_UNSUPPORTED_ENCODING,
+
+ XML_ERR_STRING_NOT_STARTED, /* 33 */
+ XML_ERR_STRING_NOT_CLOSED,
+ XML_ERR_NS_DECL_ERROR,
+
+ XML_ERR_ENTITY_NOT_STARTED, /* 36 */
+ XML_ERR_ENTITY_NOT_FINISHED,
+
+ XML_ERR_LT_IN_ATTRIBUTE, /* 38 */
+ XML_ERR_ATTRIBUTE_NOT_STARTED,
+ XML_ERR_ATTRIBUTE_NOT_FINISHED,
+ XML_ERR_ATTRIBUTE_WITHOUT_VALUE,
+ XML_ERR_ATTRIBUTE_REDEFINED,
+
+ XML_ERR_LITERAL_NOT_STARTED, /* 43 */
+ XML_ERR_LITERAL_NOT_FINISHED,
+
+ XML_ERR_COMMENT_NOT_FINISHED, /* 45 */
+
+ XML_ERR_PI_NOT_STARTED, /* 47 */
+ XML_ERR_PI_NOT_FINISHED,
+
+ XML_ERR_NOTATION_NOT_STARTED, /* 49 */
+ XML_ERR_NOTATION_NOT_FINISHED,
+
+ XML_ERR_ATTLIST_NOT_STARTED, /* 51 */
+ XML_ERR_ATTLIST_NOT_FINISHED,
+
+ XML_ERR_MIXED_NOT_STARTED, /* 53 */
+ XML_ERR_MIXED_NOT_FINISHED,
+
+ XML_ERR_ELEMCONTENT_NOT_STARTED, /* 55 */
+ XML_ERR_ELEMCONTENT_NOT_FINISHED,
+
+ XML_ERR_XMLDECL_NOT_STARTED, /* 57 */
+ XML_ERR_XMLDECL_NOT_FINISHED,
+
+ XML_ERR_CONDSEC_NOT_STARTED, /* 59 */
+ XML_ERR_CONDSEC_NOT_FINISHED,
+
+ XML_ERR_EXT_SUBSET_NOT_FINISHED, /* 61 */
+
+ XML_ERR_DOCTYPE_NOT_FINISHED, /* 62 */
+
+ XML_ERR_MISPLACED_CDATA_END, /* 63 */
+ XML_ERR_CDATA_NOT_FINISHED,
+
+ XML_ERR_RESERVED_XML_NAME, /* 65 */
+
+ XML_ERR_SPACE_REQUIRED, /* 66 */
+ XML_ERR_SEPARATOR_REQUIRED,
+ XML_ERR_NMTOKEN_REQUIRED,
+ XML_ERR_NAME_REQUIRED,
+ XML_ERR_PCDATA_REQUIRED,
+ XML_ERR_URI_REQUIRED,
+ XML_ERR_PUBID_REQUIRED,
+ XML_ERR_LT_REQUIRED,
+ XML_ERR_GT_REQUIRED,
+ XML_ERR_LTSLASH_REQUIRED,
+ XML_ERR_EQUAL_REQUIRED,
+
+ XML_ERR_TAG_NAME_MISMATCH, /* 77 */
+ XML_ERR_TAG_NOT_FINISED,
+
+ XML_ERR_STANDALONE_VALUE, /* 79 */
+
+ XML_ERR_ENCODING_NAME, /* 80 */
+
+ XML_ERR_HYPHEN_IN_COMMENT, /* 81 */
+
+ XML_ERR_INVALID_ENCODING, /* 82 */
+
+ XML_ERR_EXT_ENTITY_STANDALONE, /* 83 */
+
+ XML_ERR_CONDSEC_INVALID, /* 84 */
+
+ XML_ERR_VALUE_REQUIRED, /* 85 */
+
+ XML_ERR_NOT_WELL_BALANCED, /* 86 */
+ XML_ERR_EXTRA_CONTENT, /* 87 */
+ XML_ERR_ENTITY_CHAR_ERROR, /* 88 */
+ XML_ERR_ENTITY_PE_INTERNAL, /* 88 */
+ XML_ERR_ENTITY_LOOP, /* 89 */
+ XML_ERR_ENTITY_BOUNDARY, /* 90 */
+ XML_ERR_INVALID_URI, /* 91 */
+ XML_ERR_URI_FRAGMENT /* 92 */
+}xmlParserErrors;
+
+/*
+ * Signature of the function to use when there is an error and
+ * no parsing or validity context available
+ */
+typedef void (*xmlGenericErrorFunc) (void *ctx, const char *msg, ...);
+
+/*
+ * Those are the default error function and associated context to use
+ * when when there is an error and no parsing or validity context available
+ */
+
+LIBXML_DLL_IMPORT extern xmlGenericErrorFunc xmlGenericError;
+LIBXML_DLL_IMPORT extern void *xmlGenericErrorContext;
+
+/*
+ * Use the following function to reset the two previous global variables.
+ */
+void xmlSetGenericErrorFunc (void *ctx,
+ xmlGenericErrorFunc handler);
+
+/*
+ * Default message routines used by SAX and Valid context for error
+ * and warning reporting
+ */
+void xmlParserError (void *ctx,
+ const char *msg,
+ ...);
+void xmlParserWarning (void *ctx,
+ const char *msg,
+ ...);
+void xmlParserValidityError (void *ctx,
+ const char *msg,
+ ...);
+void xmlParserValidityWarning(void *ctx,
+ const char *msg,
+ ...);
+void xmlParserPrintFileInfo (xmlParserInputPtr input);
+void xmlParserPrintFileContext(xmlParserInputPtr input);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_ERROR_H__ */
diff --git a/include/libxml/xmlmemory.h b/include/libxml/xmlmemory.h
new file mode 100644
index 0000000..1e533d1
--- /dev/null
+++ b/include/libxml/xmlmemory.h
@@ -0,0 +1,91 @@
+/*
+ * xmlmemory.h: interface for the memory allocation debug.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+
+#ifndef _DEBUG_MEMORY_ALLOC_
+#define _DEBUG_MEMORY_ALLOC_
+
+#include <stdio.h>
+#include <libxml/xmlversion.h>
+
+/*
+ * DEBUG_MEMORY_LOCATION should be activated only done when debugging
+ * libxml.
+ */
+/* #define DEBUG_MEMORY_LOCATION */
+
+#ifdef DEBUG
+#ifndef DEBUG_MEMORY
+#define DEBUG_MEMORY
+#endif
+#endif
+
+#ifdef DEBUG_MEMORY_LOCATION
+#define MEM_LIST /* keep a list of all the allocated memory blocks */
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The XML memory wrapper support 4 basic overloadable functions
+ */
+typedef void (*xmlFreeFunc)(void *);
+typedef void *(*xmlMallocFunc)(int);
+typedef void *(*xmlReallocFunc)(void *, int);
+typedef char *(*xmlStrdupFunc)(const char *);
+
+/*
+ * The 4 interfaces used for all memory handling within libxml
+ */
+LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree;
+LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc;
+LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc;
+LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup;
+
+/*
+ * The way to overload the existing functions
+ */
+int xmlMemSetup (xmlFreeFunc freeFunc,
+ xmlMallocFunc mallocFunc,
+ xmlReallocFunc reallocFunc,
+ xmlStrdupFunc strdupFunc);
+int xmlMemGet (xmlFreeFunc *freeFunc,
+ xmlMallocFunc *mallocFunc,
+ xmlReallocFunc *reallocFunc,
+ xmlStrdupFunc *strdupFunc);
+
+/*
+ * Initialization of the memory layer
+ */
+int xmlInitMemory (void);
+
+/*
+ * Those are specific to the XML debug memory wrapper
+ */
+int xmlMemUsed (void);
+void xmlMemDisplay (FILE *fp);
+void xmlMemShow (FILE *fp, int nr);
+void xmlMemoryDump (void);
+int xmlInitMemory (void);
+
+#ifdef DEBUG_MEMORY_LOCATION
+#define xmlMalloc(x) xmlMallocLoc((x), __FILE__, __LINE__)
+#define xmlRealloc(p, x) xmlReallocLoc((p), (x), __FILE__, __LINE__)
+#define xmlMemStrdup(x) xmlMemStrdupLoc((x), __FILE__, __LINE__)
+
+void * xmlMallocLoc(int size, const char *file, int line);
+void * xmlReallocLoc(void *ptr,int size, const char *file, int line);
+char * xmlMemStrdupLoc(const char *str, const char *file, int line);
+#endif /* DEBUG_MEMORY_LOCATION */
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _DEBUG_MEMORY_ALLOC_ */
+
diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in
new file mode 100644
index 0000000..71ab184
--- /dev/null
+++ b/include/libxml/xmlversion.h.in
@@ -0,0 +1,129 @@
+/*
+ * xmlversion.h : compile-time version informations for the XML parser.
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __XML_VERSION_H__
+#define __XML_VERSION_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * use those to be sure nothing nasty will happen if
+ * your library and includes mismatch
+ */
+extern void xmlCheckVersion(int version);
+#define LIBXML_DOTTED_VERSION "@VERSION@"
+#define LIBXML_VERSION @LIBXML_VERSION_NUMBER@
+#define LIBXML_VERSION_STRING "@LIBXML_VERSION_NUMBER@"
+#define LIBXML_TEST_VERSION xmlCheckVersion(@LIBXML_VERSION_NUMBER@);
+
+/*
+ * Whether the FTP support is configured in
+ */
+#if @WITH_FTP@
+#define LIBXML_FTP_ENABLED
+#else
+#define LIBXML_FTP_DISABLED
+#endif
+
+/*
+ * Whether the HTTP support is configured in
+ */
+#if @WITH_HTTP@
+#define LIBXML_HTTP_ENABLED
+#else
+#define LIBXML_HTTP_DISABLED
+#endif
+
+/*
+ * Whether the HTML support is configured in
+ */
+#if @WITH_HTML@
+#define LIBXML_HTML_ENABLED
+#else
+#define LIBXML_HTML_DISABLED
+#endif
+
+/*
+ * Whether the Docbook support is configured in
+#if @WITH_SGML@
+#define LIBXML_SGML_ENABLED
+#else
+#define LIBXML_SGML_DISABLED
+#endif
+ */
+
+/*
+ * Whether XPath is configured in
+ */
+#if @WITH_XPATH@
+#define LIBXML_XPATH_ENABLED
+#else
+#define LIBXML_XPATH_DISABLED
+#endif
+
+/*
+ * Whether XPointer is configured in
+ */
+#if @WITH_XPTR@
+#define LIBXML_XPTR_ENABLED
+#else
+#define LIBXML_XPTR_DISABLED
+#endif
+
+/*
+ * Whether XInclude is configured in
+ */
+#if @WITH_XINCLUDE@
+#define LIBXML_XINCLUDE_ENABLED
+#else
+#define LIBXML_XINCLUDE_DISABLED
+#endif
+
+/*
+ * Whether iconv support is available
+ */
+#ifndef WIN32
+#if @WITH_ICONV@
+#define LIBXML_ICONV_ENABLED
+#else
+#define LIBXML_ICONV_DISABLED
+#endif
+#endif
+
+/*
+ * Whether Debugging module is configured in
+ */
+#if @WITH_DEBUG@
+#define LIBXML_DEBUG_ENABLED
+#else
+#define LIBXML_DEBUG_DISABLED
+#endif
+
+/*
+ * Whether the memory debugging is configured in
+ */
+#if @WITH_MEM_DEBUG@
+#define DEBUG_MEMORY_LOCATION
+#endif
+
+#ifndef LIBXML_DLL_IMPORT
+#if defined(WIN32) && !defined(STATIC)
+#define LIBXML_DLL_IMPORT __declspec(dllimport)
+#else
+#define LIBXML_DLL_IMPORT
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif
+
+
diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h
new file mode 100644
index 0000000..f8fd861
--- /dev/null
+++ b/include/libxml/xpath.h
@@ -0,0 +1,278 @@
+/*
+ * xpath.c: interface for XML Path Language implementation
+ *
+ * Reference: W3C Working Draft 5 July 1999
+ * http://www.w3.org/Style/XSL/Group/1999/07/xpath-19990705.html
+ *
+ * See COPYRIGHT for the status of this software
+ *
+ * Author: Daniel.Veillard@w3.org
+ */
+
+#ifndef __XML_XPATH_H__
+#define __XML_XPATH_H__
+
+#include <libxml/tree.h>
+#include <libxml/hash.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _xmlXPathContext xmlXPathContext;
+typedef xmlXPathContext *xmlXPathContextPtr;
+typedef struct _xmlXPathParserContext xmlXPathParserContext;
+typedef xmlXPathParserContext *xmlXPathParserContextPtr;
+
+/**
+ * The set of XPath error codes
+ */
+
+typedef enum {
+ XPATH_EXPRESSION_OK = 0,
+ XPATH_NUMBER_ERROR,
+ XPATH_UNFINISHED_LITERAL_ERROR,
+ XPATH_START_LITERAL_ERROR,
+ XPATH_VARIABLE_REF_ERROR,
+ XPATH_UNDEF_VARIABLE_ERROR,
+ XPATH_INVALID_PREDICATE_ERROR,
+ XPATH_EXPR_ERROR,
+ XPATH_UNCLOSED_ERROR,
+ XPATH_UNKNOWN_FUNC_ERROR,
+ XPATH_INVALID_OPERAND,
+ XPATH_INVALID_TYPE,
+ XPATH_INVALID_ARITY,
+ XPATH_INVALID_CTXT_SIZE,
+ XPATH_INVALID_CTXT_POSITION,
+ XPATH_MEMORY_ERROR,
+ XPTR_SYNTAX_ERROR,
+ XPTR_RESOURCE_ERROR,
+ XPTR_SUB_RESOURCE_ERROR,
+ XPATH_UNDEF_PREFIX_ERROR
+} xmlXPathError;
+
+/*
+ * A node-set (an unordered collection of nodes without duplicates)
+ */
+typedef struct _xmlNodeSet xmlNodeSet;
+typedef xmlNodeSet *xmlNodeSetPtr;
+struct _xmlNodeSet {
+ int nodeNr; /* number of nodes in the set */
+ int nodeMax; /* size of the array as allocated */
+ xmlNodePtr *nodeTab; /* array of nodes in no particular order */
+};
+
+/*
+ * An expression is evaluated to yield an object, which
+ * has one of the following four basic types:
+ * - node-set
+ * - boolean
+ * - number
+ * - string
+ *
+ * @@ XPointer will add more types !
+ */
+
+typedef enum {
+ XPATH_UNDEFINED = 0,
+ XPATH_NODESET = 1,
+ XPATH_BOOLEAN = 2,
+ XPATH_NUMBER = 3,
+ XPATH_STRING = 4,
+ XPATH_POINT = 5,
+ XPATH_RANGE = 6,
+ XPATH_LOCATIONSET = 7,
+ XPATH_USERS = 8,
+ XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */
+} xmlXPathObjectType;
+
+typedef struct _xmlXPathObject xmlXPathObject;
+typedef xmlXPathObject *xmlXPathObjectPtr;
+struct _xmlXPathObject {
+ xmlXPathObjectType type;
+ xmlNodeSetPtr nodesetval;
+ int boolval;
+ double floatval;
+ xmlChar *stringval;
+ void *user;
+ int index;
+ void *user2;
+ int index2;
+};
+
+/*
+ * A conversion function is associated to a type and used to cast
+ * the new type to primitive values.
+ */
+typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
+
+/*
+ * Extra type: a name and a conversion function.
+ */
+
+typedef struct _xmlXPathType xmlXPathType;
+typedef xmlXPathType *xmlXPathTypePtr;
+struct _xmlXPathType {
+ const xmlChar *name; /* the type name */
+ xmlXPathConvertFunc func; /* the conversion function */
+};
+
+/*
+ * Extra variable: a name and a value.
+ */
+
+typedef struct _xmlXPathVariable xmlXPathVariable;
+typedef xmlXPathVariable *xmlXPathVariablePtr;
+struct _xmlXPathVariable {
+ const xmlChar *name; /* the variable name */
+ xmlXPathObjectPtr value; /* the value */
+};
+
+/*
+ * an evaluation function, the parameters are on the context stack
+ */
+
+typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt, int nargs);
+
+/*
+ * Extra function: a name and a evaluation function.
+ */
+
+typedef struct _xmlXPathFunct xmlXPathFunct;
+typedef xmlXPathFunct *xmlXPathFuncPtr;
+struct _xmlXPathFunct {
+ const xmlChar *name; /* the function name */
+ xmlXPathEvalFunc func; /* the evaluation function */
+};
+
+/*
+ * An axis traversal function. To traverse an axis, the engine calls
+ * the first time with cur == NULL and repeat until the function returns
+ * NULL indicating the end of the axis traversal.
+ */
+
+typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
+ xmlXPathObjectPtr cur);
+
+/*
+ * Extra axis: a name and an axis function.
+ */
+
+typedef struct _xmlXPathAxis xmlXPathAxis;
+typedef xmlXPathAxis *xmlXPathAxisPtr;
+struct _xmlXPathAxis {
+ const xmlChar *name; /* the axis name */
+ xmlXPathAxisFunc func; /* the search function */
+};
+
+/*
+ * Expression evaluation occurs with respect to a context.
+ * he context consists of:
+ * - a node (the context node)
+ * - a node list (the context node list)
+ * - a set of variable bindings
+ * - a function library
+ * - the set of namespace declarations in scope for the expression
+ * Following the switch to hash tables, this need to be trimmed up at
+ * the next binary incompatible release.
+ */
+
+struct _xmlXPathContext {
+ xmlDocPtr doc; /* The current document */
+ xmlNodePtr node; /* The current node */
+
+ int nb_variables_unused; /* unused (hash table) */
+ int max_variables_unused; /* unused (hash table) */
+ xmlHashTablePtr varHash; /* Hash table of defined variables */
+
+ int nb_types; /* number of defined types */
+ int max_types; /* max number of types */
+ xmlXPathTypePtr types; /* Array of defined types */
+
+ int nb_funcs_unused; /* unused (hash table) */
+ int max_funcs_unused; /* unused (hash table) */
+ xmlHashTablePtr funcHash; /* Hash table of defined funcs */
+
+ int nb_axis; /* number of defined axis */
+ int max_axis; /* max number of axis */
+ xmlXPathAxisPtr axis; /* Array of defined axis */
+
+ /* the namespace nodes of the context node */
+ xmlNsPtr *namespaces; /* Array of namespaces */
+ int nsNr; /* number of namespace in scope */
+ void *user; /* function to free */
+
+ /* extra variables */
+ int contextSize; /* the context size */
+ int proximityPosition; /* the proximity position */
+
+ /* extra stuff for XPointer */
+ int xptr; /* it this an XPointer context */
+ xmlNodePtr here; /* for here() */
+ xmlNodePtr origin; /* for origin() */
+
+ /* the set of namespace declarations in scope for the expression */
+ xmlHashTablePtr nsHash; /* The namespaces hash table */
+ void *varLookupFunc; /* variable lookup func */
+ void *varLookupData; /* variable lookup data */
+
+ /* Possibility to link in an extra item */
+ void *extra; /* needed for XSLT */
+};
+
+/*
+ * An XPath parser context, it contains pure parsing informations,
+ * an xmlXPathContext, and the stack of objects.
+ */
+struct _xmlXPathParserContext {
+ const xmlChar *cur; /* the current char being parsed */
+ const xmlChar *base; /* the full expression */
+
+ int error; /* error code */
+
+ xmlXPathContextPtr context; /* the evaluation context */
+ xmlXPathObjectPtr value; /* the current value */
+ int valueNr; /* number of values stacked */
+ int valueMax; /* max number of values stacked */
+ xmlXPathObjectPtr *valueTab; /* stack of values */
+};
+
+/*
+ * An XPath function
+ * The arguments (if any) are popped out of the context stack
+ * and the result is pushed on the stack.
+ */
+
+typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
+
+/************************************************************************
+ * *
+ * Public API *
+ * *
+ ************************************************************************/
+
+/**
+ * Evaluation functions.
+ */
+void xmlXPathInit (void);
+xmlXPathContextPtr xmlXPathNewContext (xmlDocPtr doc);
+void xmlXPathFreeContext (xmlXPathContextPtr ctxt);
+xmlXPathObjectPtr xmlXPathEval (const xmlChar *str,
+ xmlXPathContextPtr ctxt);
+xmlXPathObjectPtr xmlXPathEvalXPtrExpr (const xmlChar *str,
+ xmlXPathContextPtr ctxt);
+void xmlXPathFreeObject (xmlXPathObjectPtr obj);
+xmlXPathObjectPtr xmlXPathEvalExpression (const xmlChar *str,
+ xmlXPathContextPtr ctxt);
+xmlNodeSetPtr xmlXPathNodeSetCreate (xmlNodePtr val);
+void xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj);
+void xmlXPathFreeNodeSet (xmlNodeSetPtr obj);
+xmlXPathObjectPtr xmlXPathObjectCopy (xmlXPathObjectPtr val);
+int xmlXPathCmpNodes (xmlNodePtr node1,
+ xmlNodePtr node2);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* ! __XML_XPATH_H__ */
diff --git a/include/libxml/xpathInternals.h b/include/libxml/xpathInternals.h
new file mode 100644
index 0000000..51f6ad5
--- /dev/null
+++ b/include/libxml/xpathInternals.h
@@ -0,0 +1,236 @@
+/*
+ * xpath.c: internal interfaces for XML Path Language implementation
+ * used to build new modules on top of XPath
+ *
+ * See COPYRIGHT for the status of this software
+ *
+ * Author: Daniel.Veillard@w3.org
+ */
+
+#ifndef __XML_XPATH_INTERNALS_H__
+#define __XML_XPATH_INTERNALS_H__
+
+#include <libxml/xpath.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/************************************************************************
+ * *
+ * Helpers *
+ * *
+ ************************************************************************/
+
+#define CHECK_ERROR \
+ if (ctxt->error != XPATH_EXPRESSION_OK) return
+
+#define CHECK_ERROR0 \
+ if (ctxt->error != XPATH_EXPRESSION_OK) return(0)
+
+#define XP_ERROR(X) \
+ { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \
+ ctxt->error = (X); return; }
+
+#define XP_ERROR0(X) \
+ { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \
+ ctxt->error = (X); return(0); }
+
+#define CHECK_TYPE(typeval) \
+ if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
+ XP_ERROR(XPATH_INVALID_TYPE)
+
+#define CHECK_ARITY(x) \
+ if (nargs != (x)) \
+ XP_ERROR(XPATH_INVALID_ARITY);
+
+#define CAST_TO_STRING \
+ if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \
+ xmlXPathStringFunction(ctxt, 1);
+
+#define CAST_TO_NUMBER \
+ if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \
+ xmlXPathNumberFunction(ctxt, 1);
+
+#define CAST_TO_BOOLEAN \
+ if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \
+ xmlXPathBooleanFunction(ctxt, 1);
+
+/*
+ * Varibale Lookup forwarding
+ */
+typedef xmlXPathObjectPtr
+ (*xmlXPathVariableLookupFunc) (void *ctxt,
+ const xmlChar *name,
+ const xmlChar *ns_uri);
+
+void xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt,
+ xmlXPathVariableLookupFunc f,
+ void *varCtxt);
+
+/*
+ * Error reporting
+ */
+void xmlXPatherror (xmlXPathParserContextPtr ctxt,
+ const char *file,
+ int line,
+ int no);
+
+void xmlXPathDebugDumpObject (FILE *output,
+ xmlXPathObjectPtr cur,
+ int depth);
+
+/**
+ * Extending a context
+ */
+
+int xmlXPathRegisterNs (xmlXPathContextPtr ctxt,
+ const xmlChar *prefix,
+ const xmlChar *ns_uri);
+const xmlChar * xmlXPathNsLookup (xmlXPathContextPtr ctxt,
+ const xmlChar *ns_uri);
+void xmlXPathRegisteredNsCleanup (xmlXPathContextPtr ctxt);
+
+int xmlXPathRegisterFunc (xmlXPathContextPtr ctxt,
+ const xmlChar *name,
+ xmlXPathFunction f);
+int xmlXPathRegisterFuncNS (xmlXPathContextPtr ctxt,
+ const xmlChar *name,
+ const xmlChar *ns_uri,
+ xmlXPathFunction f);
+int xmlXPathRegisterVariable (xmlXPathContextPtr ctxt,
+ const xmlChar *name,
+ xmlXPathObjectPtr value);
+int xmlXPathRegisterVariableNS (xmlXPathContextPtr ctxt,
+ const xmlChar *name,
+ const xmlChar *ns_uri,
+ xmlXPathObjectPtr value);
+xmlXPathFunction xmlXPathFunctionLookup (xmlXPathContextPtr ctxt,
+ const xmlChar *name);
+xmlXPathFunction xmlXPathFunctionLookupNS (xmlXPathContextPtr ctxt,
+ const xmlChar *name,
+ const xmlChar *ns_uri);
+void xmlXPathRegisteredFuncsCleanup(xmlXPathContextPtr ctxt);
+xmlXPathObjectPtr xmlXPathVariableLookup (xmlXPathContextPtr ctxt,
+ const xmlChar *name);
+xmlXPathObjectPtr xmlXPathVariableLookupNS (xmlXPathContextPtr ctxt,
+ const xmlChar *name,
+ const xmlChar *ns_uri);
+void xmlXPathRegisteredVariablesCleanup(xmlXPathContextPtr ctxt);
+
+/**
+ * Utilities to extend XPath
+ */
+xmlXPathParserContextPtr
+ xmlXPathNewParserContext (const xmlChar *str,
+ xmlXPathContextPtr ctxt);
+void xmlXPathFreeParserContext (xmlXPathParserContextPtr ctxt);
+
+/* TODO: remap to xmlXPathValuePop and Push */
+xmlXPathObjectPtr valuePop (xmlXPathParserContextPtr ctxt);
+int valuePush (xmlXPathParserContextPtr ctxt,
+ xmlXPathObjectPtr value);
+
+xmlXPathObjectPtr xmlXPathNewString (const xmlChar *val);
+xmlXPathObjectPtr xmlXPathNewCString (const char *val);
+xmlXPathObjectPtr xmlXPathNewFloat (double val);
+xmlXPathObjectPtr xmlXPathNewBoolean (int val);
+xmlXPathObjectPtr xmlXPathNewNodeSet (xmlNodePtr val);
+xmlXPathObjectPtr xmlXPathNewValueTree (xmlNodePtr val);
+void xmlXPathNodeSetAdd (xmlNodeSetPtr cur,
+ xmlNodePtr val);
+
+
+void xmlXPathIdFunction (xmlXPathParserContextPtr ctxt,
+ int nargs);
+void xmlXPathRoot (xmlXPathParserContextPtr ctxt);
+void xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt);
+xmlChar * xmlXPathParseName (xmlXPathParserContextPtr ctxt);
+xmlChar * xmlXPathParseNCName (xmlXPathParserContextPtr ctxt);
+
+/*
+ * Debug
+ */
+#ifdef LIBXML_DEBUG_ENABLED
+double xmlXPathStringEvalNumber(const xmlChar *str);
+void xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth);
+#endif
+/*
+ * Existing functions
+ */
+
+int xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt,
+ xmlXPathObjectPtr res);
+void xmlXPathInit(void);
+void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathRegisterAllFunctions(xmlXPathContextPtr ctxt);
+xmlNodeSetPtr xmlXPathNodeSetCreate(xmlNodePtr val);
+void xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val);
+xmlNodeSetPtr xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2);
+void xmlXPathNodeSetDel(xmlNodeSetPtr cur, xmlNodePtr val);
+void xmlXPathNodeSetRemove(xmlNodeSetPtr cur, int val);
+void xmlXPathFreeNodeSet(xmlNodeSetPtr obj);
+xmlXPathObjectPtr xmlXPathNewNodeSet(xmlNodePtr val);
+xmlXPathObjectPtr xmlXPathNewNodeSetList(xmlNodeSetPtr val);
+xmlXPathObjectPtr xmlXPathWrapNodeSet(xmlNodeSetPtr val);
+void xmlXPathFreeNodeSetList(xmlXPathObjectPtr obj);
+
+
+xmlXPathObjectPtr xmlXPathNewFloat(double val);
+xmlXPathObjectPtr xmlXPathNewBoolean(int val);
+xmlXPathObjectPtr xmlXPathNewString(const xmlChar *val);
+xmlXPathObjectPtr xmlXPathNewCString(const char *val);
+void xmlXPathFreeObject(xmlXPathObjectPtr obj);
+xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr doc);
+void xmlXPathFreeContext(xmlXPathContextPtr ctxt);
+
+int xmlXPathEqualValues(xmlXPathParserContextPtr ctxt);
+int xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict);
+void xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt);
+void xmlXPathAddValues(xmlXPathParserContextPtr ctxt);
+void xmlXPathSubValues(xmlXPathParserContextPtr ctxt);
+void xmlXPathMultValues(xmlXPathParserContextPtr ctxt);
+void xmlXPathDivValues(xmlXPathParserContextPtr ctxt);
+void xmlXPathModValues(xmlXPathParserContextPtr ctxt);
+
+
+/*
+ * Some of the axis navigation routines
+ */
+xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur);
+xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur);
+xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur);
+/*
+ * The official core of XPath functions
+ */
+void xmlXPathRoot(xmlXPathParserContextPtr ctxt);
+void xmlXPathLastFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathPositionFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathCountFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathIdFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathContainsFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathStartsWithFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathSubstringFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathSubstringBeforeFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathNotFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathTrueFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathFalseFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathLangFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathSumFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathCeilingFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathRoundFunction(xmlXPathParserContextPtr ctxt, int nargs);
+void xmlXPathBooleanFunction(xmlXPathParserContextPtr ctxt, int nargs);
+#ifdef __cplusplus
+}
+#endif
+#endif /* ! __XML_XPATH_INTERNALS_H__ */
diff --git a/include/libxml/xpointer.h b/include/libxml/xpointer.h
new file mode 100644
index 0000000..786fb5a
--- /dev/null
+++ b/include/libxml/xpointer.h
@@ -0,0 +1,57 @@
+/*
+ * xpointer.h : API to handle XML Pointers
+ *
+ * World Wide Web Consortium Working Draft 03-March-1998
+ * http://www.w3.org/TR/1998/WD-xptr-19980303
+ *
+ * See Copyright for the status of this software.
+ *
+ * Daniel.Veillard@w3.org
+ */
+
+#ifndef __XML_XPTR_H__
+#define __XML_XPTR_H__
+
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * A Location Set
+ */
+typedef struct _xmlLocationSet xmlLocationSet;
+typedef xmlLocationSet *xmlLocationSetPtr;
+struct _xmlLocationSet {
+ int locNr; /* number of locations in the set */
+ int locMax; /* size of the array as allocated */
+ xmlXPathObjectPtr *locTab;/* array of locations */
+};
+
+/*
+ * Handling of location sets
+ */
+
+void xmlXPtrFreeLocationSet (xmlLocationSetPtr obj);
+xmlLocationSetPtr xmlXPtrLocationSetMerge (xmlLocationSetPtr val1,
+ xmlLocationSetPtr val2);
+
+/*
+ * Functions
+ */
+xmlXPathContextPtr xmlXPtrNewContext (xmlDocPtr doc,
+ xmlNodePtr here,
+ xmlNodePtr origin);
+xmlXPathObjectPtr xmlXPtrEval (const xmlChar *str,
+ xmlXPathContextPtr ctx);
+void xmlXPtrRangeToFunction (xmlXPathParserContextPtr ctxt,
+ int nargs);
+xmlNodePtr xmlXPtrBuildNodeList (xmlXPathObjectPtr obj);
+void xmlXPtrEvalRangePredicate (xmlXPathParserContextPtr ctxt);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __XML_XPTR_H__ */