diff options
Diffstat (limited to 'plugins/Variables/src/libxml')
35 files changed, 7706 insertions, 0 deletions
diff --git a/plugins/Variables/src/libxml/DOCBparser.h b/plugins/Variables/src/libxml/DOCBparser.h new file mode 100644 index 0000000000..75fb0b2ac8 --- /dev/null +++ b/plugins/Variables/src/libxml/DOCBparser.h @@ -0,0 +1,73 @@ +/* + * DOCBparser.h : interface for a DocBook SGML non-verifying parser + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#ifndef __DOCB_PARSER_H__ +#define __DOCB_PARSER_H__ +#include "libxml/parser.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Most of the back-end structures from XML and SGML are shared. + */ +typedef xmlParserCtxt docbParserCtxt; +typedef xmlParserCtxtPtr docbParserCtxtPtr; +typedef xmlParserNodeInfo docbParserNodeInfo; +typedef xmlSAXHandler docbSAXHandler; +typedef xmlSAXHandlerPtr docbSAXHandlerPtr; +typedef xmlParserInput docbParserInput; +typedef xmlParserInputPtr docbParserInputPtr; +typedef xmlDocPtr docbDocPtr; +typedef xmlNodePtr docbNodePtr; + +/* + * There is only few public functions. + */ +int docbEncodeEntities(unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen, int quoteChar); + +docbDocPtr docbSAXParseDoc (xmlChar *cur, + const char *encoding, + docbSAXHandlerPtr sax, + void *userData); +docbDocPtr docbParseDoc (xmlChar *cur, + const char *encoding); +docbDocPtr docbSAXParseFile(const char *filename, + const char *encoding, + docbSAXHandlerPtr sax, + void *userData); +docbDocPtr docbParseFile (const char *filename, + const char *encoding); + +/** + * Interfaces for the Push mode. + */ +void docbFreeParserCtxt (docbParserCtxtPtr ctxt); +docbParserCtxtPtr docbCreatePushParserCtxt(docbSAXHandlerPtr sax, + void *user_data, + const char *chunk, + int size, + const char *filename, + xmlCharEncoding enc); +int docbParseChunk (docbParserCtxtPtr ctxt, + const char *chunk, + int size, + int terminate); +docbParserCtxtPtr docbCreateFileParserCtxt(const char *filename, + const char *encoding); +int docbParseDocument (docbParserCtxtPtr ctxt); + +#ifdef __cplusplus +} +#endif + +#endif /* __DOCB_PARSER_H__ */ diff --git a/plugins/Variables/src/libxml/HTMLparser.h b/plugins/Variables/src/libxml/HTMLparser.h new file mode 100644 index 0000000000..a98ecbe8e6 --- /dev/null +++ b/plugins/Variables/src/libxml/HTMLparser.h @@ -0,0 +1,159 @@ +/* + * HTMLparser.h : interface for an HTML 4.0 non-verifying parser + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#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, representing HTML 4.01 + * and XHTML 1.0 (which share the same structure). + */ +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 */ + char isinline; /* is this a block 0 or inline 1 element */ + const char *desc; /* the description */ + +/* NRK Jan.2003 + * New fields encapsulating HTML structure + * + * Bugs: + * This is a very limited representation. It fails to tell us when + * an element *requires* subelements (we only have whether they're + * allowed or not), and it doesn't tell us where CDATA and PCDATA + * are allowed. Some element relationships are not fully represented: + * these are flagged with the word MODIFIER + */ + const char** subelts; /* allowed sub-elements of this element */ + const char* defaultsubelt; /* subelement for suggested auto-repair + if necessary or NULL */ + const char** attrs_opt; /* Optional Attributes */ + const char** attrs_depr; /* Additional deprecated attributes */ + const char** attrs_req; /* Required attributes */ +}; + +/* + * Internal description of an HTML entity. + */ +typedef struct _htmlEntityDesc htmlEntityDesc; +typedef htmlEntityDesc *htmlEntityDescPtr; +struct _htmlEntityDesc { + unsigned 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. + */ +const htmlElemDesc * htmlTagLookup (const xmlChar *tag); +const htmlEntityDesc * htmlEntityLookup(const xmlChar *name); +const htmlEntityDesc * htmlEntityValueLookup(unsigned int value); + +int htmlIsAutoClosed(htmlDocPtr doc, + htmlNodePtr elem); +int htmlAutoCloseTag(htmlDocPtr doc, + const xmlChar *name, + htmlNodePtr elem); +const htmlEntityDesc * htmlParseEntityRef(htmlParserCtxtPtr ctxt, + xmlChar **str); +int htmlParseCharRef(htmlParserCtxtPtr ctxt); +void htmlParseElement(htmlParserCtxtPtr ctxt); + +int htmlParseDocument(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); + +/* NRK/Jan2003: further knowledge of HTML structure + */ +typedef enum { + HTML_NA = 0 , /* something we don't check at all */ + HTML_INVALID = 0x1 , + HTML_DEPRECATED = 0x2 , + HTML_VALID = 0x4 , + HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */ +} htmlStatus ; + +/* Using htmlElemDesc rather than name here, to emphasise the fact + that otherwise there's a lookup overhead +*/ +htmlStatus htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ; +int htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ; +htmlStatus htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ; +htmlStatus htmlNodeStatus(const htmlNodePtr, int) ; +#define htmlDefaultSubelement(elt) elt->defaultsubelt +#define htmlElementAllowedHereDesc(parent,elt) \ + htmlElementAllowedHere((parent), (elt)->name) +#define htmlRequiredAttrs(elt) (elt)->attrs_req + + +#ifdef __cplusplus +} +#endif + +#endif /* __HTML_PARSER_H__ */ diff --git a/plugins/Variables/src/libxml/HTMLtree.h b/plugins/Variables/src/libxml/HTMLtree.h new file mode 100644 index 0000000000..e9944b3b25 --- /dev/null +++ b/plugins/Variables/src/libxml/HTMLtree.h @@ -0,0 +1,117 @@ +/* + * HTMLtree.h : describes the structures found in an tree resulting + * from an XML parsing. + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#ifndef __HTML_TREE_H__ +#define __HTML_TREE_H__ + +#include <stdio.h> +#include "libxml/tree.h" +#include "libxml/HTMLparser.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * HTML_TEXT_NODE: + * + * Macro. A text node in a HTML document is really implemented + * the same way as a text node in an XML document. + */ +#define HTML_TEXT_NODE XML_TEXT_NODE +/** + * HTML_ENTITY_REF_NODE: + * + * Macro. An entity reference in a HTML document is really implemented + * the same way as an entity reference in an XML document. + */ +#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE +/** + * HTML_COMMENT_NODE: + * + * Macro. A comment in a HTML document is really implemented + * the same way as a comment in an XML document. + */ +#define HTML_COMMENT_NODE XML_COMMENT_NODE +/** + * HTML_PRESERVE_NODE: + * + * Macro. A preserved node in a HTML document is really implemented + * the same way as a CDATA section in an XML document. + */ +#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE +/** + * HTML_PI_NODE: + * + * Macro. A processing instruction in a HTML document is really implemented + * the same way as a processing instruction in an XML document. + */ +#define HTML_PI_NODE XML_PI_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); +int htmlNodeDump (xmlBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur); +void htmlNodeDumpFile (FILE *out, + xmlDocPtr doc, + xmlNodePtr cur); +int htmlNodeDumpFileFormat (FILE *out, + xmlDocPtr doc, + xmlNodePtr cur, + const char *encoding, + int format); +int htmlSaveFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding); +int htmlSaveFileFormat (const char *filename, + xmlDocPtr cur, + const char *encoding, + int format); + +void htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + const char *encoding, + int format); +void htmlDocContentDumpOutput(xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding); +void htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding, + int format); + +int htmlIsBooleanAttr (const xmlChar *name); +void htmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, + xmlNodePtr cur, const char *encoding); + + + + +#ifdef __cplusplus +} +#endif + +#endif /* __HTML_TREE_H__ */ + diff --git a/plugins/Variables/src/libxml/SAX.h b/plugins/Variables/src/libxml/SAX.h new file mode 100644 index 0000000000..a46e14c78e --- /dev/null +++ b/plugins/Variables/src/libxml/SAX.h @@ -0,0 +1,128 @@ +/* + * SAX.h : Default SAX handler interfaces. + * + * See Copyright for the status of this software. + * + * Daniel Veillard <daniel@veillard.com> + */ + + +#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 *fullname, + 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 initxmlDefaultSAXHandler (xmlSAXHandler *hdlr, + int warning); +#ifdef LIBXML_HTML_ENABLED +void inithtmlDefaultSAXHandler (xmlSAXHandler *hdlr); +#endif +#ifdef LIBXML_DOCB_ENABLED +void initdocbDefaultSAXHandler (xmlSAXHandler *hdlr); +#endif +void xmlDefaultSAXHandlerInit (void); +void htmlDefaultSAXHandlerInit (void); +void docbDefaultSAXHandlerInit (void); +#ifdef __cplusplus +} +#endif +#endif /* __XML_SAX_H__ */ diff --git a/plugins/Variables/src/libxml/c14n.h b/plugins/Variables/src/libxml/c14n.h new file mode 100644 index 0000000000..75ace8a4a4 --- /dev/null +++ b/plugins/Variables/src/libxml/c14n.h @@ -0,0 +1,91 @@ +/* + * "Canonical XML" implementation + * http://www.w3.org/TR/xml-c14n + * + * "Exclusive XML Canonicalization" implementation + * http://www.w3.org/TR/xml-exc-c14n + + * See Copyright for the status of this software. + * + * Author: Aleksey Sanin <aleksey@aleksey.com> + */ +#ifndef __XML_C14N_H__ +#define __XML_C14N_H__ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include <libxml/tree.h> +#include <libxml/xpath.h> + +/* + * XML Canonicazation + * http://www.w3.org/TR/xml-c14n + * + * Exclusive XML Canonicazation + * http://www.w3.org/TR/xml-exc-c14n + * + * Canonical form of an XML document could be created if and only if + * a) default attributes (if any) are added to all nodes + * b) all character and parsed entity references are resolved + * In order to achive this in libxml2 the document MUST be loaded with + * following global setings: + * + * xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + * xmlSubstituteEntitiesDefault(1); + * + * or corresponding parser context setting: + * xmlParserCtxtPtr ctxt; + * + * ... + * ctxt->loadsubset = XML_DETECT_IDS | XML_COMPLETE_ATTRS; + * ctxt->replaceEntities = 1; + * ... + */ + + +int xmlC14NDocSaveTo (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int exclusive, + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlOutputBufferPtr buf); + +int xmlC14NDocDumpMemory (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int exclusive, + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlChar **doc_txt_ptr); + +int xmlC14NDocSave (xmlDocPtr doc, + xmlNodeSetPtr nodes, + int exclusive, + xmlChar **inclusive_ns_prefixes, + int with_comments, + const char* filename, + int compression); + + +/** + * This is the core C14N function + */ +typedef int (*xmlC14NIsVisibleCallback) (void* user_data, + xmlNodePtr node, + xmlNodePtr parent); + +int xmlC14NExecute (xmlDocPtr doc, + xmlC14NIsVisibleCallback is_visible_callback, + void* user_data, + int exclusive, + xmlChar **inclusive_ns_prefixes, + int with_comments, + xmlOutputBufferPtr buf); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __XML_C14N_H__ */ + diff --git a/plugins/Variables/src/libxml/catalog.h b/plugins/Variables/src/libxml/catalog.h new file mode 100644 index 0000000000..f6ee04815e --- /dev/null +++ b/plugins/Variables/src/libxml/catalog.h @@ -0,0 +1,138 @@ +/** + * catalog.h: interfaces of the Catalog handling system + * + * Reference: SGML Open Technical Resolution TR9401:1997. + * http://www.jclark.com/sp/catalog.htm + * + * XML Catalogs Working Draft 12 Jun 2001 + * http://www.oasis-open.org/committees/entity/spec-2001-06-12.html + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#ifndef __XML_CATALOG_H__ +#define __XML_CATALOG_H__ + +#include <stdio.h> + +#include "libxml/xmlversion.h" + +#ifdef LIBXML_CATALOG_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XML_CATALOGS_NAMESPACE: + * + * The namespace for the XML Catalogs elements. + */ +#define XML_CATALOGS_NAMESPACE \ + (const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog" +/** + * XML_CATALOG_PI: + * + * The specific XML Catalog Processing Instuction name. + */ +#define XML_CATALOG_PI \ + (const xmlChar *) "oasis-xml-catalog" + +/* + * The API is voluntarily limited to general cataloging. + */ +typedef enum { + XML_CATA_PREFER_NONE = 0, + XML_CATA_PREFER_PUBLIC = 1, + XML_CATA_PREFER_SYSTEM +} xmlCatalogPrefer; + +typedef enum { + XML_CATA_ALLOW_NONE = 0, + XML_CATA_ALLOW_GLOBAL = 1, + XML_CATA_ALLOW_DOCUMENT = 2, + XML_CATA_ALLOW_ALL = 3 +} xmlCatalogAllow; + +typedef struct _xmlCatalog xmlCatalog; +typedef xmlCatalog *xmlCatalogPtr; + +/* + * Operations on a given catalog. + */ +xmlCatalogPtr xmlNewCatalog (int sgml); +xmlCatalogPtr xmlLoadACatalog (const char *filename); +xmlCatalogPtr xmlLoadSGMLSuperCatalog (const char *filename); +int xmlConvertSGMLCatalog (xmlCatalogPtr catal); +int xmlACatalogAdd (xmlCatalogPtr catal, + const xmlChar *type, + const xmlChar *orig, + const xmlChar *replace); +int xmlACatalogRemove (xmlCatalogPtr catal, + const xmlChar *value); +xmlChar * xmlACatalogResolve (xmlCatalogPtr catal, + const xmlChar *pubID, + const xmlChar *sysID); +xmlChar * xmlACatalogResolveSystem(xmlCatalogPtr catal, + const xmlChar *sysID); +xmlChar * xmlACatalogResolvePublic(xmlCatalogPtr catal, + const xmlChar *pubID); +xmlChar * xmlACatalogResolveURI (xmlCatalogPtr catal, + const xmlChar *URI); +void xmlACatalogDump (xmlCatalogPtr catal, + FILE *out); +void xmlFreeCatalog (xmlCatalogPtr catal); +int xmlCatalogIsEmpty (xmlCatalogPtr catal); + +/* + * Global operations. + */ +void xmlInitializeCatalog (void); +int xmlLoadCatalog (const char *filename); +void xmlLoadCatalogs (const char *paths); +void xmlCatalogCleanup (void); +void xmlCatalogDump (FILE *out); +xmlChar * xmlCatalogResolve (const xmlChar *pubID, + const xmlChar *sysID); +xmlChar * xmlCatalogResolveSystem (const xmlChar *sysID); +xmlChar * xmlCatalogResolvePublic (const xmlChar *pubID); +xmlChar * xmlCatalogResolveURI (const xmlChar *URI); +int xmlCatalogAdd (const xmlChar *type, + const xmlChar *orig, + const xmlChar *replace); +int xmlCatalogRemove (const xmlChar *value); +xmlDocPtr xmlParseCatalogFile (const char *filename); +int xmlCatalogConvert (void); + +/* + * Strictly minimal interfaces for per-document catalogs used + * by the parser. + */ +void xmlCatalogFreeLocal (void *catalogs); +void * xmlCatalogAddLocal (void *catalogs, + const xmlChar *URL); +xmlChar * xmlCatalogLocalResolve (void *catalogs, + const xmlChar *pubID, + const xmlChar *sysID); +xmlChar * xmlCatalogLocalResolveURI(void *catalogs, + const xmlChar *URI); +/* + * Preference settings. + */ +int xmlCatalogSetDebug (int level); +xmlCatalogPrefer xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer); +void xmlCatalogSetDefaults (xmlCatalogAllow allow); +xmlCatalogAllow xmlCatalogGetDefaults (void); + + +/* DEPRECATED interfaces */ +const xmlChar * xmlCatalogGetSystem (const xmlChar *sysID); +const xmlChar * xmlCatalogGetPublic (const xmlChar *pubID); + +#ifdef __cplusplus +} +#endif +#endif /* LIBXML_CATALOG_ENABLED */ +#endif /* __XML_CATALOG_H__ */ diff --git a/plugins/Variables/src/libxml/debugXML.h b/plugins/Variables/src/libxml/debugXML.h new file mode 100644 index 0000000000..444acb408e --- /dev/null +++ b/plugins/Variables/src/libxml/debugXML.h @@ -0,0 +1,163 @@ +/* + * debugXML.h : Interfaces to a set of routines used for debugging the tree + * produced by the XML parser. + * + * Daniel Veillard <daniel@veillard.com> + */ + +#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 dtd); +void xmlDebugDumpEntities (FILE *output, + xmlDocPtr doc); + +void xmlLsOneNode (FILE *output, xmlNodePtr node); +int xmlLsCountNode (xmlNodePtr node); + +LIBXML_DLL_IMPORT const char *xmlBoolToText (int boolval); + +/**************************************************************** + * * + * 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); + +/** + * xmlShellCtxt: + * + * A debugging shell context. + * 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); + +void xmlShellPrintXPathError (int errorType, + const char *arg); +void xmlShellPrintNode (xmlNodePtr node); +void xmlShellPrintXPathResult(xmlXPathObjectPtr list); +int xmlShellList (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +int xmlShellBase (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +int xmlShellDir (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +int xmlShellCat (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr node, + xmlNodePtr node2); +int xmlShellLoad (xmlShellCtxtPtr ctxt, + char *filename, + xmlNodePtr node, + xmlNodePtr node2); +int xmlShellWrite (xmlShellCtxtPtr ctxt, + char *filename, + xmlNodePtr node, + xmlNodePtr node2); +int xmlShellSave (xmlShellCtxtPtr ctxt, + char *filename, + xmlNodePtr node, + xmlNodePtr node2); +int xmlShellValidate (xmlShellCtxtPtr ctxt, + char *dtd, + xmlNodePtr node, + xmlNodePtr node2); +int xmlShellDu (xmlShellCtxtPtr ctxt, + char *arg, + xmlNodePtr tree, + xmlNodePtr node2); +int xmlShellPwd (xmlShellCtxtPtr ctxt, + char *buffer, + 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/plugins/Variables/src/libxml/encoding.h b/plugins/Variables/src/libxml/encoding.h new file mode 100644 index 0000000000..012f6d9cf6 --- /dev/null +++ b/plugins/Variables/src/libxml/encoding.h @@ -0,0 +1,230 @@ +/* + * 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.com + */ + +#ifndef __XML_CHAR_ENCODING_H__ +#define __XML_CHAR_ENCODING_H__ + +#include "libxml/xmlversion.h" + +#ifdef LIBXML_ICONV_ENABLED +#include <iconv.h> +#endif +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlCharEncoding: + * + * 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 current 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 to an array of bytes to store the UTF-8 result + * @outlen: the length of @out + * @in: a pointer to an array of chars in the original encoding + * @inlen: the length 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 octets consumed. + */ +typedef int (* xmlCharEncodingInputFunc)(unsigned char *out, int *outlen, + const unsigned char *in, int *inlen); + + +/** + * xmlCharEncodingOutputFunc: + * @out: a pointer to an array of bytes to store the result + * @outlen: the length of @out + * @in: a pointer to an array of UTF-8 chars + * @inlen: the length 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 */ +}; + +#ifdef __cplusplus +} +#endif +#include "libxml/tree.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Interfaces for encoding handlers. + */ +void xmlInitCharEncodingHandlers (void); +void xmlCleanupCharEncodingHandlers (void); +void xmlRegisterCharEncodingHandler (xmlCharEncodingHandlerPtr handler); +xmlCharEncodingHandlerPtr + xmlGetCharEncodingHandler (xmlCharEncoding enc); +xmlCharEncodingHandlerPtr + xmlFindCharEncodingHandler (const char *name); +xmlCharEncodingHandlerPtr + xmlNewCharEncodingHandler (const char *name, + xmlCharEncodingInputFunc input, + xmlCharEncodingOutputFunc output); + +/* + * 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 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); + +/* + * Export a few useful functions + */ +int UTF8Toisolat1 (unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen); +int isolat1ToUTF8 (unsigned char *out, + int *outlen, + const unsigned char *in, + int *inlen); +int xmlGetUTF8Char (const unsigned char *utf, + int *len); +/* + * exports additional "UTF-8 aware" string routines which are. + */ + +int xmlCheckUTF8 (const unsigned char *utf); + +int xmlUTF8Strsize (const xmlChar *utf, + int len); +xmlChar * xmlUTF8Strndup (const xmlChar *utf, + int len); +xmlChar * xmlUTF8Strpos (const xmlChar *utf, + int pos); +int xmlUTF8Strloc (const xmlChar *utf, + const xmlChar *utfchar); +xmlChar * xmlUTF8Strsub (const xmlChar *utf, + int start, + int len); + +int xmlUTF8Strlen (const xmlChar *utf); + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_CHAR_ENCODING_H__ */ diff --git a/plugins/Variables/src/libxml/entities.h b/plugins/Variables/src/libxml/entities.h new file mode 100644 index 0000000000..3dfc4deba1 --- /dev/null +++ b/plugins/Variables/src/libxml/entities.h @@ -0,0 +1,110 @@ +/* + * entities.h : interface for the XML entities handling + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#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. + */ + +struct _xmlEntity { + void *_private; /* application data */ + xmlElementType type; /* XML_ENTITY_DECL, must be second ! */ + const xmlChar *name; /* Entity name */ + struct _xmlNode *children; /* First child link */ + struct _xmlNode *last; /* Last child link */ + 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 */ + int owner; /* does the entity own the childrens */ +}; + +/* + * All entities are stored in an hash table. + * There is 2 separate hash tables for global and parameter 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); +void xmlCleanupPredefinedEntities(void); + + +#ifdef __cplusplus +} +#endif + +# endif /* __XML_ENTITIES_H__ */ diff --git a/plugins/Variables/src/libxml/globals.h b/plugins/Variables/src/libxml/globals.h new file mode 100644 index 0000000000..8a5e8c88e0 --- /dev/null +++ b/plugins/Variables/src/libxml/globals.h @@ -0,0 +1,363 @@ +/* + * globals.h: interface for all global variables of the library + * + * The bottom of this file is automatically generated by build_glob.py + * based on the description file global.data + * + * See Copyright for the status of this software. + * + * Gary Pennington <Gary.Pennington@uk.sun.com> + * daniel@veillard.com + */ + +#ifndef __XML_GLOBALS_H +#define __XML_GLOBALS_H + +#include "libxml/parser.h" +#include "libxml/xmlerror.h" +#include "libxml/SAX.h" +#include "libxml/xmlmemory.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Externally global symbols which need to be protected for backwards + * compatibility support. + */ + +#undef docbDefaultSAXHandler +#undef htmlDefaultSAXHandler +#undef oldXMLWDcompatibility +#undef xmlBufferAllocScheme +#undef xmlDefaultBufferSize +#undef xmlDefaultSAXHandler +#undef xmlDefaultSAXLocator +#undef xmlDoValidityCheckingDefaultValue +#undef xmlFree +#undef xmlGenericError +#undef xmlGenericErrorContext +#undef xmlGetWarningsDefaultValue +#undef xmlIndentTreeOutput +#undef xmlTreeIndentString +#undef xmlKeepBlanksDefaultValue +#undef xmlLineNumbersDefaultValue +#undef xmlLoadExtDtdDefaultValue +#undef xmlMalloc +#undef xmlMemStrdup +#undef xmlParserDebugEntities +#undef xmlParserVersion +#undef xmlPedanticParserDefaultValue +#undef xmlRealloc +#undef xmlSaveNoEmptyTags +#undef xmlSubstituteEntitiesDefaultValue +#undef xmlRegisterNodeDefaultValue +#undef xmlDeregisterNodeDefaultValue + +typedef void (*xmlRegisterNodeFunc) (xmlNodePtr node); +typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node); + +typedef struct _xmlGlobalState xmlGlobalState; +typedef xmlGlobalState *xmlGlobalStatePtr; +struct _xmlGlobalState +{ + const char *xmlParserVersion; + + xmlSAXLocator xmlDefaultSAXLocator; + xmlSAXHandler xmlDefaultSAXHandler; + xmlSAXHandler docbDefaultSAXHandler; + xmlSAXHandler htmlDefaultSAXHandler; + + xmlFreeFunc xmlFree; + xmlMallocFunc xmlMalloc; + xmlStrdupFunc xmlMemStrdup; + xmlReallocFunc xmlRealloc; + + xmlGenericErrorFunc xmlGenericError; + void *xmlGenericErrorContext; + + int oldXMLWDcompatibility; + + xmlBufferAllocationScheme xmlBufferAllocScheme; + int xmlDefaultBufferSize; + + int xmlSubstituteEntitiesDefaultValue; + int xmlDoValidityCheckingDefaultValue; + int xmlGetWarningsDefaultValue; + int xmlKeepBlanksDefaultValue; + int xmlLineNumbersDefaultValue; + int xmlLoadExtDtdDefaultValue; + int xmlParserDebugEntities; + int xmlPedanticParserDefaultValue; + + int xmlSaveNoEmptyTags; + int xmlIndentTreeOutput; + const char *xmlTreeIndentString; + + xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; + xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; +}; + +#ifdef __cplusplus +} +#endif +#include "libxml/threads.h" +#ifdef __cplusplus +extern "C" { +#endif + +void xmlInitializeGlobalState(xmlGlobalStatePtr gs); + +xmlRegisterNodeFunc xmlRegisterNodeDefault(xmlRegisterNodeFunc func); +xmlDeregisterNodeFunc xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func); + +/* + * In general the memory allocation entry points are not kept + * thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED + * - xmlMalloc + * - xmlRealloc + * - xmlMemStrdup + * - xmlFree + */ + +#ifdef LIBXML_THREAD_ALLOC_ENABLED +#ifdef LIBXML_THREAD_ENABLED +extern xmlMallocFunc *__xmlMalloc(void); +#define xmlMalloc \ +(*(__xmlMalloc())) +#else +LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc; +#endif + +#ifdef LIBXML_THREAD_ENABLED +extern xmlReallocFunc *__xmlRealloc(void); +#define xmlRealloc \ +(*(__xmlRealloc())) +#else +LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc; +#endif + +#ifdef LIBXML_THREAD_ENABLED +extern xmlFreeFunc *__xmlFree(void); +#define xmlFree \ +(*(__xmlFree())) +#else +LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree; +#endif + +#ifdef LIBXML_THREAD_ENABLED +extern xmlStrdupFunc *__xmlMemStrdup(void); +#define xmlMemStrdup \ +(*(__xmlMemStrdup())) +#else +LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup; +#endif +#else /* !LIBXML_THREAD_ALLOC_ENABLED */ +LIBXML_DLL_IMPORT extern xmlMallocFunc xmlMalloc; +LIBXML_DLL_IMPORT extern xmlReallocFunc xmlRealloc; +LIBXML_DLL_IMPORT extern xmlFreeFunc xmlFree; +LIBXML_DLL_IMPORT extern xmlStrdupFunc xmlMemStrdup; +#endif /* LIBXML_THREAD_ALLOC_ENABLED */ + +#ifdef LIBXML_DOCB_ENABLED +extern xmlSAXHandler *__docbDefaultSAXHandler(void); +#ifdef LIBXML_THREAD_ENABLED +#define docbDefaultSAXHandler \ +(*(__docbDefaultSAXHandler())) +#else +LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler; +#endif +#endif + +#ifdef LIBXML_HTML_ENABLED +extern xmlSAXHandler *__htmlDefaultSAXHandler(void); +#ifdef LIBXML_THREAD_ENABLED +#define htmlDefaultSAXHandler \ +(*(__htmlDefaultSAXHandler())) +#else +LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler; +#endif +#endif + + +/* + * Everything starting from the line below is + * Automatically generated by build_glob.py. + * Do not modify the previous line. + */ + + +extern int *__oldXMLWDcompatibility(void); +#ifdef LIBXML_THREAD_ENABLED +#define oldXMLWDcompatibility \ +(*(__oldXMLWDcompatibility())) +#else +LIBXML_DLL_IMPORT extern int oldXMLWDcompatibility; +#endif + +extern xmlBufferAllocationScheme *__xmlBufferAllocScheme(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlBufferAllocScheme \ +(*(__xmlBufferAllocScheme())) +#else +LIBXML_DLL_IMPORT extern xmlBufferAllocationScheme xmlBufferAllocScheme; +#endif + +extern int *__xmlDefaultBufferSize(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlDefaultBufferSize \ +(*(__xmlDefaultBufferSize())) +#else +LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; +#endif + +extern xmlSAXHandler *__xmlDefaultSAXHandler(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlDefaultSAXHandler \ +(*(__xmlDefaultSAXHandler())) +#else +LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler; +#endif + +extern xmlSAXLocator *__xmlDefaultSAXLocator(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlDefaultSAXLocator \ +(*(__xmlDefaultSAXLocator())) +#else +LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator; +#endif + +extern int *__xmlDoValidityCheckingDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlDoValidityCheckingDefaultValue \ +(*(__xmlDoValidityCheckingDefaultValue())) +#else +LIBXML_DLL_IMPORT extern int xmlDoValidityCheckingDefaultValue; +#endif + +extern xmlGenericErrorFunc *__xmlGenericError(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlGenericError \ +(*(__xmlGenericError())) +#else +LIBXML_DLL_IMPORT extern xmlGenericErrorFunc xmlGenericError; +#endif + +extern void * *__xmlGenericErrorContext(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlGenericErrorContext \ +(*(__xmlGenericErrorContext())) +#else +LIBXML_DLL_IMPORT extern void * xmlGenericErrorContext; +#endif + +extern int *__xmlGetWarningsDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlGetWarningsDefaultValue \ +(*(__xmlGetWarningsDefaultValue())) +#else +LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue; +#endif + +extern int *__xmlIndentTreeOutput(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlIndentTreeOutput \ +(*(__xmlIndentTreeOutput())) +#else +LIBXML_DLL_IMPORT extern int xmlIndentTreeOutput; +#endif + +extern const char * *__xmlTreeIndentString(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlTreeIndentString \ +(*(__xmlTreeIndentString())) +#else +LIBXML_DLL_IMPORT extern const char * xmlTreeIndentString; +#endif + +extern int *__xmlKeepBlanksDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlKeepBlanksDefaultValue \ +(*(__xmlKeepBlanksDefaultValue())) +#else +LIBXML_DLL_IMPORT extern int xmlKeepBlanksDefaultValue; +#endif + +extern int *__xmlLineNumbersDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlLineNumbersDefaultValue \ +(*(__xmlLineNumbersDefaultValue())) +#else +LIBXML_DLL_IMPORT extern int xmlLineNumbersDefaultValue; +#endif + +extern int *__xmlLoadExtDtdDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlLoadExtDtdDefaultValue \ +(*(__xmlLoadExtDtdDefaultValue())) +#else +LIBXML_DLL_IMPORT extern int xmlLoadExtDtdDefaultValue; +#endif + +extern int *__xmlParserDebugEntities(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlParserDebugEntities \ +(*(__xmlParserDebugEntities())) +#else +LIBXML_DLL_IMPORT extern int xmlParserDebugEntities; +#endif + +extern const char * *__xmlParserVersion(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlParserVersion \ +(*(__xmlParserVersion())) +#else +LIBXML_DLL_IMPORT extern const char * xmlParserVersion; +#endif + +extern int *__xmlPedanticParserDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlPedanticParserDefaultValue \ +(*(__xmlPedanticParserDefaultValue())) +#else +LIBXML_DLL_IMPORT extern int xmlPedanticParserDefaultValue; +#endif + +extern int *__xmlSaveNoEmptyTags(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlSaveNoEmptyTags \ +(*(__xmlSaveNoEmptyTags())) +#else +LIBXML_DLL_IMPORT extern int xmlSaveNoEmptyTags; +#endif + +extern int *__xmlSubstituteEntitiesDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlSubstituteEntitiesDefaultValue \ +(*(__xmlSubstituteEntitiesDefaultValue())) +#else +LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue; +#endif + +extern xmlRegisterNodeFunc *__xmlRegisterNodeDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlRegisterNodeDefaultValue \ +(*(__xmlRegisterNodeDefaultValue())) +#else +LIBXML_DLL_IMPORT extern xmlRegisterNodeFunc xmlRegisterNodeDefaultValue; +#endif + +extern xmlDeregisterNodeFunc *__xmlDeregisterNodeDefaultValue(void); +#ifdef LIBXML_THREAD_ENABLED +#define xmlDeregisterNodeDefaultValue \ +(*(__xmlDeregisterNodeDefaultValue())) +#else +LIBXML_DLL_IMPORT extern xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_GLOBALS_H */ diff --git a/plugins/Variables/src/libxml/hash.h b/plugins/Variables/src/libxml/hash.h new file mode 100644 index 0000000000..24c5f214c3 --- /dev/null +++ b/plugins/Variables/src/libxml/hash.h @@ -0,0 +1,166 @@ +/* + * hash.h: 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: + */ +/** + * xmlHashDeallocator: + * @payload: the data in the hash + * @name: the name associated + * + * Callback to free data from a hash. + */ +typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); +/** + * xmlHashCopier: + * @payload: the data in the hash + * @name: the name associated + * + * Callback to copy data from a hash. + * + * Returns a copy of the data or NULL in case of error. + */ +typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); +/** + * xmlHashScanner: + * @payload: the data in the hash + * @data: extra scannner data + * @name: the name associated + * + * Callback when scanning data in a hash with the simple scanner. + */ +typedef void (*xmlHashScanner)(void *payload, void *data, xmlChar *name); +/** + * xmlHashScannerFull: + * @payload: the data in the hash + * @data: extra scannner data + * @name: the name associated + * @name2: the second name associated + * @name3: the third name associated + * + * Callback when scanning data in a hash with the full scanner. + */ +typedef void (*xmlHashScannerFull)(void *payload, void *data, + const xmlChar *name, const xmlChar *name2, + const xmlChar *name3); + +/* + * 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 table); +void xmlHashScan (xmlHashTablePtr table, + xmlHashScanner f, + void *data); +void xmlHashScan3 (xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + xmlHashScanner f, + void *data); +void xmlHashScanFull (xmlHashTablePtr table, + xmlHashScannerFull f, + void *data); +void xmlHashScanFull3(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + xmlHashScannerFull f, + void *data); +#ifdef __cplusplus +} +#endif +#endif /* ! __XML_HASH_H__ */ diff --git a/plugins/Variables/src/libxml/list.h b/plugins/Variables/src/libxml/list.h new file mode 100644 index 0000000000..8c9515fe1d --- /dev/null +++ b/plugins/Variables/src/libxml/list.h @@ -0,0 +1,116 @@ +/* + * 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 + */ + +#ifndef __XML_LINK_INCLUDE__ +#define __XML_LINK_INCLUDE__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _xmlLink xmlLink; +typedef xmlLink *xmlLinkPtr; + +typedef struct _xmlList xmlList; +typedef xmlList *xmlListPtr; + +/** + * xmlListDeallocator: + * @lk: the data to deallocate + * + * Callback function used to free data from a list. + */ +typedef void (*xmlListDeallocator) (xmlLinkPtr lk); +/** + * xmlListDataCompare: + * @data0: the first data + * @data1: the second data + * + * Callback function used to compare 2 data. + * + * Returns 0 is equality, -1 or 1 otherwise depending on the ordering. + */ +typedef int (*xmlListDataCompare) (const void *data0, const void *data1); +/** + * xmlListWalker: + * @data: the data found in the list + * @user: extra user provided data to the walker + * + * Callback function used when walking a list with xmlListWalk(). + * + * Returns 0 to stop walking the list, 1 otherwise. + */ +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 */ + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_LINK_INCLUDE__ */ diff --git a/plugins/Variables/src/libxml/nanoftp.h b/plugins/Variables/src/libxml/nanoftp.h new file mode 100644 index 0000000000..a0ba2ceeb3 --- /dev/null +++ b/plugins/Variables/src/libxml/nanoftp.h @@ -0,0 +1,117 @@ +/* + * nanohttp.c: minimalist FTP implementation to fetch external subsets. + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#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: + * @userData: the user provided context + * @data: the data received + * @len: its size in bytes + * + * 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); + +/* + * Rather 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/plugins/Variables/src/libxml/nanohttp.h b/plugins/Variables/src/libxml/nanohttp.h new file mode 100644 index 0000000000..4fb4e1d256 --- /dev/null +++ b/plugins/Variables/src/libxml/nanohttp.h @@ -0,0 +1,56 @@ +/* + * nanohttp.c: minimalist HTTP implementation to fetch external subsets. + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#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, + int ilen); +void * xmlNanoHTTPMethodRedir (const char *URL, + const char *method, + const char *input, + char **contentType, + char **redir, + const char *headers, + int ilen); +void * xmlNanoHTTPOpen (const char *URL, + char **contentType); +void * xmlNanoHTTPOpenRedir (const char *URL, + char **contentType, + char **redir); +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/plugins/Variables/src/libxml/parser.h b/plugins/Variables/src/libxml/parser.h new file mode 100644 index 0000000000..ac98f4b944 --- /dev/null +++ b/plugins/Variables/src/libxml/parser.h @@ -0,0 +1,869 @@ +/* + * parser.h : Interfaces, constants and types related to the XML parser. + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#ifndef __XML_PARSER_H__ +#define __XML_PARSER_H__ + +#include "libxml/tree.h" +#include "libxml/valid.h" +#include "libxml/entities.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * XML_DEFAULT_VERSION: + * + * The default version of XML used: 1.0 + */ +#define XML_DEFAULT_VERSION "1.0" + +/** + * xmlParserInput: + * + * 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. + */ + +/** + * xmlParserInputDeallocate: + * @str: the string to deallocate + * + * Callback for freeing some parser input allocations. + */ +typedef void (* xmlParserInputDeallocate)(xmlChar *str); + +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 the file */ + const xmlChar *base; /* Base of the array to parse */ + const xmlChar *cur; /* Current char being parsed */ + const xmlChar *end; /* end of the array to parse */ + 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 */ +}; + +/** + * xmlParserNodeInfo: + * + * 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; +}; + +/** + * xmlParserInputState: + * + * The parser is now working also as a state based parser. + * The recursive one use the state 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, /* Within 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 */ + XML_PARSER_PUBLIC_LITERAL /* within a PUBLIC value */ +} xmlParserInputState; + +/** + * XML_DETECT_IDS: + * + * Bit in the loadsubset context field to tell to do ID/REFs lookups. + * Use it to initialize xmlLoadExtDtdDefaultValue. + */ +#define XML_DETECT_IDS 2 + +/** + * XML_COMPLETE_ATTRS: + * + * Bit in the loadsubset context field to tell to do complete the + * elements attributes lists with the ones defaulted from the DTDs. + * Use it to initialize xmlLoadExtDtdDefaultValue. + */ +#define XML_COMPLETE_ATTRS 4 + +/** + * xmlParserCtxt: + * + * The parser context. + * NOTE This doesn't completely define 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. + */ +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 */ + int linenumbers; /* set line number in element content */ + void *catalogs; /* document's own catalog */ + int recovery; /* run in recovery mode */ +}; + +/** + * xmlSAXLocator: + * + * A SAX Locator. + */ +struct _xmlSAXLocator { + const xmlChar *(*getPublicId)(void *ctx); + const xmlChar *(*getSystemId)(void *ctx); + int (*getLineNumber)(void *ctx); + int (*getColumnNumber)(void *ctx); +}; + +/** + * xmlSAXHandler: + * + * A SAX handler is bunch of callbacks called by the parser when processing + * of the input generate data or structure informations. + */ + +/** + * resolveEntitySAXFunc: + * @ctx: the user data (XML parser context) + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * + * Callback: + * The entity loader, to control the loading of external entities, + * the application can either: + * - override this resolveEntity() callback in the SAX block + * - or better use the xmlSetExternalEntityLoader() function to + * set up it's own entity resolution routine + * + * Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour. + */ +typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx, + const xmlChar *publicId, + const xmlChar *systemId); +/** + * internalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the root element name + * @ExternalID: the external ID + * @SystemID: the SYSTEM ID (e.g. filename or URL) + * + * Callback on internal subset declaration. + */ +typedef void (*internalSubsetSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +/** + * externalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the root element name + * @ExternalID: the external ID + * @SystemID: the SYSTEM ID (e.g. filename or URL) + * + * Callback on external subset declaration. + */ +typedef void (*externalSubsetSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar *ExternalID, + const xmlChar *SystemID); +/** + * getEntitySAXFunc: + * @ctx: the user data (XML parser context) + * @name: The entity name + * + * Get an entity by name. + * + * Returns the xmlEntityPtr if found. + */ +typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx, + const xmlChar *name); +/** + * getParameterEntitySAXFunc: + * @ctx: the user data (XML parser context) + * @name: The entity name + * + * Get a parameter entity by name. + * + * Returns the xmlEntityPtr if found. + */ +typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx, + const xmlChar *name); +/** + * entityDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the entity name + * @type: the entity type + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * @content: the entity value (without processing). + * + * An entity definition has been parsed. + */ +typedef void (*entityDeclSAXFunc) (void *ctx, + const xmlChar *name, + int type, + const xmlChar *publicId, + const xmlChar *systemId, + xmlChar *content); +/** + * notationDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The name of the notation + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * + * What to do when a notation declaration has been parsed. + */ +typedef void (*notationDeclSAXFunc)(void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId); +/** + * attributeDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @elem: the name of the element + * @fullname: the attribute name + * @type: the attribute type + * @def: the type of default value + * @defaultValue: the attribute default value + * @tree: the tree of enumerated value set + * + * An attribute definition has been parsed. + */ +typedef void (*attributeDeclSAXFunc)(void *ctx, + const xmlChar *elem, + const xmlChar *fullname, + int type, + int def, + const xmlChar *defaultValue, + xmlEnumerationPtr tree); +/** + * elementDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: the element name + * @type: the element type + * @content: the element value tree + * + * An element definition has been parsed. + */ +typedef void (*elementDeclSAXFunc)(void *ctx, + const xmlChar *name, + int type, + xmlElementContentPtr content); +/** + * unparsedEntityDeclSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The name of the entity + * @publicId: The public ID of the entity + * @systemId: The system ID of the entity + * @notationName: the name of the notation + * + * What to do when an unparsed entity declaration is parsed. + */ +typedef void (*unparsedEntityDeclSAXFunc)(void *ctx, + const xmlChar *name, + const xmlChar *publicId, + const xmlChar *systemId, + const xmlChar *notationName); +/** + * setDocumentLocatorSAXFunc: + * @ctx: the user data (XML parser context) + * @loc: A SAX Locator + * + * Receive the document locator at startup, actually xmlDefaultSAXLocator. + * Everything is available on the context, so this is useless in our case. + */ +typedef void (*setDocumentLocatorSAXFunc) (void *ctx, + xmlSAXLocatorPtr loc); +/** + * startDocumentSAXFunc: + * @ctx: the user data (XML parser context) + * + * Called when the document start being processed. + */ +typedef void (*startDocumentSAXFunc) (void *ctx); +/** + * endDocumentSAXFunc: + * @ctx: the user data (XML parser context) + * + * Called when the document end has been detected. + */ +typedef void (*endDocumentSAXFunc) (void *ctx); +/** + * startElementSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The element name, including namespace prefix + * @atts: An array of name/value attributes pairs, NULL terminated + * + * Called when an opening tag has been processed. + */ +typedef void (*startElementSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar **atts); +/** + * endElementSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The element name + * + * Called when the end of an element has been detected. + */ +typedef void (*endElementSAXFunc) (void *ctx, + const xmlChar *name); +/** + * attributeSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The attribute name, including namespace prefix + * @value: The attribute value + * + * Handle an attribute that has been read by the parser. + * The default handling is to convert the attribute into an + * DOM subtree and past it in a new xmlAttr element added to + * the element. + */ +typedef void (*attributeSAXFunc) (void *ctx, + const xmlChar *name, + const xmlChar *value); +/** + * referenceSAXFunc: + * @ctx: the user data (XML parser context) + * @name: The entity name + * + * Called when an entity reference is detected. + */ +typedef void (*referenceSAXFunc) (void *ctx, + const xmlChar *name); +/** + * charactersSAXFunc: + * @ctx: the user data (XML parser context) + * @ch: a xmlChar string + * @len: the number of xmlChar + * + * Receiving some chars from the parser. + */ +typedef void (*charactersSAXFunc) (void *ctx, + const xmlChar *ch, + int len); +/** + * ignorableWhitespaceSAXFunc: + * @ctx: the user data (XML parser context) + * @ch: a xmlChar string + * @len: the number of xmlChar + * + * Receiving some ignorable whitespaces from the parser. + * UNUSED: by default the DOM building will use characters. + */ +typedef void (*ignorableWhitespaceSAXFunc) (void *ctx, + const xmlChar *ch, + int len); +/** + * processingInstructionSAXFunc: + * @ctx: the user data (XML parser context) + * @target: the target name + * @data: the PI data's + * + * A processing instruction has been parsed. + */ +typedef void (*processingInstructionSAXFunc) (void *ctx, + const xmlChar *target, + const xmlChar *data); +/** + * commentSAXFunc: + * @ctx: the user data (XML parser context) + * @value: the comment content + * + * A comment has been parsed. + */ +typedef void (*commentSAXFunc) (void *ctx, + const xmlChar *value); +/** + * cdataBlockSAXFunc: + * @ctx: the user data (XML parser context) + * @value: The pcdata content + * @len: the block length + * + * Called when a pcdata block has been parsed. + */ +typedef void (*cdataBlockSAXFunc) ( + void *ctx, + const xmlChar *value, + int len); +/** + * warningSAXFunc: + * @ctx: an XML parser context + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Display and format a warning messages, callback. + */ +typedef void (*warningSAXFunc) (void *ctx, + const char *msg, ...); +/** + * errorSAXFunc: + * @ctx: an XML parser context + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Display and format an error messages, callback. + */ +typedef void (*errorSAXFunc) (void *ctx, + const char *msg, ...); +/** + * fatalErrorSAXFunc: + * @ctx: an XML parser context + * @msg: the message to display/transmit + * @...: extra parameters for the message display + * + * Display and format fatal error messages, callback. + * Note: so far fatalError() SAX callbacks are not used, error() + * get all the callbacks for errors. + */ +typedef void (*fatalErrorSAXFunc) (void *ctx, + const char *msg, ...); +/** + * isStandaloneSAXFunc: + * @ctx: the user data (XML parser context) + * + * Is this document tagged standalone? + * + * Returns 1 if true + */ +typedef int (*isStandaloneSAXFunc) (void *ctx); +/** + * hasInternalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * + * Does this document has an internal subset. + * + * Returns 1 if true + */ +typedef int (*hasInternalSubsetSAXFunc) (void *ctx); +/** + * hasExternalSubsetSAXFunc: + * @ctx: the user data (XML parser context) + * + * Does this document has an external subset? + * + * Returns 1 if true + */ +typedef int (*hasExternalSubsetSAXFunc) (void *ctx); + +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; /* unused error() get all the errors */ + getParameterEntitySAXFunc getParameterEntity; + cdataBlockSAXFunc cdataBlock; + externalSubsetSAXFunc externalSubset; + int initialized; +}; + +/** + * xmlExternalEntityLoader: + * @URL: The System ID of the resource requested + * @ID: The Public ID of the resource requested + * @context: the XML parser context + * + * External entity loaders types. + * + * Returns the entity input parser. + */ +typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, + const char *ID, + xmlParserCtxtPtr context); + +/* + * Global variables: just the default SAX interface tables and XML + * version infos. + */ +#if 0 +LIBXML_DLL_IMPORT extern const char *xmlParserVersion; +#endif + +/* +LIBXML_DLL_IMPORT extern xmlSAXLocator xmlDefaultSAXLocator; +LIBXML_DLL_IMPORT extern xmlSAXHandler xmlDefaultSAXHandler; +LIBXML_DLL_IMPORT extern xmlSAXHandler htmlDefaultSAXHandler; +LIBXML_DLL_IMPORT extern xmlSAXHandler docbDefaultSAXHandler; + */ + +/* + * Entity substitution default behavior. + */ + +#if 0 +LIBXML_DLL_IMPORT extern int xmlSubstituteEntitiesDefaultValue; +LIBXML_DLL_IMPORT extern int xmlGetWarningsDefaultValue; +#endif + +#ifdef __cplusplus +} +#endif +#include "libxml/encoding.h" +#include "libxml/xmlIO.h" +#include "libxml/globals.h" +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * 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 * xmlCharStrndup (const char *cur, + int len); +xmlChar * xmlCharStrdup (const char *cur); +xmlChar * xmlStrsub (const xmlChar *str, + int start, + int len); +const xmlChar * xmlStrchr (const xmlChar *str, + xmlChar val); +const xmlChar * xmlStrstr (const xmlChar *str, + const 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 (const 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); +int xmlLineNumbersDefault (int val); + +/* + * Recovery mode + */ +xmlDocPtr xmlRecoverDoc (xmlChar *cur); +xmlDocPtr xmlRecoverMemory (const 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, + const char *buffer, + int size); +xmlDocPtr xmlSAXParseMemory (xmlSAXHandlerPtr sax, + const char *buffer, + int size, + int recovery); +xmlDocPtr xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax, + const char *buffer, + int size, + int recovery, + void *data); +xmlDocPtr xmlSAXParseFile (xmlSAXHandlerPtr sax, + const char *filename, + int recovery); +xmlDocPtr xmlSAXParseFileWithData (xmlSAXHandlerPtr sax, + const char *filename, + int recovery, + void *data); +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 *lst); +int xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, + xmlSAXHandlerPtr sax, + void *user_data, + int depth, + const xmlChar *string, + xmlNodePtr *lst, + int recover); +int xmlParseExternalEntity (xmlDocPtr doc, + xmlSAXHandlerPtr sax, + void *user_data, + int depth, + const xmlChar *URL, + const xmlChar *ID, + xmlNodePtr *lst); +int xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, + const xmlChar *URL, + const xmlChar *ID, + xmlNodePtr *lst); + +/* + * 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 xmlParserCtxtPtr ctxt, + const xmlNodePtr node); +void xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); +void xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq); +unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, + const xmlNodePtr node); +void xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt, + const xmlParserNodeInfoPtr info); + +/* + * External entities handling actually implemented in xmlIO. + */ + +void xmlSetExternalEntityLoader(xmlExternalEntityLoader f); +xmlExternalEntityLoader + xmlGetExternalEntityLoader(void); +xmlParserInputPtr + xmlLoadExternalEntity (const char *URL, + const char *ID, + xmlParserCtxtPtr ctxt); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_PARSER_H__ */ + diff --git a/plugins/Variables/src/libxml/parserInternals.h b/plugins/Variables/src/libxml/parserInternals.h new file mode 100644 index 0000000000..8507442be8 --- /dev/null +++ b/plugins/Variables/src/libxml/parserInternals.h @@ -0,0 +1,413 @@ +/* + * parserInternals.h : internals routines exported by the parser. + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + * + */ + +#ifndef __XML_PARSER_INTERNALS_H__ +#define __XML_PARSER_INTERNALS_H__ + +#include <libxml/parser.h> +#include <libxml/HTMLparser.h> + +#ifdef __cplusplus +extern "C" { +#endif + + /** + * XML_MAX_NAMELEN: + * + * Identifiers can be longer, but this will be more costly + * at runtime. + */ +#define XML_MAX_NAMELEN 100 + +/** + * INPUT_CHUNK: + * + * 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. * + * * + ************************************************************************/ +/** + * IS_CHAR: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [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))) + +/** + * IS_BLANK: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [3] S ::= (#x20 | #x9 | #xD | #xA)+ + */ +#define IS_BLANK(c) (((c) == 0x20) || ((c) == 0x09) || ((c) == 0xA) || \ + ((c) == 0x0D)) + +/** + * IS_BASECHAR: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [85] BaseChar ::= ... long list see REC ... + */ +#define IS_BASECHAR(c) xmlIsBaseChar(c) + +/** + * IS_DIGIT: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [88] Digit ::= ... long list see REC ... + */ +#define IS_DIGIT(c) xmlIsDigit(c) + +/** + * IS_COMBINING: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * [87] CombiningChar ::= ... long list see REC ... + */ +#define IS_COMBINING(c) xmlIsCombining(c) + +/** + * IS_EXTENDER: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 | + * #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] | + * [#x309D-#x309E] | [#x30FC-#x30FE] + */ +#define IS_EXTENDER(c) xmlIsExtender(c) + +/** + * IS_IDEOGRAPHIC: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029] + */ +#define IS_IDEOGRAPHIC(c) xmlIsIdeographic(c) + +/** + * IS_LETTER: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [84] Letter ::= BaseChar | Ideographic + */ +#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c)) + + +/** + * IS_PUBIDCHAR: + * @c: an UNICODE value (int) + * + * Macro to check the following production in the XML spec: + * + * + * [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] + */ +#define IS_PUBIDCHAR(c) xmlIsPubidChar(c) + +/** + * SKIP_EOL: + * @p: and UTF8 string pointer + * + * Skips the end of line chars. + */ +#define SKIP_EOL(p) \ + if (*(p) == 0x13) { p++ ; if (*(p) == 0x10) p++; } \ + if (*(p) == 0x10) { p++ ; if (*(p) == 0x13) p++; } + +/** + * MOVETO_ENDTAG: + * @p: and UTF8 string pointer + * + * Skips to the next '>' char. + */ +#define MOVETO_ENDTAG(p) \ + while ((*p) && (*(p) != '>')) (p)++ + +/** + * MOVETO_STARTTAG: + * @p: and UTF8 string pointer + * + * Skips to the next '<' char. + */ +#define MOVETO_STARTTAG(p) \ + while ((*p) && (*(p) != '<')) (p)++ + +/** + * Global variables used for predefined strings. + */ +LIBXML_DLL_IMPORT extern const xmlChar xmlStringText[]; +LIBXML_DLL_IMPORT extern const xmlChar xmlStringTextNoenc[]; +LIBXML_DLL_IMPORT extern const xmlChar xmlStringComment[]; + +/* + * Function to finish the 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 xmlIsExtender (int c); +int xmlIsCombining (int c); +int xmlIsChar (int c); + +/** + * Parser context. + */ +xmlParserCtxtPtr xmlCreateFileParserCtxt (const char *filename); +xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const 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); + +/** + * Entities + */ +void xmlHandleEntity (xmlParserCtxtPtr ctxt, + xmlEntityPtr entity); + +/** + * Input Streams. + */ +xmlParserInputPtr xmlNewStringInputStream (xmlParserCtxtPtr ctxt, + const xmlChar *buffer); +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, + xmlParserInputPtr inputchk); +xmlElementContentPtr xmlParseElementChildrenContentDecl + (xmlParserCtxtPtr ctxt, + xmlParserInputPtr inputchk); +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); +/** + * XML_SUBSTITUTE_NONE: + * + * If no entities need to be substituted. + */ +#define XML_SUBSTITUTE_NONE 0 +/** + * XML_SUBSTITUTE_REF: + * + * Whether general entities need to be substituted. + */ +#define XML_SUBSTITUTE_REF 1 +/** + * XML_SUBSTITUTE_PEREF: + * + * Whether parameter entities need to be substituted. + */ +#define XML_SUBSTITUTE_PEREF 2 +/** + * XML_SUBSTITUTE_BOTH: + * + * Both general and parameter entities need to be substituted. + */ +#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); +xmlChar *namePop (xmlParserCtxtPtr ctxt); +int namePush (xmlParserCtxtPtr ctxt, + xmlChar *value); + +/* + * other commodities 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); +int xmlCheckLanguageID (const xmlChar *lang); + +/* + * Really core function shared with HTML parser. + */ +int xmlCurrentChar (xmlParserCtxtPtr ctxt, + int *len); +int xmlCopyCharMultiByte (xmlChar *out, + int val); +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); +htmlParserCtxtPtr htmlCreateFileParserCtxt(const char *filename, + const char *encoding); +#endif + +/* + * Specific function to keep track of entities references + * and used by the XSLT debugger. + */ +/** + * xmlEntityReferenceFunc: + * @ent: the entity + * @firstNode: the fist node in the chunk + * @lastNode: the last nod in the chunk + * + * Callback function used when one needs to be able to track back the + * provenance of a chunk of nodes inherited from an entity replacement. + */ +typedef void (*xmlEntityReferenceFunc) (xmlEntityPtr ent, + xmlNodePtr firstNode, + xmlNodePtr lastNode); + +void xmlSetEntityReferenceFunc (xmlEntityReferenceFunc func); + + +#ifdef __cplusplus +} +#endif +#endif /* __XML_PARSER_INTERNALS_H__ */ diff --git a/plugins/Variables/src/libxml/schemasInternals.h b/plugins/Variables/src/libxml/schemasInternals.h new file mode 100644 index 0000000000..fb1f7eeb39 --- /dev/null +++ b/plugins/Variables/src/libxml/schemasInternals.h @@ -0,0 +1,354 @@ +/* + * schemasInternals.h : internal interfaces for the XML Schemas handling + * and schema validity checking + * + * See Copyright for the status of this software. + * + * Daniel.Veillard@w3.org + */ + + +#ifndef __XML_SCHEMA_INTERNALS_H__ +#define __XML_SCHEMA_INTERNALS_H__ + +#include <libxml/xmlversion.h> + +#ifdef LIBXML_SCHEMAS_ENABLED + +#include <libxml/xmlregexp.h> +#include <libxml/hash.h> + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * XML Schemas defines multiple type of types. + */ +typedef enum { + XML_SCHEMA_TYPE_BASIC = 1, + XML_SCHEMA_TYPE_ANY, + XML_SCHEMA_TYPE_FACET, + XML_SCHEMA_TYPE_SIMPLE, + XML_SCHEMA_TYPE_COMPLEX, + XML_SCHEMA_TYPE_SEQUENCE, + XML_SCHEMA_TYPE_CHOICE, + XML_SCHEMA_TYPE_ALL, + XML_SCHEMA_TYPE_SIMPLE_CONTENT, + XML_SCHEMA_TYPE_COMPLEX_CONTENT, + XML_SCHEMA_TYPE_UR, + XML_SCHEMA_TYPE_RESTRICTION, + XML_SCHEMA_TYPE_EXTENSION, + XML_SCHEMA_TYPE_ELEMENT, + XML_SCHEMA_TYPE_ATTRIBUTE, + XML_SCHEMA_TYPE_ATTRIBUTEGROUP, + XML_SCHEMA_TYPE_GROUP, + XML_SCHEMA_TYPE_NOTATION, + XML_SCHEMA_TYPE_LIST, + XML_SCHEMA_TYPE_UNION, + XML_SCHEMA_FACET_MININCLUSIVE = 1000, + XML_SCHEMA_FACET_MINEXCLUSIVE, + XML_SCHEMA_FACET_MAXINCLUSIVE, + XML_SCHEMA_FACET_MAXEXCLUSIVE, + XML_SCHEMA_FACET_TOTALDIGITS, + XML_SCHEMA_FACET_FRACTIONDIGITS, + XML_SCHEMA_FACET_PATTERN, + XML_SCHEMA_FACET_ENUMERATION, + XML_SCHEMA_FACET_WHITESPACE, + XML_SCHEMA_FACET_LENGTH, + XML_SCHEMA_FACET_MAXLENGTH, + XML_SCHEMA_FACET_MINLENGTH +} xmlSchemaTypeType; + +typedef enum { + XML_SCHEMA_CONTENT_UNKNOWN = 0, + XML_SCHEMA_CONTENT_EMPTY = 1, + XML_SCHEMA_CONTENT_ELEMENTS, + XML_SCHEMA_CONTENT_MIXED, + XML_SCHEMA_CONTENT_SIMPLE, + XML_SCHEMA_CONTENT_MIXED_OR_ELEMENTS, + XML_SCHEMA_CONTENT_BASIC, + XML_SCHEMA_CONTENT_ANY +} xmlSchemaContentType; + +typedef struct _xmlSchemaVal xmlSchemaVal; +typedef xmlSchemaVal *xmlSchemaValPtr; + +typedef struct _xmlSchemaType xmlSchemaType; +typedef xmlSchemaType *xmlSchemaTypePtr; + +typedef struct _xmlSchemaFacet xmlSchemaFacet; +typedef xmlSchemaFacet *xmlSchemaFacetPtr; + +/** + * Annotation + */ +typedef struct _xmlSchemaAnnot xmlSchemaAnnot; +typedef xmlSchemaAnnot *xmlSchemaAnnotPtr; +struct _xmlSchemaAnnot { + struct _xmlSchemaAnnot *next; + xmlNodePtr content; /* the annotation */ +}; + +/** + * An attribute definition. + */ + +#define XML_SCHEMAS_ANYATTR_SKIP 1 +#define XML_SCHEMAS_ANYATTR_LAX 2 +#define XML_SCHEMAS_ANYATTR_STRICT 3 + +typedef struct _xmlSchemaAttribute xmlSchemaAttribute; +typedef xmlSchemaAttribute *xmlSchemaAttributePtr; +struct _xmlSchemaAttribute { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ + xmlChar *name; + xmlChar *id; + xmlChar *ref; + xmlChar *refNs; + xmlChar *typeName; + xmlChar *typeNs; + xmlSchemaAnnotPtr annot; + + xmlSchemaTypePtr base; + int occurs; + xmlChar *defValue; + xmlSchemaTypePtr subtypes; +}; + +/** + * An attribute group definition. + * + * xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures + * must be kept similar + */ +typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup; +typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr; +struct _xmlSchemaAttributeGroup { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */ + xmlChar *name; + xmlChar *id; + xmlChar *ref; + xmlChar *refNs; + xmlSchemaAnnotPtr annot; + + xmlSchemaAttributePtr attributes; +}; + + +/** + * XML_SCHEMAS_TYPE_MIXED: + * + * the element content type is mixed + */ +#define XML_SCHEMAS_TYPE_MIXED 1 << 0 + +/** + * _xmlSchemaType: + * + * Schemas type definition. + */ +struct _xmlSchemaType { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaType *next;/* the next type if in a sequence ... */ + xmlChar *name; + xmlChar *id; + xmlChar *ref; + xmlChar *refNs; + xmlSchemaAnnotPtr annot; + xmlSchemaTypePtr subtypes; + xmlSchemaAttributePtr attributes; + xmlNodePtr node; + int minOccurs; + int maxOccurs; + + int flags; + xmlSchemaContentType contentType; + xmlChar *base; + xmlChar *baseNs; + xmlSchemaTypePtr baseType; + xmlSchemaFacetPtr facets; +}; + +/** + * xmlSchemaElement: + * An element definition. + * + * xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of + * structures must be kept similar + */ +/** + * XML_SCHEMAS_ELEM_NILLABLE: + * + * the element is nillable + */ +#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0 +/** + * XML_SCHEMAS_ELEM_GLOBAL: + * + * the element is global + */ +#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1 +/** + * XML_SCHEMAS_ELEM_DEFAULT: + * + * the element has a default value + */ +#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2 +/** + * XML_SCHEMAS_ELEM_FIXED: + * + * the element has a fixed value + */ +#define XML_SCHEMAS_ELEM_FIXED 1 << 3 +/** + * XML_SCHEMAS_ELEM_ABSTRACT: + * + * the element is abstract + */ +#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4 +/** + * XML_SCHEMAS_ELEM_TOPLEVEL: + * + * the element is top level + */ +#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5 +/** + * XML_SCHEMAS_ELEM_REF: + * + * the element is a reference to a type + */ +#define XML_SCHEMAS_ELEM_REF 1 << 6 + +typedef struct _xmlSchemaElement xmlSchemaElement; +typedef xmlSchemaElement *xmlSchemaElementPtr; +struct _xmlSchemaElement { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaType *next;/* the next type if in a sequence ... */ + xmlChar *name; + xmlChar *id; + xmlChar *ref; + xmlChar *refNs; + xmlSchemaAnnotPtr annot; + xmlSchemaTypePtr subtypes; + xmlSchemaAttributePtr attributes; + xmlNodePtr node; + int minOccurs; + int maxOccurs; + + int flags; + xmlChar *targetNamespace; + xmlChar *namedType; + xmlChar *namedTypeNs; + xmlChar *substGroup; + xmlChar *substGroupNs; + xmlChar *scope; + xmlChar *value; + struct _xmlSchemaElement *refDecl; + xmlRegexpPtr contModel; + xmlSchemaContentType contentType; +}; + +/* + * XML_SCHEMAS_FACET_UNKNOWN: + * + * unknown facet handling + */ +#define XML_SCHEMAS_FACET_UNKNOWN 0 +/* + * XML_SCHEMAS_FACET_PRESERVE: + * + * preserve the type of the facet + */ +#define XML_SCHEMAS_FACET_PRESERVE 1 +/* + * XML_SCHEMAS_FACET_REPLACE: + * + * replace the type of the facet + */ +#define XML_SCHEMAS_FACET_REPLACE 2 +/* + * XML_SCHEMAS_FACET_COLLAPSE: + * + * collapse the types of the facet + */ +#define XML_SCHEMAS_FACET_COLLAPSE 3 + +/** + * A facet definition. + */ +struct _xmlSchemaFacet { + xmlSchemaTypeType type; /* The kind of type */ + struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */ + xmlChar *value; + xmlChar *id; + xmlSchemaAnnotPtr annot; + xmlNodePtr node; + int fixed; + int whitespace; + xmlSchemaValPtr val; + xmlRegexpPtr regexp; +}; + +/** + * A notation definition. + */ +typedef struct _xmlSchemaNotation xmlSchemaNotation; +typedef xmlSchemaNotation *xmlSchemaNotationPtr; +struct _xmlSchemaNotation { + xmlSchemaTypeType type; /* The kind of type */ + xmlChar *name; + xmlSchemaAnnotPtr annot; + xmlChar *identifier; +}; + +/** + * XML_SCHEMAS_QUALIF_ELEM: + * + * the shemas requires qualified elements + */ +#define XML_SCHEMAS_QUALIF_ELEM 1 << 0 +/** + * XML_SCHEMAS_QUALIF_ATTR: + * + * the shemas requires qualified attributes + */ +#define XML_SCHEMAS_QUALIF_ATTR 1 << 1 +/** + * _xmlSchema: + * + * A Schemas definition + */ +struct _xmlSchema { + xmlChar *name; /* schema name */ + xmlChar *targetNamespace; /* the target namespace */ + xmlChar *version; + xmlChar *id; + xmlDocPtr doc; + xmlSchemaAnnotPtr annot; + int flags; + + xmlHashTablePtr typeDecl; + xmlHashTablePtr attrDecl; + xmlHashTablePtr attrgrpDecl; + xmlHashTablePtr elemDecl; + xmlHashTablePtr notaDecl; + + xmlHashTablePtr schemasImports; + + void *_private; /* unused by the library for users or bindings */ +}; + +void xmlSchemaFreeType (xmlSchemaTypePtr type); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ +#endif /* __XML_SCHEMA_INTERNALS_H__ */ + + diff --git a/plugins/Variables/src/libxml/threads.h b/plugins/Variables/src/libxml/threads.h new file mode 100644 index 0000000000..4ef7a17386 --- /dev/null +++ b/plugins/Variables/src/libxml/threads.h @@ -0,0 +1,62 @@ +/** + * threads.c: set of generic threading related routines + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#ifndef __XML_THREADS_H__ +#define __XML_THREADS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * xmlMutex are a simple mutual exception locks. + */ +typedef struct _xmlMutex xmlMutex; +typedef xmlMutex *xmlMutexPtr; + +/* + * xmlRMutex are reentrant mutual exception locks. + */ +typedef struct _xmlRMutex xmlRMutex; +typedef xmlRMutex *xmlRMutexPtr; + +#ifdef __cplusplus +} +#endif +#include "libxml/globals.h" +#ifdef __cplusplus +extern "C" { +#endif + +xmlMutexPtr xmlNewMutex (void); +void xmlMutexLock (xmlMutexPtr tok); +void xmlMutexUnlock (xmlMutexPtr tok); +void xmlFreeMutex (xmlMutexPtr tok); + +xmlRMutexPtr xmlNewRMutex (void); +void xmlRMutexLock (xmlRMutexPtr tok); +void xmlRMutexUnlock (xmlRMutexPtr tok); +void xmlFreeRMutex (xmlRMutexPtr tok); + +/* + * Library wide APIs. + */ +void xmlInitThreads (void); +void xmlLockLibrary (void); +void xmlUnlockLibrary(void); +int xmlGetThreadId (void); +int xmlIsMainThread (void); +void xmlCleanupThreads(void); +xmlGlobalStatePtr xmlGetGlobalState(void); + +#ifdef __cplusplus +} +#endif + + +#endif /* __XML_THREADS_H__ */ diff --git a/plugins/Variables/src/libxml/tree.h b/plugins/Variables/src/libxml/tree.h new file mode 100644 index 0000000000..1a9fb0036d --- /dev/null +++ b/plugins/Variables/src/libxml/tree.h @@ -0,0 +1,905 @@ +/* + * tree.h : describes the structures found in an tree resulting + * from an XML parsing. + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + * + */ + +#ifndef __XML_TREE_H__ +#define __XML_TREE_H__ + +#include <stdio.h> +#include "libxml/xmlversion.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Some of the basic types pointer to structures: + */ +/* xmlIO.h */ +typedef struct _xmlParserInputBuffer xmlParserInputBuffer; +typedef xmlParserInputBuffer *xmlParserInputBufferPtr; + +typedef struct _xmlOutputBuffer xmlOutputBuffer; +typedef xmlOutputBuffer *xmlOutputBufferPtr; + +/* parser.h */ +typedef struct _xmlParserInput xmlParserInput; +typedef xmlParserInput *xmlParserInputPtr; + +typedef struct _xmlParserCtxt xmlParserCtxt; +typedef xmlParserCtxt *xmlParserCtxtPtr; + +typedef struct _xmlSAXLocator xmlSAXLocator; +typedef xmlSAXLocator *xmlSAXLocatorPtr; + +typedef struct _xmlSAXHandler xmlSAXHandler; +typedef xmlSAXHandler *xmlSAXHandlerPtr; + +/* entities.h */ +typedef struct _xmlEntity xmlEntity; +typedef xmlEntity *xmlEntityPtr; + +/** + * BASE_BUFFER_SIZE: + * + * default buffer size 4000. + */ +#define BASE_BUFFER_SIZE 4000 + +/** + * XML_XML_NAMESPACE: + * + * This is the namespace for the special xml: prefix predefined in the + * XML Namespace specification. + */ +#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_DOCB_ENABLED + ,XML_DOCB_DOCUMENT_NODE= 21 +#endif +} xmlElementType; + +/** + * xmlChar: + * + * This is a basic byte in an UTF-8 encoded string. + * It's unsigned allowing to pinpoint case where char * are assigned + * to xmlChar * (possibly making serialization back impossible). + */ + +typedef unsigned char xmlChar; + +/** + * BAD_CAST: + * + * Macro to cast a string to an xmlChar * when one know its safe. + */ +#define BAD_CAST (xmlChar *) + +/** + * xmlNotation: + * + * 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 */ +}; + +/** + * xmlAttributeType: + * + * A DTD Attribute type 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; + +/** + * xmlAttributeDefault: + * + * A DTD Attribute default definition. + */ + +typedef enum { + XML_ATTRIBUTE_NONE = 1, + XML_ATTRIBUTE_REQUIRED, + XML_ATTRIBUTE_IMPLIED, + XML_ATTRIBUTE_FIXED +} xmlAttributeDefault; + +/** + * xmlEnumeration: + * + * List structure used when there is an enumeration in DTDs. + */ + +typedef struct _xmlEnumeration xmlEnumeration; +typedef xmlEnumeration *xmlEnumerationPtr; +struct _xmlEnumeration { + struct _xmlEnumeration *next; /* next one */ + const xmlChar *name; /* Enumeration name */ +}; + +/** + * xmlAttribute: + * + * An Attribute declaration in a DTD. + */ + +typedef struct _xmlAttribute xmlAttribute; +typedef xmlAttribute *xmlAttributePtr; +struct _xmlAttribute { + void *_private; /* application data */ + 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 */ +}; + +/** + * xmlElementContentType: + * + * Possible definitions of element content types. + */ +typedef enum { + XML_ELEMENT_CONTENT_PCDATA = 1, + XML_ELEMENT_CONTENT_ELEMENT, + XML_ELEMENT_CONTENT_SEQ, + XML_ELEMENT_CONTENT_OR +} xmlElementContentType; + +/** + * xmlElementContentOccur: + * + * Possible definitions of element content occurrences. + */ +typedef enum { + XML_ELEMENT_CONTENT_ONCE = 1, + XML_ELEMENT_CONTENT_OPT, + XML_ELEMENT_CONTENT_MULT, + XML_ELEMENT_CONTENT_PLUS +} xmlElementContentOccur; + +/** + * xmlElementContent: + * + * An XML Element content as stored after parsing an element definition + * in a DTD. + */ + +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 */ + struct _xmlElementContent *parent; /* parent */ + const xmlChar *prefix; /* Namespace prefix */ +}; + +/** + * xmlElementTypeVal: + * + * The different possibilities for an element content type. + */ + +typedef enum { + XML_ELEMENT_TYPE_UNDEFINED = 0, + XML_ELEMENT_TYPE_EMPTY = 1, + XML_ELEMENT_TYPE_ANY, + XML_ELEMENT_TYPE_MIXED, + XML_ELEMENT_TYPE_ELEMENT +} xmlElementTypeVal; + + +#ifdef __cplusplus +} +#endif +#include "libxml/xmlregexp.h" +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlElement: + * + * An XML Element declaration from a DTD. + */ + +typedef struct _xmlElement xmlElement; +typedef xmlElement *xmlElementPtr; +struct _xmlElement { + void *_private; /* application data */ + 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 */ +#ifdef LIBXML_REGEXP_ENABLED + xmlRegexpPtr contModel; /* the validating regexp */ +#else + void *contModel; +#endif +}; + + +/** + * XML_LOCAL_NAMESPACE: + * + * A namespace declaration node. + */ +#define XML_LOCAL_NAMESPACE XML_NAMESPACE_DECL +typedef xmlElementType xmlNsType; + +/** + * xmlNs: + * + * An XML namespace. + * Note that prefix == NULL is valid, it defines the default namespace + * within the subtree (until overridden). + * + * xmlNsType is unified with xmlElementType. + */ + +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 */ + void *_private; /* application data */ +}; + +/** + * xmlDtd: + * + * An XML DTD, as defined by <!DOCTYPE ... There is actually one for + * the internal subset and for the external subset. + */ +typedef struct _xmlDtd xmlDtd; +typedef xmlDtd *xmlDtdPtr; +struct _xmlDtd { + void *_private; /* application data */ + 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 */ +}; + +/** + * xmlAttr: + * + * An attribute on an XML node. + */ +typedef struct _xmlAttr xmlAttr; +typedef xmlAttr *xmlAttrPtr; +struct _xmlAttr { + void *_private; /* application data */ + 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 */ +}; + +/** + * xmlID: + * + * 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 attribute holding it */ + const xmlChar *name; /* The attribute if attr is not available */ + int lineno; /* The line number if attr is not available */ +}; + +/** + * xmlRef: + * + * 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 attribute holding it */ + const xmlChar *name; /* The attribute if attr is not available */ + int lineno; /* The line number if attr is not available */ +}; + +/** + * xmlBufferAllocationScheme: + * + * A buffer allocation scheme can be defined to either match exactly the + * need or double it's allocated size each time it is found too small. + */ + +typedef enum { + XML_BUFFER_ALLOC_DOUBLEIT, + XML_BUFFER_ALLOC_EXACT +} xmlBufferAllocationScheme; + +/** + * xmlBuffer: + * + * A buffer structure. + */ +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 */ +}; + +/** + * xmlNode: + * + * A node in an XML tree. + */ +typedef struct _xmlNode xmlNode; +typedef xmlNode *xmlNodePtr; +struct _xmlNode { + void *_private; /* application data */ + 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 */ + + /* End of common part */ + xmlNs *ns; /* pointer to the associated namespace */ + xmlChar *content; /* the content */ + struct _xmlAttr *properties;/* properties list */ + xmlNs *nsDef; /* namespace definitions on this node */ +}; + +/** + * XML_GET_CONTENT: + * + * Macro to extract the content pointer of a node. + */ +#define XML_GET_CONTENT(n) \ + ((n)->type == XML_ELEMENT_NODE ? NULL : (n)->content) + +/** + * XML_GET_LINE: + * + * Macro to extract the line number of an element node. + * This will work only if line numbering is activated by + * calling xmlLineNumbersDefault(1) before parsing. + */ +#define XML_GET_LINE(n) \ + ((n)->type == XML_ELEMENT_NODE ? (int) (n)->content : 0) + +/** + * xmlDoc: + * + * An XML document. + */ +typedef struct _xmlDoc xmlDoc; +typedef xmlDoc *xmlDocPtr; +struct _xmlDoc { + void *_private; /* application data */ + 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 */ +}; + +/** + * xmlChildrenNode: + * + * Macro for compatibility naming layer with libxml1. + */ +#ifndef xmlChildrenNode +#define xmlChildrenNode children +#endif + +/** + * xmlRootNode: + * + * Macro for compatibility naming layer with libxml1. + */ +#ifndef xmlRootNode +#define xmlRootNode children +#endif + +/* + * Variables. + */ +#if 0 +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> */ +LIBXML_DLL_IMPORT extern int xmlDefaultBufferSize; /* default buffer size */ +#endif + +int xmlValidateNCName (const xmlChar *value, int space); +int xmlValidateQName (const xmlChar *value, int space); +int xmlValidateName (const xmlChar *value, int space); +int xmlValidateNMToken (const xmlChar *value, int space); + +/* + * Handling Buffers. + */ + +void xmlSetBufferAllocationScheme(xmlBufferAllocationScheme scheme); +xmlBufferAllocationScheme xmlGetBufferAllocationScheme(void); + +xmlBufferPtr xmlBufferCreate (void); +xmlBufferPtr xmlBufferCreateSize (size_t size); +int xmlBufferResize (xmlBufferPtr buf, + unsigned int 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); +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); +void xmlFreeNsList (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); +xmlAttrPtr xmlNewNsPropEatName (xmlNodePtr node, + xmlNsPtr ns, + 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 xmlNewDocNodeEatName (xmlDocPtr doc, + xmlNsPtr ns, + 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 xmlNewNodeEatName (xmlNsPtr ns, + 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 (const xmlNodePtr node, + int recursive); +xmlNodePtr xmlDocCopyNode (const xmlNodePtr node, + xmlDocPtr doc, + int recursive); +xmlNodePtr xmlCopyNodeList (const xmlNodePtr node); +xmlNodePtr xmlNewDocFragment (xmlDocPtr doc); + +/* + * Navigating. + */ +long xmlGetLineNo (xmlNodePtr node); +xmlChar * xmlGetNodePath (xmlNodePtr node); +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); +xmlChar * xmlGetNoNsProp (xmlNodePtr node, + const xmlChar *name); +xmlAttrPtr xmlHasProp (xmlNodePtr node, + const xmlChar *name); +xmlAttrPtr xmlHasNsProp (xmlNodePtr node, + const xmlChar *name, + const xmlChar *nameSpace); +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 cur); +int xmlUnsetProp (xmlNodePtr node, + const xmlChar *name); +int xmlUnsetNsProp (xmlNodePtr node, + xmlNsPtr ns, + const xmlChar *name); + +/* + * Internal, don't use. + */ +void xmlBufferWriteCHAR (xmlBufferPtr buf, + const xmlChar *string); +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 xmlDocFormatDump(FILE *f, + xmlDocPtr cur, + int format); +int xmlDocDump (FILE *f, + xmlDocPtr cur); +void xmlElemDump (FILE *f, + xmlDocPtr doc, + xmlNodePtr cur); +int xmlSaveFile (const char *filename, + xmlDocPtr cur); +int xmlSaveFormatFile (const char *filename, + xmlDocPtr cur, + int format); +int xmlNodeDump (xmlBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format); + +int xmlSaveFileTo (xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding); +int xmlSaveFormatFileTo (xmlOutputBufferPtr buf, + xmlDocPtr cur, + const char *encoding, + int format); +void xmlNodeDumpOutput (xmlOutputBufferPtr buf, + xmlDocPtr doc, + xmlNodePtr cur, + int level, + int format, + const char *encoding); + +int xmlSaveFormatFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding, + int format); + +int xmlSaveFileEnc (const char *filename, + xmlDocPtr cur, + const char *encoding); + +/* + * XHTML + */ +int xmlIsXHTML (const xmlChar *systemID, + const xmlChar *publicID); + +/* + * Compression. + */ +int xmlGetDocCompressMode (xmlDocPtr doc); +void xmlSetDocCompressMode (xmlDocPtr doc, + int mode); +int xmlGetCompressMode (void); +void xmlSetCompressMode (int mode); + +#ifdef __cplusplus +} +#endif +#ifndef __XML_PARSER_H__ +#include <libxml/xmlmemory.h> +#endif + +#endif /* __XML_TREE_H__ */ + diff --git a/plugins/Variables/src/libxml/uri.h b/plugins/Variables/src/libxml/uri.h new file mode 100644 index 0000000000..319c509d1b --- /dev/null +++ b/plugins/Variables/src/libxml/uri.h @@ -0,0 +1,68 @@ +/** + * uri.c: library of generic URI related routines + * + * Reference: RFC 2396 + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#ifndef __XML_URI_H__ +#define __XML_URI_H__ + +#include <libxml/tree.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlURI: + * + * A parsed URI reference. This is a struct containing the various fields + * as described in RFC 2396 but separated for further processing. + */ +typedef struct _xmlURI xmlURI; +typedef xmlURI *xmlURIPtr; +struct _xmlURI { + char *scheme; /* the URI scheme */ + char *opaque; /* opaque part */ + char *authority; /* the authority part */ + char *server; /* the server part */ + char *user; /* the user part */ + int port; /* the port number */ + char *path; /* the path string */ + char *query; /* the query string */ + char *fragment; /* the fragment identifier */ + int cleanup; /* parsing potentially unclean URI */ +}; + +/* + * 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 *str); +int xmlParseURIReference (xmlURIPtr uri, + const char *str); +xmlChar * xmlSaveUri (xmlURIPtr uri); +void xmlPrintURI (FILE *stream, + xmlURIPtr uri); +xmlChar * xmlURIEscapeStr (const xmlChar *str, + const xmlChar *list); +char * xmlURIUnescapeString (const char *str, + int len, + char *target); +int xmlNormalizeURIPath (char *path); +xmlChar * xmlURIEscape (const xmlChar *str); +void xmlFreeURI (xmlURIPtr uri); +xmlChar* xmlCanonicPath (const xmlChar *path); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_URI_H__ */ diff --git a/plugins/Variables/src/libxml/valid.h b/plugins/Variables/src/libxml/valid.h new file mode 100644 index 0000000000..dbf2aba562 --- /dev/null +++ b/plugins/Variables/src/libxml/valid.h @@ -0,0 +1,330 @@ +/* + * valid.h : interface to the DTD handling and the validity checking + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + + +#ifndef __XML_VALID_H__ +#define __XML_VALID_H__ + +#include "libxml/tree.h" +#include "libxml/list.h" +#include "libxml/xmlautomata.h" +#include "libxml/xmlregexp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Validation state added for non-determinist content model. + */ +typedef struct _xmlValidState xmlValidState; +typedef xmlValidState *xmlValidStatePtr; + +/** + * xmlValidityErrorFunc: + * @ctx: an xmlValidCtxtPtr validity error context + * @msg: the string to format *printf like vararg + * @...: remaining arguments to the format + * + * Callback called when a validity error is found. This is a message + * oriented function similar to an *printf function. + */ +typedef void (*xmlValidityErrorFunc) (void *ctx, + const char *msg, + ...); + +/** + * xmlValidityWarningFunc: + * @ctx: an xmlValidCtxtPtr validity error context + * @msg: the string to format *printf like vararg + * @...: remaining arguments to the format + * + * Callback called when a validity warning is found. This is a message + * oriented function similar to an *printf function. + */ +typedef void (*xmlValidityWarningFunc) (void *ctx, + const char *msg, + ...); + +/** + * xmlValidCtxt: + * An xmlValidCtxt is used for error reporting when validating. + */ +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 */ + + /* state state used for non-determinist content validation */ + xmlValidState *vstate; /* current state */ + int vstateNr; /* Depth of the validation stack */ + int vstateMax; /* Max depth of the validation stack */ + xmlValidState *vstateTab; /* array of validation states */ + +#ifdef LIBXML_REGEXP_ENABLED + xmlAutomataPtr am; /* the automata */ + xmlAutomataStatePtr state; /* used to build the automata */ +#else + void *am; + void *state; +#endif +}; + +/* + * 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 xmlSnprintfElementContent(char *buf, + int size, + xmlElementContentPtr content, + int glob); +/* DEPRECATED */ +void xmlSprintfElementContent(char *buf, + xmlElementContentPtr content, + int glob); +/* DEPRECATED */ + +/* 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); +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); +void xmlFreeRefTable (xmlRefTablePtr table); +int xmlIsRef (xmlDocPtr doc, + xmlNodePtr elem, + xmlAttrPtr attr); +int xmlRemoveRef (xmlDocPtr doc, xmlAttrPtr attr); +xmlListPtr xmlGetRefs (xmlDocPtr doc, + const xmlChar *ID); + +/** + * 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); +xmlChar * xmlValidCtxtNormalizeAttributeValue(xmlValidCtxtPtr ctxt, + 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 xmlValidateOneNamespace (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *prefix, + xmlNsPtr ns, + 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); +xmlAttributePtr xmlGetDtdQAttrDesc (xmlDtdPtr dtd, + const xmlChar *elem, + const xmlChar *name, + const xmlChar *prefix); +xmlNotationPtr xmlGetDtdNotationDesc (xmlDtdPtr dtd, + const xmlChar *name); +xmlElementPtr xmlGetDtdQElementDesc (xmlDtdPtr dtd, + const xmlChar *name, + const xmlChar *prefix); +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); +int xmlValidateNameValue (const xmlChar *value); +int xmlValidateNamesValue (const xmlChar *value); +int xmlValidateNmtokenValue (const xmlChar *value); +int xmlValidateNmtokensValue(const xmlChar *value); + +#ifdef LIBXML_REGEXP_ENABLED +/* + * Validation based on the regexp support + */ +int xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, + xmlElementPtr elem); + +int xmlValidatePushElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *qname); +int xmlValidatePushCData (xmlValidCtxtPtr ctxt, + const xmlChar *data, + int len); +int xmlValidatePopElement (xmlValidCtxtPtr ctxt, + xmlDocPtr doc, + xmlNodePtr elem, + const xmlChar *qname); +#endif /* LIBXML_REGEXP_ENABLED */ +#ifdef __cplusplus +} +#endif +#endif /* __XML_VALID_H__ */ diff --git a/plugins/Variables/src/libxml/xinclude.h b/plugins/Variables/src/libxml/xinclude.h new file mode 100644 index 0000000000..f59020f7a2 --- /dev/null +++ b/plugins/Variables/src/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.com + */ + +#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/plugins/Variables/src/libxml/xlink.h b/plugins/Variables/src/libxml/xlink.h new file mode 100644 index 0000000000..b5a0f91067 --- /dev/null +++ b/plugins/Variables/src/libxml/xlink.h @@ -0,0 +1,180 @@ +/* + * 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.com + */ + +#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 interact 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 overridden, 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/plugins/Variables/src/libxml/xmlIO.h b/plugins/Variables/src/libxml/xmlIO.h new file mode 100644 index 0000000000..a6870fc51b --- /dev/null +++ b/plugins/Variables/src/libxml/xmlIO.h @@ -0,0 +1,287 @@ +/* + * xmlIO.h : interface for the I/O interfaces used by the parser + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + * + */ + +#ifndef __XML_IO_H__ +#define __XML_IO_H__ + +#include <stdio.h> +#include "libxml/xmlversion.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Those are the functions and datatypes for the parser input + * I/O structures. + */ + +/** + * xmlInputMatchCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Input API to detect if the current handler + * can provide input fonctionnalities for this resource. + * + * Returns 1 if yes and 0 if another Input module should be used + */ +typedef int (*xmlInputMatchCallback) (char const *filename); +/** + * xmlInputOpenCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Input API to open the resource + * + * Returns an Input context or NULL in case or error + */ +typedef void * (*xmlInputOpenCallback) (char const *filename); +/** + * xmlInputReadCallback: + * @context: an Input context + * @buffer: the buffer to store data read + * @len: the length of the buffer in bytes + * + * Callback used in the I/O Input API to read the resource + * + * Returns the number of bytes read or -1 in case of error + */ +typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len); +/** + * xmlInputCloseCallback: + * @context: an Input context + * + * Callback used in the I/O Input API to close the resource + * + * Returns 0 or -1 in case of error + */ +typedef int (*xmlInputCloseCallback) (void * context); + +/* + * Those are the functions and datatypes for the library output + * I/O structures. + */ + +/** + * xmlOutputMatchCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Output API to detect if the current handler + * can provide output fonctionnalities for this resource. + * + * Returns 1 if yes and 0 if another Output module should be used + */ +typedef int (*xmlOutputMatchCallback) (char const *filename); +/** + * xmlOutputOpenCallback: + * @filename: the filename or URI + * + * Callback used in the I/O Output API to open the resource + * + * Returns an Output context or NULL in case or error + */ +typedef void * (*xmlOutputOpenCallback) (char const *filename); +/** + * xmlOutputWriteCallback: + * @context: an Output context + * @buffer: the buffer of data to write + * @len: the length of the buffer in bytes + * + * Callback used in the I/O Output API to write to the resource + * + * Returns the number of bytes written or -1 in case of error + */ +typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer, + int len); +/** + * xmlOutputCloseCallback: + * @context: an Output context + * + * Callback used in the I/O Output API to close the resource + * + * Returns 0 or -1 in case of error + */ +typedef int (*xmlOutputCloseCallback) (void * context); + +#ifdef __cplusplus +} +#endif + +#include "libxml/globals.h" +#include "libxml/tree.h" +#include "libxml/parser.h" +#include "libxml/encoding.h" + +#ifdef __cplusplus +extern "C" { +#endif +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 */ +}; + + +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 xmlCleanupInputCallbacks (void); +void xmlCleanupOutputCallbacks (void); + +void xmlRegisterDefaultInputCallbacks (void); +xmlParserInputBufferPtr + xmlAllocParserInputBuffer (xmlCharEncoding enc); + +xmlParserInputBufferPtr + xmlParserInputBufferCreateFilename (const char *URI, + xmlCharEncoding enc); +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 matchFunc, + xmlInputOpenCallback openFunc, + xmlInputReadCallback readFunc, + xmlInputCloseCallback closeFunc); +/* + * 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 matchFunc, + xmlOutputOpenCallback openFunc, + xmlOutputWriteCallback writeFunc, + xmlOutputCloseCallback closeFunc); + +/* This function only exists if HTTP support built into the library */ +#ifdef LIBXML_HTTP_ENABLED +void * xmlIOHTTPOpenW (const char * post_uri, + int compression ); +void xmlRegisterHTTPPostCallbacks (void ); +#endif + +/* + * A predefined entity loader disabling network accesses + */ +xmlParserInputPtr xmlNoNetExternalEntityLoader(const char *URL, + const char *ID, + xmlParserCtxtPtr ctxt); + +/* + * xmlNormalizeWindowsPath is obsolete, don't use it. + * Check xmlCanonicPath in uri.h for a better alternative. + */ +xmlChar * xmlNormalizeWindowsPath (const xmlChar *path); + +int xmlCheckFilename (const char *path); +/** + * Default 'file://' protocol callbacks + */ +int xmlFileMatch (const char *filename); +void * xmlFileOpen (const char *filename); +int xmlFileRead (void * context, + char * buffer, + int len); +int xmlFileClose (void * context); + +/** + * Default 'http://' protocol callbacks + */ +#ifdef LIBXML_HTTP_ENABLED +int xmlIOHTTPMatch (const char *filename); +void * xmlIOHTTPOpen (const char *filename); +int xmlIOHTTPRead (void * context, + char * buffer, + int len); +int xmlIOHTTPClose (void * context); +#endif /* LIBXML_HTTP_ENABLED */ + +/** + * Default 'ftp://' protocol callbacks + */ +#ifdef LIBXML_FTP_ENABLED +int xmlIOFTPMatch (const char *filename); +void * xmlIOFTPOpen (const char *filename); +int xmlIOFTPRead (void * context, + char * buffer, + int len); +int xmlIOFTPClose (void * context); +#endif /* LIBXML_FTP_ENABLED */ + +#ifdef __cplusplus +} +#endif + +#endif /* __XML_IO_H__ */ diff --git a/plugins/Variables/src/libxml/xmlautomata.h b/plugins/Variables/src/libxml/xmlautomata.h new file mode 100644 index 0000000000..cc25e0b715 --- /dev/null +++ b/plugins/Variables/src/libxml/xmlautomata.h @@ -0,0 +1,94 @@ +/* + * automata.h : description of the API to build regexp automats + * + * See Copyright for the status of this software. + * + * Daniel Veillard <veillard@redhat.com> + */ + +#ifndef __XML_AUTOMATA_H__ +#define __XML_AUTOMATA_H__ + +#include "libxml/xmlversion.h" +#include "libxml/tree.h" + +#ifdef LIBXML_AUTOMATA_ENABLED +#include "libxml/xmlregexp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlAutomataPtr: + * + * A libxml automata description, It can be compiled into a regexp + */ +typedef struct _xmlAutomata xmlAutomata; +typedef xmlAutomata *xmlAutomataPtr; + +/** + * xmlAutomataStatePtr: + * + * A state int the automata description, + */ +typedef struct _xmlAutomataState xmlAutomataState; +typedef xmlAutomataState *xmlAutomataStatePtr; + +/* + * Building API + */ +xmlAutomataPtr xmlNewAutomata (void); +void xmlFreeAutomata (xmlAutomataPtr am); + +xmlAutomataStatePtr xmlAutomataGetInitState (xmlAutomataPtr am); +int xmlAutomataSetFinalState(xmlAutomataPtr am, + xmlAutomataStatePtr state); +xmlAutomataStatePtr xmlAutomataNewState (xmlAutomataPtr am); +xmlAutomataStatePtr xmlAutomataNewTransition(xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + void *data); +xmlAutomataStatePtr xmlAutomataNewCountTrans(xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + int min, + int max, + void *data); +xmlAutomataStatePtr xmlAutomataNewOnceTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + const xmlChar *token, + int min, + int max, + void *data); +xmlAutomataStatePtr xmlAutomataNewAllTrans (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + int lax); +xmlAutomataStatePtr xmlAutomataNewEpsilon (xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to); +xmlAutomataStatePtr xmlAutomataNewCountedTrans(xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + int counter); +xmlAutomataStatePtr xmlAutomataNewCounterTrans(xmlAutomataPtr am, + xmlAutomataStatePtr from, + xmlAutomataStatePtr to, + int counter); +int xmlAutomataNewCounter (xmlAutomataPtr am, + int min, + int max); + +xmlRegexpPtr xmlAutomataCompile (xmlAutomataPtr am); +int xmlAutomataIsDeterminist(xmlAutomataPtr am); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_AUTOMATA_ENABLED */ +#endif /* __XML_AUTOMATA_H__ */ diff --git a/plugins/Variables/src/libxml/xmlerror.h b/plugins/Variables/src/libxml/xmlerror.h new file mode 100644 index 0000000000..a40a1ec7ab --- /dev/null +++ b/plugins/Variables/src/libxml/xmlerror.h @@ -0,0 +1,184 @@ +#include "libxml/parser.h" + +#ifndef __XML_ERROR_H__ +#define __XML_ERROR_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_FINISHED, + + 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 */ + XML_WAR_CATALOG_PI, /* 93 */ + XML_ERR_NO_DTD /* 94 */ +}xmlParserErrors; + +/** + * xmlGenericErrorFunc: + * @ctx: a parsing context + * @msg: the message + * @...: the extra arguments of the varags to format the message + * + * 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, + ...); + +/* + * Use the following function to reset the two global variables + * xmlGenericError and xmlGenericErrorContext. + */ +void xmlSetGenericErrorFunc (void *ctx, + xmlGenericErrorFunc handler); +void initGenericErrorDefaultFunc(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/plugins/Variables/src/libxml/xmlmemory.h b/plugins/Variables/src/libxml/xmlmemory.h new file mode 100644 index 0000000000..314d8f8339 --- /dev/null +++ b/plugins/Variables/src/libxml/xmlmemory.h @@ -0,0 +1,169 @@ +/* + * xmlmemory.h: interface for the memory allocation debug. + * + * daniel@veillard.com + */ + + +#ifndef _DEBUG_MEMORY_ALLOC_ +#define _DEBUG_MEMORY_ALLOC_ + +#include <stdio.h> +#include "libxml/xmlversion.h" + +/** + * DEBUG_MEMORY: + * + * DEBUG_MEMORY replaces the allocator with a collect and debug + * shell to the libc allocator. + * DEBUG_MEMORY should only be activated when debugging + * libxml i.e. if libxml has been configured with --with-debug-mem too. + */ +/* #define DEBUG_MEMORY_FREED */ +/* #define DEBUG_MEMORY_LOCATION */ + +#ifdef DEBUG +#ifndef DEBUG_MEMORY +#define DEBUG_MEMORY +#endif +#endif + +/** + * DEBUG_MEMORY_LOCATION: + * + * DEBUG_MEMORY_LOCATION should be activated only when debugging + * libxml i.e. if libxml has been configured with --with-debug-mem too. + */ +#ifdef DEBUG_MEMORY_LOCATION +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The XML memory wrapper support 4 basic overloadable functions. + */ +/** + * xmlFreeFunc: + * @mem: an already allocated block of memory + * + * Signature for a free() implementation. + */ +typedef void (*xmlFreeFunc)(void *mem); +/** + * xmlMallocFunc: + * @size: the size requested in bytes + * + * Signature for a malloc() implementation. + * + * Returns a pointer to the newly allocated block or NULL in case of error. + */ +typedef void *(*xmlMallocFunc)(size_t size); + +/** + * xmlReallocFunc: + * @mem: an already allocated block of memory + * @size: the new size requested in bytes + * + * Signature for a realloc() implementation. + * + * Returns a pointer to the newly reallocated block or NULL in case of error. + */ +typedef void *(*xmlReallocFunc)(void *mem, size_t size); + +/** + * xmlStrdupFunc: + * @str: a zero terminated string + * + * Signature for an strdup() implementation. + * + * Returns the copy of the string or NULL in case of error. + */ +typedef char *(*xmlStrdupFunc)(const char *str); + +/* + * 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); +void * xmlMemMalloc (size_t size); +void * xmlMemRealloc (void *ptr,size_t size); +void xmlMemFree (void *ptr); +char * xmlMemoryStrdup (const char *str); + +#ifdef DEBUG_MEMORY_LOCATION +/** + * xmlMalloc: + * @size: number of bytes to allocate + * + * Wrapper for the malloc() function used in the XML library. + * + * Returns the pointer to the allocated area or NULL in case of error. + */ +#define xmlMalloc(size) xmlMallocLoc((size), __FILE__, __LINE__) +/** + * xmlRealloc: + * @ptr: pointer to the existing allocated area + * @size: number of bytes to allocate + * + * Wrapper for the realloc() function used in the XML library. + * + * Returns the pointer to the allocated area or NULL in case of error. + */ +#define xmlRealloc(ptr, size) xmlReallocLoc((ptr), (size), __FILE__, __LINE__) +/** + * xmlMemStrdup: + * @str: pointer to the existing string + * + * Wrapper for the strdup() function, xmlStrdup() is usually preferred. + * + * Returns the pointer to the allocated area or NULL in case of error. + */ +#define xmlMemStrdup(str) xmlMemStrdupLoc((str), __FILE__, __LINE__) + +void * xmlMallocLoc(size_t size, const char *file, int line); +void * xmlReallocLoc(void *ptr,size_t size, const char *file, int line); +char * xmlMemStrdupLoc(const char *str, const char *file, int line); +#endif /* DEBUG_MEMORY_LOCATION */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#ifndef __XML_GLOBALS_H +#ifndef __XML_THREADS_H__ +#include "libxml/threads.h" +#include "libxml/globals.h" +#endif +#endif + +#endif /* _DEBUG_MEMORY_ALLOC_ */ + diff --git a/plugins/Variables/src/libxml/xmlregexp.h b/plugins/Variables/src/libxml/xmlregexp.h new file mode 100644 index 0000000000..f15ead03ae --- /dev/null +++ b/plugins/Variables/src/libxml/xmlregexp.h @@ -0,0 +1,81 @@ +/* + * regexp.h : describes the basic API for libxml regular expressions handling + * + * See Copyright for the status of this software. + * + * Daniel Veillard <veillard@redhat.com> + */ + +#ifndef __XML_REGEXP_H__ +#define __XML_REGEXP_H__ + +#include "libxml/xmlversion.h" + +#ifdef LIBXML_REGEXP_ENABLED + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * xmlRegexpPtr: + * + * A libxml regular expression, they can actually be far more complex + * thank the POSIX regex expressions. + */ +typedef struct _xmlRegexp xmlRegexp; +typedef xmlRegexp *xmlRegexpPtr; + +/** + * xmlRegExecCtxtPtr: + * + * A libxml progressive regular expression evaluation context + */ +typedef struct _xmlRegExecCtxt xmlRegExecCtxt; +typedef xmlRegExecCtxt *xmlRegExecCtxtPtr; + +#ifdef __cplusplus +} +#endif +#include "libxml/tree.h" +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The POSIX like API + */ +xmlRegexpPtr xmlRegexpCompile(const xmlChar *regexp); +void xmlRegFreeRegexp(xmlRegexpPtr regexp); +int xmlRegexpExec (xmlRegexpPtr comp, + const xmlChar *value); +void xmlRegexpPrint (FILE *output, + xmlRegexpPtr regexp); +int xmlRegexpIsDeterminist(xmlRegexpPtr comp); + +/* + * Callback function when doing a transition in the automata + */ +typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec, + const xmlChar *token, + void *transdata, + void *inputdata); + +/* + * The progressive API + */ +xmlRegExecCtxtPtr xmlRegNewExecCtxt (xmlRegexpPtr comp, + xmlRegExecCallbacks callback, + void *data); +void xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec); +int xmlRegExecPushString (xmlRegExecCtxtPtr exec, + const xmlChar *value, + void *data); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_REGEXP_ENABLED */ + +#endif /*__XML_REGEXP_H__ */ diff --git a/plugins/Variables/src/libxml/xmlschemas.h b/plugins/Variables/src/libxml/xmlschemas.h new file mode 100644 index 0000000000..14b9230832 --- /dev/null +++ b/plugins/Variables/src/libxml/xmlschemas.h @@ -0,0 +1,106 @@ +/* + * schemas.h : interface to the XML Schemas handling and schema validity + * checking + * + * See Copyright for the status of this software. + * + * Daniel.Veillard@w3.org + */ + + +#ifndef __XML_SCHEMA_H__ +#define __XML_SCHEMA_H__ + +#include <libxml/xmlversion.h> + +#ifdef LIBXML_SCHEMAS_ENABLED + +#include <libxml/tree.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + XML_SCHEMAS_ERR_OK = 0, + XML_SCHEMAS_ERR_NOROOT = 1, + XML_SCHEMAS_ERR_UNDECLAREDELEM, + XML_SCHEMAS_ERR_NOTTOPLEVEL, + XML_SCHEMAS_ERR_MISSING, + XML_SCHEMAS_ERR_WRONGELEM, + XML_SCHEMAS_ERR_NOTYPE, + XML_SCHEMAS_ERR_NOROLLBACK, + XML_SCHEMAS_ERR_ISABSTRACT, + XML_SCHEMAS_ERR_NOTEMPTY, + XML_SCHEMAS_ERR_ELEMCONT, + XML_SCHEMAS_ERR_HAVEDEFAULT, + XML_SCHEMAS_ERR_NOTNILLABLE, + XML_SCHEMAS_ERR_EXTRACONTENT, + XML_SCHEMAS_ERR_INVALIDATTR, + XML_SCHEMAS_ERR_INVALIDELEM, + XML_SCHEMAS_ERR_NOTDETERMINIST, + XML_SCHEMAS_ERR_CONSTRUCT, + XML_SCHEMAS_ERR_INTERNAL, + XML_SCHEMAS_ERR_NOTSIMPLE, + XML_SCHEMAS_ERR_ATTRUNKNOWN, + XML_SCHEMAS_ERR_ATTRINVALID, + XML_SCHEMAS_ERR_, + XML_SCHEMAS_ERR_XXX +} xmlSchemaValidError; + + +/** + * The schemas related types are kept internal + */ +typedef struct _xmlSchema xmlSchema; +typedef xmlSchema *xmlSchemaPtr; + +/** + * A schemas validation context + */ +typedef void (*xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...); +typedef void (*xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...); + +typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt; +typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr; + +typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt; +typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr; + +/* + * Interfaces for parsing. + */ +xmlSchemaParserCtxtPtr xmlSchemaNewParserCtxt (const char *URL); +xmlSchemaParserCtxtPtr xmlSchemaNewMemParserCtxt(const char *buffer, + int size); +void xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt); +void xmlSchemaSetParserErrors(xmlSchemaParserCtxtPtr ctxt, + xmlSchemaValidityErrorFunc err, + xmlSchemaValidityWarningFunc warn, + void *ctx); +xmlSchemaPtr xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt); +void xmlSchemaFree (xmlSchemaPtr schema); +void xmlSchemaDump (FILE *output, + xmlSchemaPtr schema); +/* + * Interfaces for validating + */ +void xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt, + xmlSchemaValidityErrorFunc err, + xmlSchemaValidityWarningFunc warn, + void *ctx); +xmlSchemaValidCtxtPtr xmlSchemaNewValidCtxt (xmlSchemaPtr schema); +void xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt); +int xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt, + xmlDocPtr instance); +int xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt, + xmlParserInputBufferPtr input, + xmlCharEncoding enc, + xmlSAXHandlerPtr sax, + void *user_data); +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ +#endif /* __XML_SCHEMA_H__ */ diff --git a/plugins/Variables/src/libxml/xmlschemastypes.h b/plugins/Variables/src/libxml/xmlschemastypes.h new file mode 100644 index 0000000000..a758c128e5 --- /dev/null +++ b/plugins/Variables/src/libxml/xmlschemastypes.h @@ -0,0 +1,42 @@ +/* + * schemastypes.c : interface of the XML Schema Datatypes + * definition and validity checking + * + * See Copyright for the status of this software. + * + * Daniel Veillard <veillard@redhat.com> + */ + + +#ifndef __XML_SCHEMA_TYPES_H__ +#define __XML_SCHEMA_TYPES_H__ + +#include <libxml/xmlversion.h> + +#ifdef LIBXML_SCHEMAS_ENABLED + +#include <libxml/schemasInternals.h> + +#ifdef __cplusplus +extern "C" { +#endif + +void xmlSchemaInitTypes (void); +void xmlSchemaCleanupTypes (void); +xmlSchemaTypePtr xmlSchemaGetPredefinedType (const xmlChar *name, + const xmlChar *ns); +int xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type, + const xmlChar *value, + xmlSchemaValPtr *val); +int xmlSchemaValidateFacet (xmlSchemaTypePtr base, + xmlSchemaFacetPtr facet, + const xmlChar *value, + xmlSchemaValPtr val); +void xmlSchemaFreeValue (xmlSchemaValPtr val); + +#ifdef __cplusplus +} +#endif + +#endif /* LIBXML_SCHEMAS_ENABLED */ +#endif /* __XML_SCHEMA_TYPES_H__ */ diff --git a/plugins/Variables/src/libxml/xmlunicode.h b/plugins/Variables/src/libxml/xmlunicode.h new file mode 100644 index 0000000000..f0f1fe9ce9 --- /dev/null +++ b/plugins/Variables/src/libxml/xmlunicode.h @@ -0,0 +1,164 @@ +/* + * xmlunicode.h: this header exports interfaces for the Unicode character APIs + * + * This file is automatically generated from the + * UCS description files of the Unicode Character Database + * http://www.unicode.org/Public/3.1-Update/UnicodeCharacterDatabase-3.1.0.html + * using the genUnicode.py Python script. + * + * Generation date: Tue Apr 16 17:28:05 2002 + * Sources: Blocks-4.txt UnicodeData-3.1.0.txt + * Daniel Veillard <veillard@redhat.com> + */ + +#ifndef __XML_UNICODE_H__ +#define __XML_UNICODE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +int xmlUCSIsAlphabeticPresentationForms (int code); +int xmlUCSIsArabic (int code); +int xmlUCSIsArabicPresentationFormsA (int code); +int xmlUCSIsArabicPresentationFormsB (int code); +int xmlUCSIsArmenian (int code); +int xmlUCSIsArrows (int code); +int xmlUCSIsBasicLatin (int code); +int xmlUCSIsBengali (int code); +int xmlUCSIsBlockElements (int code); +int xmlUCSIsBopomofo (int code); +int xmlUCSIsBopomofoExtended (int code); +int xmlUCSIsBoxDrawing (int code); +int xmlUCSIsBraillePatterns (int code); +int xmlUCSIsByzantineMusicalSymbols (int code); +int xmlUCSIsCJKCompatibility (int code); +int xmlUCSIsCJKCompatibilityForms (int code); +int xmlUCSIsCJKCompatibilityIdeographs (int code); +int xmlUCSIsCJKCompatibilityIdeographsSupplement (int code); +int xmlUCSIsCJKRadicalsSupplement (int code); +int xmlUCSIsCJKSymbolsandPunctuation (int code); +int xmlUCSIsCJKUnifiedIdeographs (int code); +int xmlUCSIsCJKUnifiedIdeographsExtensionA (int code); +int xmlUCSIsCJKUnifiedIdeographsExtensionB (int code); +int xmlUCSIsCherokee (int code); +int xmlUCSIsCombiningDiacriticalMarks (int code); +int xmlUCSIsCombiningHalfMarks (int code); +int xmlUCSIsCombiningMarksforSymbols (int code); +int xmlUCSIsControlPictures (int code); +int xmlUCSIsCurrencySymbols (int code); +int xmlUCSIsCyrillic (int code); +int xmlUCSIsDeseret (int code); +int xmlUCSIsDevanagari (int code); +int xmlUCSIsDingbats (int code); +int xmlUCSIsEnclosedAlphanumerics (int code); +int xmlUCSIsEnclosedCJKLettersandMonths (int code); +int xmlUCSIsEthiopic (int code); +int xmlUCSIsGeneralPunctuation (int code); +int xmlUCSIsGeometricShapes (int code); +int xmlUCSIsGeorgian (int code); +int xmlUCSIsGothic (int code); +int xmlUCSIsGreek (int code); +int xmlUCSIsGreekExtended (int code); +int xmlUCSIsGujarati (int code); +int xmlUCSIsGurmukhi (int code); +int xmlUCSIsHalfwidthandFullwidthForms (int code); +int xmlUCSIsHangulCompatibilityJamo (int code); +int xmlUCSIsHangulJamo (int code); +int xmlUCSIsHangulSyllables (int code); +int xmlUCSIsHebrew (int code); +int xmlUCSIsHighPrivateUseSurrogates (int code); +int xmlUCSIsHighSurrogates (int code); +int xmlUCSIsHiragana (int code); +int xmlUCSIsIPAExtensions (int code); +int xmlUCSIsIdeographicDescriptionCharacters (int code); +int xmlUCSIsKanbun (int code); +int xmlUCSIsKangxiRadicals (int code); +int xmlUCSIsKannada (int code); +int xmlUCSIsKatakana (int code); +int xmlUCSIsKhmer (int code); +int xmlUCSIsLao (int code); +int xmlUCSIsLatin1Supplement (int code); +int xmlUCSIsLatinExtendedA (int code); +int xmlUCSIsLatinExtendedB (int code); +int xmlUCSIsLatinExtendedAdditional (int code); +int xmlUCSIsLetterlikeSymbols (int code); +int xmlUCSIsLowSurrogates (int code); +int xmlUCSIsMalayalam (int code); +int xmlUCSIsMathematicalAlphanumericSymbols (int code); +int xmlUCSIsMathematicalOperators (int code); +int xmlUCSIsMiscellaneousSymbols (int code); +int xmlUCSIsMiscellaneousTechnical (int code); +int xmlUCSIsMongolian (int code); +int xmlUCSIsMusicalSymbols (int code); +int xmlUCSIsMyanmar (int code); +int xmlUCSIsNumberForms (int code); +int xmlUCSIsOgham (int code); +int xmlUCSIsOldItalic (int code); +int xmlUCSIsOpticalCharacterRecognition (int code); +int xmlUCSIsOriya (int code); +int xmlUCSIsPrivateUse (int code); +int xmlUCSIsRunic (int code); +int xmlUCSIsSinhala (int code); +int xmlUCSIsSmallFormVariants (int code); +int xmlUCSIsSpacingModifierLetters (int code); +int xmlUCSIsSpecials (int code); +int xmlUCSIsSuperscriptsandSubscripts (int code); +int xmlUCSIsSyriac (int code); +int xmlUCSIsTags (int code); +int xmlUCSIsTamil (int code); +int xmlUCSIsTelugu (int code); +int xmlUCSIsThaana (int code); +int xmlUCSIsThai (int code); +int xmlUCSIsTibetan (int code); +int xmlUCSIsUnifiedCanadianAboriginalSyllabics (int code); +int xmlUCSIsYiRadicals (int code); +int xmlUCSIsYiSyllables (int code); + +int xmlUCSIsBlock (int code, + const char *block); + +int xmlUCSIsCatC (int code); +int xmlUCSIsCatCc (int code); +int xmlUCSIsCatCf (int code); +int xmlUCSIsCatCo (int code); +int xmlUCSIsCatCs (int code); +int xmlUCSIsCatL (int code); +int xmlUCSIsCatLl (int code); +int xmlUCSIsCatLm (int code); +int xmlUCSIsCatLo (int code); +int xmlUCSIsCatLt (int code); +int xmlUCSIsCatLu (int code); +int xmlUCSIsCatM (int code); +int xmlUCSIsCatMc (int code); +int xmlUCSIsCatMe (int code); +int xmlUCSIsCatMn (int code); +int xmlUCSIsCatN (int code); +int xmlUCSIsCatNd (int code); +int xmlUCSIsCatNl (int code); +int xmlUCSIsCatNo (int code); +int xmlUCSIsCatP (int code); +int xmlUCSIsCatPc (int code); +int xmlUCSIsCatPd (int code); +int xmlUCSIsCatPe (int code); +int xmlUCSIsCatPf (int code); +int xmlUCSIsCatPi (int code); +int xmlUCSIsCatPo (int code); +int xmlUCSIsCatPs (int code); +int xmlUCSIsCatS (int code); +int xmlUCSIsCatSc (int code); +int xmlUCSIsCatSk (int code); +int xmlUCSIsCatSm (int code); +int xmlUCSIsCatSo (int code); +int xmlUCSIsCatZ (int code); +int xmlUCSIsCatZl (int code); +int xmlUCSIsCatZp (int code); +int xmlUCSIsCatZs (int code); + +int xmlUCSIsCat (int code, + const char *cat); + +#ifdef __cplusplus +} +#endif +#endif /* __XML_UNICODE_H__ */ diff --git a/plugins/Variables/src/libxml/xmlversion.h b/plugins/Variables/src/libxml/xmlversion.h new file mode 100644 index 0000000000..1342eba969 --- /dev/null +++ b/plugins/Variables/src/libxml/xmlversion.h @@ -0,0 +1,272 @@ +/* + * xmlversion.h : compile-time version informations for the XML parser. + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#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 + */ +#ifndef LIBXML2_COMPILING_MSCCDEF +extern void xmlCheckVersion(int version); +#endif /* LIBXML2_COMPILING_MSCCDEF */ + +/** + * LIBXML_DOTTED_VERSION: + * + * the version string like "1.2.3" + */ +#define LIBXML_DOTTED_VERSION "2.5.4" + +/** + * LIBXML_VERSION: + * + * the version number: 1.2.3 value is 1002003 + */ +#define LIBXML_VERSION 20504 + +/** + * LIBXML_VERSION_STRING: + * + * the version number string, 1.2.3 value is "1002003" + */ +#define LIBXML_VERSION_STRING "20504" + +/** + * LIBXML_TEST_VERSION: + * + * Macro to check that the libxml version in use is compatible with + * the version the software has been compiled against + */ +#define LIBXML_TEST_VERSION xmlCheckVersion(20504); + +#ifndef VMS +#if 0 +/** + * WITH_TRIO: + * + * defined if the trio support need to be configured in + */ +#define WITH_TRIO +#else +/** + * WITHOUT_TRIO: + * + * defined if the trio support should not be configured in + */ +#define WITHOUT_TRIO +#endif +#else /* VMS */ +#define WITH_TRIO 1 +#endif /* VMS */ + +/** + * LIBXML_THREAD_ENABLED: + * + * Whether the thread support is configured in + */ +#if 0 +#if defined(_REENTRANT) || (_POSIX_C_SOURCE - 0 >= 199506L) +#define LIBXML_THREAD_ENABLED +#endif +#endif + +/** + * LIBXML_FTP_ENABLED: + * + * Whether the FTP support is configured in + */ +#if 1 +#define LIBXML_FTP_ENABLED +#endif + +/** + * LIBXML_HTTP_ENABLED: + * + * Whether the HTTP support is configured in + */ +#if 1 +#define LIBXML_HTTP_ENABLED +#endif + +/** + * LIBXML_HTML_ENABLED: + * + * Whether the HTML support is configured in + */ +#if 1 +#define LIBXML_HTML_ENABLED +#endif + +/** + * LIBXML_C14N_ENABLED: + * + * Whether the Canonicalization support is configured in + */ +#if 1 +#define LIBXML_C14N_ENABLED +#endif + +/** + * LIBXML_CATALOG_ENABLED: + * + * Whether the Catalog support is configured in + */ +#if 1 +#define LIBXML_CATALOG_ENABLED +#endif + +/** + * LIBXML_DOCB_ENABLED: + * + * Whether the SGML Docbook support is configured in + */ +#if 1 +#define LIBXML_DOCB_ENABLED +#endif + +/** + * LIBXML_XPATH_ENABLED: + * + * Whether XPath is configured in + */ +#if 1 +#define LIBXML_XPATH_ENABLED +#endif + +/** + * LIBXML_XPTR_ENABLED: + * + * Whether XPointer is configured in + */ +#if 1 +#define LIBXML_XPTR_ENABLED +#endif + +/** + * LIBXML_XINCLUDE_ENABLED: + * + * Whether XInclude is configured in + */ +#if 1 +#define LIBXML_XINCLUDE_ENABLED +#endif + +/** + * LIBXML_ICONV_ENABLED: + * + * Whether iconv support is available + */ +#if 0 +#define LIBXML_ICONV_ENABLED +#endif + +/** + * LIBXML_DEBUG_ENABLED: + * + * Whether Debugging module is configured in + */ +#if 1 +#define LIBXML_DEBUG_ENABLED +#endif + +/** + * DEBUG_MEMORY_LOCATION: + * + * Whether the memory debugging is configured in + */ +#if 0 +#define DEBUG_MEMORY_LOCATION +#endif + +/** + * LIBXML_UNICODE_ENABLED + * + * Whether the Unicode related interfaces are compiled in + */ +#if 1 +#define LIBXML_UNICODE_ENABLED +#endif + +/** + * LIBXML_REGEXP_ENABLED + * + * Whether the regular expressions interfaces are compiled in + */ +#if 1 +#define LIBXML_REGEXP_ENABLED +#endif + +/** + * LIBXML_AUTOMATA_ENABLED + * + * Whether the automata interfaces are compiled in + */ +#if 1 +#define LIBXML_AUTOMATA_ENABLED +#endif + +/** + * LIBXML_SCHEMAS_ENABLED + * + * Whether the Schemas validation interfaces are compiled in + */ +#if 1 +#define LIBXML_SCHEMAS_ENABLED +#endif + +/** + * LIBXML_DLL_IMPORT: + * + * Used on Windows (MS C compiler only) to declare a variable as + * imported from the library. This macro should be empty when compiling + * libxml itself. It should expand to __declspec(dllimport) + * when the client code includes this header, and that only if the client + * links dynamically against libxml. + * For this to work, we need three macros. One tells us which compiler is + * being used and luckily the compiler defines such a thing: _MSC_VER. The + * second macro tells us if we are compiling libxml or the client code and + * we define the macro IN_LIBXML on the compiler's command line for this + * purpose. The third macro, LIBXML_STATIC, must be defined by any client + * code which links against libxml statically. + */ +#ifndef LIBXML_DLL_IMPORT +#if (defined(_MSC_VER) || defined(__CYGWIN__)) && !defined(IN_LIBXML) && !defined(LIBXML_STATIC) +#define LIBXML_DLL_IMPORT __declspec(dllimport) +#else +#define LIBXML_DLL_IMPORT +#endif +#endif + +/** + * ATTRIBUTE_UNUSED: + * + * Macro used to signal to GCC unused function parameters + */ +#ifdef __GNUC__ +#ifdef HAVE_ANSIDECL_H +#include <ansidecl.h> +#endif +#ifndef ATTRIBUTE_UNUSED +#define ATTRIBUTE_UNUSED +#endif +#else +#define ATTRIBUTE_UNUSED +#endif + +#ifdef __cplusplus +} +#endif /* __cplusplus */ +#endif + + diff --git a/plugins/Variables/src/libxml/xpath.h b/plugins/Variables/src/libxml/xpath.h new file mode 100644 index 0000000000..9ec5453d88 --- /dev/null +++ b/plugins/Variables/src/libxml/xpath.h @@ -0,0 +1,410 @@ +/* + * 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.com + */ + +#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, + XPATH_ENCODING_ERROR, + XPATH_INVALID_CHAR_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 */ + /* @@ with_ns to check wether namespace nodes should be looked at @@ */ +}; + +/* + * 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; +}; + +/** + * xmlXPathConvertFunc: + * @obj: an XPath object + * @type: the number of the target type + * + * A conversion function is associated to a type and used to cast + * the new type to primitive values. + * + * Returns -1 in case of error, 0 otherwise + */ +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 */ +}; + +/** + * xmlXPathEvalFunc: + * @ctxt: an XPath parser context + * @nargs: the number of arguments passed to the function + * + * An XPath evaluation function, the parameters are on the XPath 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 */ +}; + +/** + * xmlXPathAxisFunc: + * @ctxt: the XPath interpreter context + * @cur: the previous node being explored on that axis + * + * 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. + * + * Returns the next node in that axis or NULL if at the end of the axis. + */ + +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 */ +}; + +/** + * xmlXPathContext: + * + * 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 */ + + /* The function name and URI when calling a function */ + const xmlChar *function; + const xmlChar *functionURI; + + /* function lookup function and data */ + void *funcLookupFunc; /* function lookup func */ + void *funcLookupData; /* function lookup data */ + + /* temporary namespace lists kept for walking the namespace axis */ + xmlNsPtr *tmpNsList; /* Array of namespaces */ + int tmpNsNr; /* number of namespace in scope */ +}; + +/* + * The structure of a compiled expression form is not public. + */ + +typedef struct _xmlXPathCompExpr xmlXPathCompExpr; +typedef xmlXPathCompExpr *xmlXPathCompExprPtr; + +/** + * xmlXPathParserContext: + * + * 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 */ + + xmlXPathCompExprPtr comp; /* the precompiled expression */ + int xptr; /* it this an XPointer expression */ + xmlNodePtr ancestor; /* used for walking preceding axis */ +}; + +/** + * xmlXPathFunction: + * @ctxt: the XPath interprestation context + * @nargs: the number of arguments + * + * An XPath function. + * The arguments (if any) are popped out from the context stack + * and the result is pushed on the stack. + */ + +typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs); + +/************************************************************************ + * * + * Public API * + * * + ************************************************************************/ + +/** + * Objects and Nodesets handling + */ + +LIBXML_DLL_IMPORT extern double xmlXPathNAN; +LIBXML_DLL_IMPORT extern double xmlXPathPINF; +LIBXML_DLL_IMPORT extern double xmlXPathNINF; + +int xmlXPathIsNaN (double val); +int xmlXPathIsInf (double val); + +/* These macros may later turn into functions */ +/** + * xmlXPathNodeSetGetLength: + * @ns: a node-set + * + * Implement a functionality similar to the DOM NodeList.length. + * + * Returns the number of nodes in the node-set. + */ +#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0) +/** + * xmlXPathNodeSetItem: + * @ns: a node-set + * @index: index of a node in the set + * + * Implements a functionality similar to the DOM NodeList.item(). + * + * Returns the xmlNodePtr at the given @index in @ns or NULL if + * @index is out of range (0 to length-1) + */ +#define xmlXPathNodeSetItem(ns, index) \ + ((((ns) != NULL) && \ + ((index) >= 0) && ((index) < (ns)->nodeNr)) ? \ + (ns)->nodeTab[(index)] \ + : NULL) +/** + * xmlXPathNodeSetIsEmpty: + * @ns: a node-set + * + * Checks whether @ns is empty or not. + * + * Returns %TRUE if @ns is an empty node-set. + */ +#define xmlXPathNodeSetIsEmpty(ns) \ + (((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL)) + + +void xmlXPathFreeObject (xmlXPathObjectPtr obj); +xmlNodeSetPtr xmlXPathNodeSetCreate (xmlNodePtr val); +void xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj); +void xmlXPathFreeNodeSet (xmlNodeSetPtr obj); +xmlXPathObjectPtr xmlXPathObjectCopy (xmlXPathObjectPtr val); +int xmlXPathCmpNodes (xmlNodePtr node1, + xmlNodePtr node2); +/** + * Conversion functions to basic types. + */ +int xmlXPathCastNumberToBoolean (double val); +int xmlXPathCastStringToBoolean (const xmlChar * val); +int xmlXPathCastNodeSetToBoolean (xmlNodeSetPtr ns); +int xmlXPathCastToBoolean (xmlXPathObjectPtr val); + +double xmlXPathCastBooleanToNumber (int val); +double xmlXPathCastStringToNumber (const xmlChar * val); +double xmlXPathCastNodeToNumber (xmlNodePtr node); +double xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns); +double xmlXPathCastToNumber (xmlXPathObjectPtr val); + +xmlChar * xmlXPathCastBooleanToString (int val); +xmlChar * xmlXPathCastNumberToString (double val); +xmlChar * xmlXPathCastNodeToString (xmlNodePtr node); +xmlChar * xmlXPathCastNodeSetToString (xmlNodeSetPtr ns); +xmlChar * xmlXPathCastToString (xmlXPathObjectPtr val); + +xmlXPathObjectPtr xmlXPathConvertBoolean (xmlXPathObjectPtr val); +xmlXPathObjectPtr xmlXPathConvertNumber (xmlXPathObjectPtr val); +xmlXPathObjectPtr xmlXPathConvertString (xmlXPathObjectPtr val); + +/** + * Context handling. + */ +void xmlXPathInit (void); +xmlXPathContextPtr xmlXPathNewContext (xmlDocPtr doc); +void xmlXPathFreeContext (xmlXPathContextPtr ctxt); + +/** + * Evaluation functions. + */ +xmlXPathObjectPtr xmlXPathEval (const xmlChar *str, + xmlXPathContextPtr ctx); +xmlXPathObjectPtr xmlXPathEvalExpression (const xmlChar *str, + xmlXPathContextPtr ctxt); +int xmlXPathEvalPredicate (xmlXPathContextPtr ctxt, + xmlXPathObjectPtr res); +/** + * Separate compilation/evaluation entry points. + */ +xmlXPathCompExprPtr xmlXPathCompile (const xmlChar *str); +xmlXPathObjectPtr xmlXPathCompiledEval (xmlXPathCompExprPtr comp, + xmlXPathContextPtr ctx); +void xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); +#ifdef __cplusplus +} +#endif +#endif /* ! __XML_XPATH_H__ */ diff --git a/plugins/Variables/src/libxml/xpathInternals.h b/plugins/Variables/src/libxml/xpathInternals.h new file mode 100644 index 0000000000..59a4e35d53 --- /dev/null +++ b/plugins/Variables/src/libxml/xpathInternals.h @@ -0,0 +1,580 @@ +/* + * xpathInternals.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.com + */ + +#ifndef __XML_XPATH_INTERNALS_H__ +#define __XML_XPATH_INTERNALS_H__ + +#include <libxml/xmlversion.h> +#include <libxml/xpath.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/************************************************************************ + * * + * Helpers * + * * + ************************************************************************/ + +/** + * Many of these macros may later turn into functions. They + * shouldn't be used in #ifdef's preprocessor instructions. + */ +/** + * xmlXPathSetError: + * @ctxt: an XPath parser context + * @err: an xmlXPathError code + * + * Raises an error. + */ +#define xmlXPathSetError(ctxt, err) \ + { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ + (ctxt)->error = (err); } + +/** + * xmlXPathSetArityError: + * @ctxt: an XPath parser context + * + * Raises an XPATH_INVALID_ARITY error. + */ +#define xmlXPathSetArityError(ctxt) \ + xmlXPathSetError((ctxt), XPATH_INVALID_ARITY) + +/** + * xmlXPathSetTypeError: + * @ctxt: an XPath parser context + * + * Raises an XPATH_INVALID_TYPE error. + */ +#define xmlXPathSetTypeError(ctxt) \ + xmlXPathSetError((ctxt), XPATH_INVALID_TYPE) + +/** + * xmlXPathGetError: + * @ctxt: an XPath parser context + * + * Get the error code of an XPath context. + * + * Returns the context error. + */ +#define xmlXPathGetError(ctxt) ((ctxt)->error) + +/** + * xmlXPathCheckError: + * @ctxt: an XPath parser context + * + * Check if an XPath error was raised. + * + * Returns true if an error has been raised, false otherwise. + */ +#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK) + +/** + * xmlXPathGetDocument: + * @ctxt: an XPath parser context + * + * Get the document of an XPath context. + * + * Returns the context document. + */ +#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc) + +/** + * xmlXPathGetContextNode: + * @ctxt: an XPath parser context + * + * Get the context node of an XPath context. + * + * Returns the context node. + */ +#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node) + +int xmlXPathPopBoolean (xmlXPathParserContextPtr ctxt); +double xmlXPathPopNumber (xmlXPathParserContextPtr ctxt); +xmlChar * xmlXPathPopString (xmlXPathParserContextPtr ctxt); +xmlNodeSetPtr xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt); +void * xmlXPathPopExternal (xmlXPathParserContextPtr ctxt); + +/** + * xmlXPathReturnBoolean: + * @ctxt: an XPath parser context + * @val: a boolean + * + * Pushes the boolean @val on the context stack. + */ +#define xmlXPathReturnBoolean(ctxt, val) \ + valuePush((ctxt), xmlXPathNewBoolean(val)) + +/** + * xmlXPathReturnTrue: + * @ctxt: an XPath parser context + * + * Pushes true on the context stack. + */ +#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1) + +/** + * xmlXPathReturnFalse: + * @ctxt: an XPath parser context + * + * Pushes false on the context stack. + */ +#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0) + +/** + * xmlXPathReturnNumber: + * @ctxt: an XPath parser context + * @val: a double + * + * Pushes the double @val on the context stack. + */ +#define xmlXPathReturnNumber(ctxt, val) \ + valuePush((ctxt), xmlXPathNewFloat(val)) + +/** + * xmlXPathReturnString: + * @ctxt: an XPath parser context + * @str: a string + * + * Pushes the string @str on the context stack. + */ +#define xmlXPathReturnString(ctxt, str) \ + valuePush((ctxt), xmlXPathWrapString(str)) + +/** + * xmlXPathReturnEmptyString: + * @ctxt: an XPath parser context + * + * Pushes an empty string on the stack. + */ +#define xmlXPathReturnEmptyString(ctxt) \ + valuePush((ctxt), xmlXPathNewCString("")) + +/** + * xmlXPathReturnNodeSet: + * @ctxt: an XPath parser context + * @ns: a node-set + * + * Pushes the node-set @ns on the context stack. + */ +#define xmlXPathReturnNodeSet(ctxt, ns) \ + valuePush((ctxt), xmlXPathWrapNodeSet(ns)) + +/** + * xmlXPathReturnEmptyNodeSet: + * @ctxt: an XPath parser context + * + * Pushes an empty node-set on the context stack. + */ +#define xmlXPathReturnEmptyNodeSet(ctxt) \ + valuePush((ctxt), xmlXPathNewNodeSet(NULL)) + +/** + * xmlXPathReturnExternal: + * @ctxt: an XPath parser context + * @val: user data + * + * Pushes user data on the context stack. + */ +#define xmlXPathReturnExternal(ctxt, val) \ + valuePush((ctxt), xmlXPathWrapExternal(val)) + +/** + * xmlXPathStackIsNodeSet: + * @ctxt: an XPath parser context + * + * Check if the current value on the XPath stack is a node set or + * an XSLT value tree. + * + * Returns true if the current object on the stack is a node-set. + */ +#define xmlXPathStackIsNodeSet(ctxt) \ + (((ctxt)->value != NULL) \ + && (((ctxt)->value->type == XPATH_NODESET) \ + || ((ctxt)->value->type == XPATH_XSLT_TREE))) + +/** + * xmlXPathStackIsExternal: + * @ctxt: an XPath parser context + * + * Checks if the current value on the XPath stack is an external + * object. + * + * Returns true if the current object on the stack is an external + * object. + */ +#define xmlXPathStackIsExternal(ctxt) \ + ((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS)) + +/** + * xmlXPathEmptyNodeSet: + * @ns: a node-set + * + * Empties a node-set. + */ +#define xmlXPathEmptyNodeSet(ns) \ + { while ((ns)->nodeNr > 0) (ns)->nodeTab[(ns)->nodeNr--] = NULL; } + +/** + * CHECK_ERROR: + * + * Macro to return from the function if an XPath error was detected. + */ +#define CHECK_ERROR \ + if (ctxt->error != XPATH_EXPRESSION_OK) return + +/** + * CHECK_ERROR0: + * + * Macro to return 0 from the function if an XPath error was detected. + */ +#define CHECK_ERROR0 \ + if (ctxt->error != XPATH_EXPRESSION_OK) return(0) + +/** + * XP_ERROR: + * @X: the error code + * + * Macro to raise an XPath error and return. + */ +#define XP_ERROR(X) \ + { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \ + ctxt->error = (X); return; } + +/** + * XP_ERROR0: + * @X: the error code + * + * Macro to raise an XPath error and return 0. + */ +#define XP_ERROR0(X) \ + { xmlXPatherror(ctxt, __FILE__, __LINE__, X); \ + ctxt->error = (X); return(0); } + +/** + * CHECK_TYPE: + * @typeval: the XPath type + * + * Macro to check that the value on top of the XPath stack is of a given + * type. + */ +#define CHECK_TYPE(typeval) \ + if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ + XP_ERROR(XPATH_INVALID_TYPE) + +/** + * CHECK_TYPE0: + * @typeval: the XPath type + * + * Macro to check that the value on top of the XPath stack is of a given + * type. Return(0) in case of failure + */ +#define CHECK_TYPE0(typeval) \ + if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \ + XP_ERROR0(XPATH_INVALID_TYPE) + +/** + * CHECK_ARITY: + * @x: the number of expected args + * + * Macro to check that the number of args passed to an XPath function matches. + */ +#define CHECK_ARITY(x) \ + if (nargs != (x)) \ + XP_ERROR(XPATH_INVALID_ARITY); + +/** + * CAST_TO_STRING: + * + * Macro to try to cast the value on the top of the XPath stack to a string. + */ +#define CAST_TO_STRING \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_STRING)) \ + xmlXPathStringFunction(ctxt, 1); + +/** + * CAST_TO_NUMBER: + * + * Macro to try to cast the value on the top of the XPath stack to a number. + */ +#define CAST_TO_NUMBER \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_NUMBER)) \ + xmlXPathNumberFunction(ctxt, 1); + +/** + * CAST_TO_BOOLEAN: + * + * Macro to try to cast the value on the top of the XPath stack to a boolean. + */ +#define CAST_TO_BOOLEAN \ + if ((ctxt->value != NULL) && (ctxt->value->type != XPATH_BOOLEAN)) \ + xmlXPathBooleanFunction(ctxt, 1); + +/* + * Variable Lookup forwarding. + */ +/** + * xmlXPathVariableLookupFunc: + * @ctxt: an XPath context + * @name: name of the variable + * @ns_uri: the namespace name hosting this variable + * + * Prototype for callbacks used to plug variable lookup in the XPath + * engine. + * + * Returns the XPath object value or NULL if not found. + */ +typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt, + const xmlChar *name, + const xmlChar *ns_uri); + +void xmlXPathRegisterVariableLookup (xmlXPathContextPtr ctxt, + xmlXPathVariableLookupFunc f, + void *data); + +/* + * Function Lookup forwarding. + */ +/** + * xmlXPathFuncLookupFunc: + * @ctxt: an XPath context + * @name: name of the function + * @ns_uri: the namespace name hosting this function + * + * Prototype for callbacks used to plug function lookup in the XPath + * engine. + * + * Returns the XPath function or NULL if not found. + */ +typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt, + const xmlChar *name, + const xmlChar *ns_uri); + +void xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, + xmlXPathFuncLookupFunc f, + void *funcCtxt); + +/* + * Error reporting. + */ +void xmlXPatherror (xmlXPathParserContextPtr ctxt, + const char *file, + int line, + int no); + +void xmlXPathDebugDumpObject (FILE *output, + xmlXPathObjectPtr cur, + int depth); +void xmlXPathDebugDumpCompExpr(FILE *output, + xmlXPathCompExprPtr comp, + int depth); + +/** + * NodeSet handling. + */ +int xmlXPathNodeSetContains (xmlNodeSetPtr cur, + xmlNodePtr val); +xmlNodeSetPtr xmlXPathDifference (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +xmlNodeSetPtr xmlXPathIntersection (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +xmlNodeSetPtr xmlXPathDistinctSorted (xmlNodeSetPtr nodes); +xmlNodeSetPtr xmlXPathDistinct (xmlNodeSetPtr nodes); + +int xmlXPathHasSameNodes (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +xmlNodeSetPtr xmlXPathNodeLeadingSorted (xmlNodeSetPtr nodes, + xmlNodePtr node); +xmlNodeSetPtr xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +xmlNodeSetPtr xmlXPathNodeLeading (xmlNodeSetPtr nodes, + xmlNodePtr node); +xmlNodeSetPtr xmlXPathLeading (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + +xmlNodeSetPtr xmlXPathNodeTrailingSorted (xmlNodeSetPtr nodes, + xmlNodePtr node); +xmlNodeSetPtr xmlXPathTrailingSorted (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); +xmlNodeSetPtr xmlXPathNodeTrailing (xmlNodeSetPtr nodes, + xmlNodePtr node); +xmlNodeSetPtr xmlXPathTrailing (xmlNodeSetPtr nodes1, + xmlNodeSetPtr nodes2); + + +/** + * Extending a context. + */ + +int xmlXPathRegisterNs (xmlXPathContextPtr ctxt, + const xmlChar *prefix, + const xmlChar *ns_uri); +const xmlChar * xmlXPathNsLookup (xmlXPathContextPtr ctxt, + const xmlChar *prefix); +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 xmlXPathWrapString (xmlChar *val); +xmlXPathObjectPtr xmlXPathWrapCString (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 xmlXPathNodeSetAddUnique (xmlNodeSetPtr cur, + xmlNodePtr val); +void xmlXPathNodeSetAddNs (xmlNodeSetPtr cur, + xmlNodePtr node, + xmlNsPtr ns); +void xmlXPathNodeSetSort (xmlNodeSetPtr set); + +void xmlXPathRoot (xmlXPathParserContextPtr ctxt); +void xmlXPathEvalExpr (xmlXPathParserContextPtr ctxt); +xmlChar * xmlXPathParseName (xmlXPathParserContextPtr ctxt); +xmlChar * xmlXPathParseNCName (xmlXPathParserContextPtr ctxt); + +/* + * Existing functions. + */ +double xmlXPathStringEvalNumber(const xmlChar *str); +int xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt, + xmlXPathObjectPtr res); +void xmlXPathRegisterAllFunctions(xmlXPathContextPtr ctxt); +xmlNodeSetPtr xmlXPathNodeSetMerge(xmlNodeSetPtr val1, xmlNodeSetPtr val2); +void xmlXPathNodeSetDel(xmlNodeSetPtr cur, xmlNodePtr val); +void xmlXPathNodeSetRemove(xmlNodeSetPtr cur, int val); +xmlXPathObjectPtr xmlXPathNewNodeSetList(xmlNodeSetPtr val); +xmlXPathObjectPtr xmlXPathWrapNodeSet(xmlNodeSetPtr val); +xmlXPathObjectPtr xmlXPathWrapExternal(void *val); + +int xmlXPathEqualValues(xmlXPathParserContextPtr ctxt); +int xmlXPathNotEqualValues(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); + +int xmlXPathIsNodeType(const xmlChar *name); + +/* + * Some of the axis navigation routines. + */ +xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, + xmlNodePtr cur); +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 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); + +/** + * Really internal functions + */ +void xmlXPathNodeSetFreeNs(xmlNsPtr ns); + +#ifdef __cplusplus +} +#endif +#endif /* ! __XML_XPATH_INTERNALS_H__ */ diff --git a/plugins/Variables/src/libxml/xpointer.h b/plugins/Variables/src/libxml/xpointer.h new file mode 100644 index 0000000000..80c465c70f --- /dev/null +++ b/plugins/Variables/src/libxml/xpointer.h @@ -0,0 +1,83 @@ +/* + * 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.com + */ + +#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. + */ + +xmlLocationSetPtr xmlXPtrLocationSetCreate(xmlXPathObjectPtr val); +void xmlXPtrFreeLocationSet (xmlLocationSetPtr obj); +xmlLocationSetPtr xmlXPtrLocationSetMerge (xmlLocationSetPtr val1, + xmlLocationSetPtr val2); +xmlXPathObjectPtr xmlXPtrNewRange (xmlNodePtr start, + int startindex, + xmlNodePtr end, + int endindex); +xmlXPathObjectPtr xmlXPtrNewRangePoints (xmlXPathObjectPtr start, + xmlXPathObjectPtr end); +xmlXPathObjectPtr xmlXPtrNewRangeNodePoint(xmlNodePtr start, + xmlXPathObjectPtr end); +xmlXPathObjectPtr xmlXPtrNewRangePointNode(xmlXPathObjectPtr start, + xmlNodePtr end); +xmlXPathObjectPtr xmlXPtrNewRangeNodes (xmlNodePtr start, + xmlNodePtr end); +xmlXPathObjectPtr xmlXPtrNewLocationSetNodes(xmlNodePtr start, + xmlNodePtr end); +xmlXPathObjectPtr xmlXPtrNewLocationSetNodeSet(xmlNodeSetPtr set); +xmlXPathObjectPtr xmlXPtrNewRangeNodeObject(xmlNodePtr start, + xmlXPathObjectPtr end); +xmlXPathObjectPtr xmlXPtrNewCollapsedRange(xmlNodePtr start); +void xmlXPtrLocationSetAdd (xmlLocationSetPtr cur, + xmlXPathObjectPtr val); +xmlXPathObjectPtr xmlXPtrWrapLocationSet (xmlLocationSetPtr val); +void xmlXPtrLocationSetDel (xmlLocationSetPtr cur, + xmlXPathObjectPtr val); +void xmlXPtrLocationSetRemove(xmlLocationSetPtr cur, + int val); + +/* + * 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__ */ |