[libxml2]Add libxml2 library

This commit is contained in:
zhoujiale
2026-07-26 16:57:28 +08:00
committed by zhoujiale
parent 0a44ec8a06
commit e841ac915d
3790 changed files with 668244 additions and 0 deletions
+397
View File
@@ -0,0 +1,397 @@
/**
* @file
*
* @brief HTML parser, doesn't support HTML5
*
* This module orginally implemented an HTML parser based on the
* (underspecified) HTML 4.0 spec. As of 2.14, the tokenizer
* conforms to HTML5. Tree construction still follows a custom,
* unspecified algorithm with many differences to HTML5.
*
* The parser defaults to ISO-8859-1, the default encoding of
* HTTP/1.0.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __HTML_PARSER_H__
#define __HTML_PARSER_H__
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#ifdef LIBXML_HTML_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/*
* Backward compatibility
*/
#define UTF8ToHtml htmlUTF8ToHtml
#define htmlDefaultSubelement(elt) elt->defaultsubelt
#define htmlElementAllowedHereDesc(parent,elt) \
htmlElementAllowedHere((parent), (elt)->name)
#define htmlRequiredAttrs(elt) (elt)->attrs_req
/*
* Most of the back-end structures from XML and HTML are shared.
*/
/** Same as xmlParserCtxt */
typedef xmlParserCtxt htmlParserCtxt;
typedef xmlParserCtxtPtr htmlParserCtxtPtr;
typedef xmlParserNodeInfo htmlParserNodeInfo;
/** Same as xmlSAXHandler */
typedef xmlSAXHandler htmlSAXHandler;
typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
/** Same as xmlParserInput */
typedef xmlParserInput htmlParserInput;
typedef xmlParserInputPtr htmlParserInputPtr;
typedef xmlDocPtr htmlDocPtr;
typedef xmlNodePtr htmlNodePtr;
/** @cond ignore */
/*
* 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; /* unused */
char endTag; /* Whether the end tag can be implied */
char saveEndTag; /* unused */
char empty; /* Is this an empty element ? */
char depr; /* unused */
char dtd; /* unused */
char isinline; /* is this a block 0 or inline 1 element */
const char *desc; /* the description */
const char** subelts XML_DEPRECATED_MEMBER;
const char* defaultsubelt XML_DEPRECATED_MEMBER;
const char** attrs_opt XML_DEPRECATED_MEMBER;
const char** attrs_depr XML_DEPRECATED_MEMBER;
const char** attrs_req XML_DEPRECATED_MEMBER;
int dataMode;
};
/*
* 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 */
};
#ifdef LIBXML_SAX1_ENABLED
/**
* @deprecated Use #xmlSAX2InitHtmlDefaultSAXHandler
*/
XML_DEPRECATED
XMLPUBVAR const xmlSAXHandlerV1 htmlDefaultSAXHandler;
#endif /* LIBXML_SAX1_ENABLED */
/** @endcond */
/*
* There is only few public functions.
*/
XML_DEPRECATED
XMLPUBFUN void
htmlInitAutoClose (void);
XML_DEPRECATED
XMLPUBFUN const htmlElemDesc *
htmlTagLookup (const xmlChar *tag);
XML_DEPRECATED
XMLPUBFUN const htmlEntityDesc *
htmlEntityLookup(const xmlChar *name);
XML_DEPRECATED
XMLPUBFUN const htmlEntityDesc *
htmlEntityValueLookup(unsigned int value);
XML_DEPRECATED
XMLPUBFUN int
htmlIsAutoClosed(xmlDoc *doc,
xmlNode *elem);
XML_DEPRECATED
XMLPUBFUN int
htmlAutoCloseTag(xmlDoc *doc,
const xmlChar *name,
xmlNode *elem);
XML_DEPRECATED
XMLPUBFUN const htmlEntityDesc *
htmlParseEntityRef(htmlParserCtxt *ctxt,
const xmlChar **str);
XML_DEPRECATED
XMLPUBFUN int
htmlParseCharRef(htmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
htmlParseElement(htmlParserCtxt *ctxt);
XMLPUBFUN htmlParserCtxt *
htmlNewParserCtxt(void);
XMLPUBFUN htmlParserCtxt *
htmlNewSAXParserCtxt(const htmlSAXHandler *sax,
void *userData);
XMLPUBFUN htmlParserCtxt *
htmlCreateMemoryParserCtxt(const char *buffer,
int size);
XMLPUBFUN int
htmlParseDocument(htmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
htmlSAXParseDoc (const xmlChar *cur,
const char *encoding,
htmlSAXHandler *sax,
void *userData);
XMLPUBFUN xmlDoc *
htmlParseDoc (const xmlChar *cur,
const char *encoding);
XMLPUBFUN htmlParserCtxt *
htmlCreateFileParserCtxt(const char *filename,
const char *encoding);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
htmlSAXParseFile(const char *filename,
const char *encoding,
htmlSAXHandler *sax,
void *userData);
XMLPUBFUN xmlDoc *
htmlParseFile (const char *filename,
const char *encoding);
XML_DEPRECATED
XMLPUBFUN int
htmlUTF8ToHtml (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
XML_DEPRECATED
XMLPUBFUN int
htmlEncodeEntities(unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen, int quoteChar);
XML_DEPRECATED
XMLPUBFUN int
htmlIsScriptAttribute(const xmlChar *name);
XML_DEPRECATED
XMLPUBFUN int
htmlHandleOmittedElem(int val);
#ifdef LIBXML_PUSH_ENABLED
/*
* Interfaces for the Push mode.
*/
XMLPUBFUN htmlParserCtxt *
htmlCreatePushParserCtxt(htmlSAXHandler *sax,
void *user_data,
const char *chunk,
int size,
const char *filename,
xmlCharEncoding enc);
XMLPUBFUN int
htmlParseChunk (htmlParserCtxt *ctxt,
const char *chunk,
int size,
int terminate);
#endif /* LIBXML_PUSH_ENABLED */
XMLPUBFUN void
htmlFreeParserCtxt (htmlParserCtxt *ctxt);
/*
* New set of simpler/more flexible APIs
*/
/**
* This is the set of HTML parser options that can be passed to
* #htmlReadDoc, #htmlCtxtSetOptions and other functions.
*/
typedef enum {
/**
* No effect as of 2.14.0.
*/
HTML_PARSE_RECOVER = 1<<0,
/**
* Do not default to a doctype if none was found.
*/
HTML_PARSE_NODEFDTD = 1<<2,
/**
* Disable error and warning reports to the error handlers.
* Errors are still accessible with xmlCtxtGetLastError().
*/
HTML_PARSE_NOERROR = 1<<5,
/**
* Disable warning reports.
*/
HTML_PARSE_NOWARNING = 1<<6,
/**
* No effect.
*/
HTML_PARSE_PEDANTIC = 1<<7,
/**
* Remove some text nodes containing only whitespace from the
* result document. Which nodes are removed depends on a conservative
* heuristic. The reindenting feature of the serialization code relies
* on this option to be set when parsing. Use of this option is
* DISCOURAGED.
*/
HTML_PARSE_NOBLANKS = 1<<8,
/**
* No effect.
*/
HTML_PARSE_NONET = 1<<11,
/**
* Do not add implied html, head or body elements.
*/
HTML_PARSE_NOIMPLIED = 1<<13,
/**
* Store small strings directly in the node struct to save
* memory.
*/
HTML_PARSE_COMPACT = 1<<16,
/**
* Relax some internal limits. See XML_PARSE_HUGE in xmlParserOption.
*
* @since 2.14.0
*
* Use XML_PARSE_HUGE with older versions.
*/
HTML_PARSE_HUGE = 1<<19,
/**
* Ignore the encoding in the HTML declaration. This option is
* mostly unneeded these days. The only effect is to enforce
* ISO-8859-1 decoding of ASCII-like data.
*/
HTML_PARSE_IGNORE_ENC =1<<21,
/**
* Enable reporting of line numbers larger than 65535.
*
* @since 2.14.0
*
* Use XML_PARSE_BIG_LINES with older versions.
*/
HTML_PARSE_BIG_LINES = 1<<22,
/**
* Make the tokenizer emit a SAX callback for each token. This results
* in unbalanced invocations of startElement and endElement.
*
* For now, this is only usable to tokenize HTML5 with custom SAX
* callbacks. A tree builder isn't implemented yet.
*
* @since 2.14.0
*/
HTML_PARSE_HTML5 = 1<<26
} htmlParserOption;
XMLPUBFUN void
htmlCtxtReset (htmlParserCtxt *ctxt);
XMLPUBFUN int
htmlCtxtSetOptions (htmlParserCtxt *ctxt,
int options);
XMLPUBFUN int
htmlCtxtUseOptions (htmlParserCtxt *ctxt,
int options);
XMLPUBFUN xmlDoc *
htmlReadDoc (const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDoc *
htmlReadFile (const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDoc *
htmlReadMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDoc *
htmlReadFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDoc *
htmlReadIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDoc *
htmlCtxtParseDocument (htmlParserCtxt *ctxt,
xmlParserInput *input);
XMLPUBFUN xmlDoc *
htmlCtxtReadDoc (xmlParserCtxt *ctxt,
const xmlChar *cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDoc *
htmlCtxtReadFile (xmlParserCtxt *ctxt,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlDoc *
htmlCtxtReadMemory (xmlParserCtxt *ctxt,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDoc *
htmlCtxtReadFd (xmlParserCtxt *ctxt,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlDoc *
htmlCtxtReadIO (xmlParserCtxt *ctxt,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
/**
* deprecated content model
*/
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
*/
XML_DEPRECATED
XMLPUBFUN htmlStatus htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
XML_DEPRECATED
XMLPUBFUN int htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
XML_DEPRECATED
XMLPUBFUN htmlStatus htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
XML_DEPRECATED
XMLPUBFUN htmlStatus htmlNodeStatus(xmlNode *, int) ;
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTML_ENABLED */
#endif /* __HTML_PARSER_H__ */
+123
View File
@@ -0,0 +1,123 @@
/**
* @file
*
* @brief HTML documents
*
* This modules implements functions to work with HTML documents,
* most of them related to serialization.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __HTML_TREE_H__
#define __HTML_TREE_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/HTMLparser.h>
#ifdef LIBXML_HTML_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/* Deprecated */
/** @cond ignore */
#define HTML_TEXT_NODE XML_TEXT_NODE
#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE
#define HTML_COMMENT_NODE XML_COMMENT_NODE
#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE
#define HTML_PI_NODE XML_PI_NODE
/** @endcond */
XMLPUBFUN xmlDoc *
htmlNewDoc (const xmlChar *URI,
const xmlChar *ExternalID);
XMLPUBFUN xmlDoc *
htmlNewDocNoDtD (const xmlChar *URI,
const xmlChar *ExternalID);
XMLPUBFUN const xmlChar *
htmlGetMetaEncoding (xmlDoc *doc);
XMLPUBFUN int
htmlSetMetaEncoding (xmlDoc *doc,
const xmlChar *encoding);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void
htmlDocDumpMemory (xmlDoc *cur,
xmlChar **mem,
int *size);
XMLPUBFUN void
htmlDocDumpMemoryFormat (xmlDoc *cur,
xmlChar **mem,
int *size,
int format);
XMLPUBFUN int
htmlSaveFile (const char *filename,
xmlDoc *cur);
XMLPUBFUN int
htmlSaveFileEnc (const char *filename,
xmlDoc *cur,
const char *encoding);
XMLPUBFUN int
htmlSaveFileFormat (const char *filename,
xmlDoc *cur,
const char *encoding,
int format);
XMLPUBFUN int
htmlNodeDump (xmlBuffer *buf,
xmlDoc *doc,
xmlNode *cur);
XMLPUBFUN int
htmlDocDump (FILE *f,
xmlDoc *cur);
XMLPUBFUN void
htmlNodeDumpFile (FILE *out,
xmlDoc *doc,
xmlNode *cur);
XMLPUBFUN int
htmlNodeDumpFileFormat (FILE *out,
xmlDoc *doc,
xmlNode *cur,
const char *encoding,
int format);
XMLPUBFUN void
htmlNodeDumpOutput (xmlOutputBuffer *buf,
xmlDoc *doc,
xmlNode *cur,
const char *encoding);
XMLPUBFUN void
htmlNodeDumpFormatOutput(xmlOutputBuffer *buf,
xmlDoc *doc,
xmlNode *cur,
const char *encoding,
int format);
XMLPUBFUN void
htmlDocContentDumpOutput(xmlOutputBuffer *buf,
xmlDoc *cur,
const char *encoding);
XMLPUBFUN void
htmlDocContentDumpFormatOutput(xmlOutputBuffer *buf,
xmlDoc *cur,
const char *encoding,
int format);
#endif /* LIBXML_OUTPUT_ENABLED */
XML_DEPRECATED
XMLPUBFUN int
htmlIsBooleanAttr (const xmlChar *name);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTML_ENABLED */
#endif /* __HTML_TREE_H__ */
+54
View File
@@ -0,0 +1,54 @@
## Process this file with automake to produce Makefile.in
xmlincdir = $(includedir)/libxml2/libxml
xmlinc_HEADERS = \
SAX.h \
entities.h \
encoding.h \
parser.h \
parserInternals.h \
xmlerror.h \
HTMLparser.h \
HTMLtree.h \
debugXML.h \
tree.h \
list.h \
hash.h \
xpath.h \
xpathInternals.h \
xpointer.h \
xinclude.h \
xmlIO.h \
xmlmemory.h \
nanohttp.h \
nanoftp.h \
uri.h \
valid.h \
xlink.h \
catalog.h \
threads.h \
globals.h \
c14n.h \
xmlautomata.h \
xmlregexp.h \
xmlmodule.h \
xmlschemas.h \
schemasInternals.h \
xmlschemastypes.h \
xmlstring.h \
xmlunicode.h \
xmlreader.h \
relaxng.h \
dict.h \
SAX2.h \
xmlexports.h \
xmlwriter.h \
chvalid.h \
pattern.h \
xmlsave.h \
schematron.h
nodist_xmlinc_HEADERS = xmlversion.h
EXTRA_DIST = xmlversion.h.in meson.build
+21
View File
@@ -0,0 +1,21 @@
/**
* @file
*
* @brief Old SAX version 1 handler, deprecated
*
* @deprecated set of SAX version 1 interfaces used to
* build the DOM tree.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_SAX_H__
#define __XML_SAX_H__
#ifdef __GNUC__
#warning "libxml/SAX.h is deprecated"
#endif
#endif /* __XML_SAX_H__ */
+173
View File
@@ -0,0 +1,173 @@
/**
* @file
*
* @brief SAX2 parser interface used to build the DOM tree
*
* those are the default SAX2 interfaces used by
* the library when building DOM tree.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_SAX2_H__
#define __XML_SAX2_H__
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN const xmlChar *
xmlSAX2GetPublicId (void *ctx);
XMLPUBFUN const xmlChar *
xmlSAX2GetSystemId (void *ctx);
XMLPUBFUN void
xmlSAX2SetDocumentLocator (void *ctx,
xmlSAXLocator *loc);
XMLPUBFUN int
xmlSAX2GetLineNumber (void *ctx);
XMLPUBFUN int
xmlSAX2GetColumnNumber (void *ctx);
XMLPUBFUN int
xmlSAX2IsStandalone (void *ctx);
XMLPUBFUN int
xmlSAX2HasInternalSubset (void *ctx);
XMLPUBFUN int
xmlSAX2HasExternalSubset (void *ctx);
XMLPUBFUN void
xmlSAX2InternalSubset (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void
xmlSAX2ExternalSubset (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN xmlEntity *
xmlSAX2GetEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlEntity *
xmlSAX2GetParameterEntity (void *ctx,
const xmlChar *name);
XMLPUBFUN xmlParserInput *
xmlSAX2ResolveEntity (void *ctx,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void
xmlSAX2EntityDecl (void *ctx,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
xmlChar *content);
XMLPUBFUN void
xmlSAX2AttributeDecl (void *ctx,
const xmlChar *elem,
const xmlChar *fullname,
int type,
int def,
const xmlChar *defaultValue,
xmlEnumeration *tree);
XMLPUBFUN void
xmlSAX2ElementDecl (void *ctx,
const xmlChar *name,
int type,
xmlElementContent *content);
XMLPUBFUN void
xmlSAX2NotationDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XMLPUBFUN void
xmlSAX2UnparsedEntityDecl (void *ctx,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *notationName);
XMLPUBFUN void
xmlSAX2StartDocument (void *ctx);
XMLPUBFUN void
xmlSAX2EndDocument (void *ctx);
XML_DEPRECATED
XMLPUBFUN void
xmlSAX2StartElement (void *ctx,
const xmlChar *fullname,
const xmlChar **atts);
XML_DEPRECATED
XMLPUBFUN void
xmlSAX2EndElement (void *ctx,
const xmlChar *name);
XMLPUBFUN void
xmlSAX2StartElementNs (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI,
int nb_namespaces,
const xmlChar **namespaces,
int nb_attributes,
int nb_defaulted,
const xmlChar **attributes);
XMLPUBFUN void
xmlSAX2EndElementNs (void *ctx,
const xmlChar *localname,
const xmlChar *prefix,
const xmlChar *URI);
XMLPUBFUN void
xmlSAX2Reference (void *ctx,
const xmlChar *name);
XMLPUBFUN void
xmlSAX2Characters (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void
xmlSAX2IgnorableWhitespace (void *ctx,
const xmlChar *ch,
int len);
XMLPUBFUN void
xmlSAX2ProcessingInstruction (void *ctx,
const xmlChar *target,
const xmlChar *data);
XMLPUBFUN void
xmlSAX2Comment (void *ctx,
const xmlChar *value);
XMLPUBFUN void
xmlSAX2CDataBlock (void *ctx,
const xmlChar *value,
int len);
#ifdef LIBXML_SAX1_ENABLED
XML_DEPRECATED
XMLPUBFUN int
xmlSAXDefaultVersion (int version);
#endif /* LIBXML_SAX1_ENABLED */
XMLPUBFUN int
xmlSAXVersion (xmlSAXHandler *hdlr,
int version);
XMLPUBFUN void
xmlSAX2InitDefaultSAXHandler (xmlSAXHandler *hdlr,
int warning);
#ifdef LIBXML_HTML_ENABLED
XMLPUBFUN void
xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr);
XML_DEPRECATED
XMLPUBFUN void
htmlDefaultSAXHandlerInit (void);
#endif
XML_DEPRECATED
XMLPUBFUN void
xmlDefaultSAXHandlerInit (void);
#ifdef __cplusplus
}
#endif
#endif /* __XML_SAX2_H__ */
+116
View File
@@ -0,0 +1,116 @@
/**
* @file
*
* @brief Provide Canonical XML and Exclusive XML Canonicalization
*
* the c14n modules provides a
*
* "Canonical XML" implementation
* http://www.w3.org/TR/xml-c14n
*
* and an
*
* "Exclusive XML Canonicalization" implementation
* http://www.w3.org/TR/xml-exc-c14n
* @copyright See Copyright for the status of this software.
*
* @author Aleksey Sanin
*/
#ifndef __XML_C14N_H__
#define __XML_C14N_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_C14N_ENABLED
#include <libxml/tree.h>
#include <libxml/xpath.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/*
* XML Canonicalization
* http://www.w3.org/TR/xml-c14n
*
* Exclusive XML Canonicalization
* 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 achieve this in libxml2 the document MUST be loaded with
* following options: XML_PARSE_DTDATTR | XML_PARSE_NOENT
*/
/**
* Predefined values for C14N modes
*/
typedef enum {
/** Original C14N 1.0 spec */
XML_C14N_1_0 = 0,
/** Exclusive C14N 1.0 spec */
XML_C14N_EXCLUSIVE_1_0 = 1,
/** C14N 1.1 spec */
XML_C14N_1_1 = 2
} xmlC14NMode;
XMLPUBFUN int
xmlC14NDocSaveTo (xmlDoc *doc,
xmlNodeSet *nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlOutputBuffer *buf);
XMLPUBFUN int
xmlC14NDocDumpMemory (xmlDoc *doc,
xmlNodeSet *nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlChar **doc_txt_ptr);
XMLPUBFUN int
xmlC14NDocSave (xmlDoc *doc,
xmlNodeSet *nodes,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
const char* filename,
int compression);
/**
* This is the core C14N function
*/
/**
* Signature for a C14N callback on visible nodes
*
* @param user_data user data
* @param node the current node
* @param parent the parent node
* @returns 1 if the node should be included
*/
typedef int (*xmlC14NIsVisibleCallback) (void* user_data,
xmlNode *node,
xmlNode *parent);
XMLPUBFUN int
xmlC14NExecute (xmlDoc *doc,
xmlC14NIsVisibleCallback is_visible_callback,
void* user_data,
int mode, /* a xmlC14NMode */
xmlChar **inclusive_ns_prefixes,
int with_comments,
xmlOutputBuffer *buf);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* LIBXML_C14N_ENABLED */
#endif /* __XML_C14N_H__ */
+210
View File
@@ -0,0 +1,210 @@
/**
* @file
*
* @brief interfaces to the Catalog handling system
*
* the catalog module implements the support for
* XML Catalogs and SGML catalogs
*
* SGML Open Technical Resolution TR9401:1997.
* http://www.jclark.com/sp/catalog.htm
*
* XML Catalogs Working Draft 06 August 2001
* http://www.oasis-open.org/committees/entity/spec-2001-08-06.html
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_CATALOG_H__
#define __XML_CATALOG_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#include <libxml/tree.h>
#ifdef LIBXML_CATALOG_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* The namespace for the XML Catalogs elements.
*/
#define XML_CATALOGS_NAMESPACE \
(const xmlChar *) "urn:oasis:names:tc:entity:xmlns:xml:catalog"
/**
* The specific XML Catalog Processing Instruction name.
*/
#define XML_CATALOG_PI \
(const xmlChar *) "oasis-xml-catalog"
/** @cond ignore */
/*
* 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;
/** @endcond */
/** XML catalog */
typedef struct _xmlCatalog xmlCatalog;
typedef xmlCatalog *xmlCatalogPtr;
/*
* Operations on a given catalog.
*/
XML_DEPRECATED
XMLPUBFUN xmlCatalog *
xmlNewCatalog (int sgml);
XML_DEPRECATED
XMLPUBFUN xmlCatalog *
xmlLoadACatalog (const char *filename);
#ifdef LIBXML_SGML_CATALOG_ENABLED
XML_DEPRECATED
XMLPUBFUN xmlCatalog *
xmlLoadSGMLSuperCatalog (const char *filename);
XML_DEPRECATED
XMLPUBFUN int
xmlConvertSGMLCatalog (xmlCatalog *catal);
#endif /* LIBXML_SGML_CATALOG_ENABLED */
XML_DEPRECATED
XMLPUBFUN int
xmlACatalogAdd (xmlCatalog *catal,
const xmlChar *type,
const xmlChar *orig,
const xmlChar *replace);
XML_DEPRECATED
XMLPUBFUN int
xmlACatalogRemove (xmlCatalog *catal,
const xmlChar *value);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlACatalogResolve (xmlCatalog *catal,
const xmlChar *pubID,
const xmlChar *sysID);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlACatalogResolveSystem(xmlCatalog *catal,
const xmlChar *sysID);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlACatalogResolvePublic(xmlCatalog *catal,
const xmlChar *pubID);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlACatalogResolveURI (xmlCatalog *catal,
const xmlChar *URI);
#ifdef LIBXML_OUTPUT_ENABLED
XML_DEPRECATED
XMLPUBFUN void
xmlACatalogDump (xmlCatalog *catal,
FILE *out);
#endif /* LIBXML_OUTPUT_ENABLED */
XML_DEPRECATED
XMLPUBFUN void
xmlFreeCatalog (xmlCatalog *catal);
XML_DEPRECATED
XMLPUBFUN int
xmlCatalogIsEmpty (xmlCatalog *catal);
/*
* Global operations.
*/
XMLPUBFUN void
xmlInitializeCatalog (void);
XMLPUBFUN int
xmlLoadCatalog (const char *filename);
XMLPUBFUN void
xmlLoadCatalogs (const char *paths);
XMLPUBFUN void
xmlCatalogCleanup (void);
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void
xmlCatalogDump (FILE *out);
XMLPUBFUN xmlDocPtr
xmlCatalogDumpDoc (void);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN xmlChar *
xmlCatalogResolve (const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar *
xmlCatalogResolveSystem (const xmlChar *sysID);
XMLPUBFUN xmlChar *
xmlCatalogResolvePublic (const xmlChar *pubID);
XMLPUBFUN xmlChar *
xmlCatalogResolveURI (const xmlChar *URI);
XMLPUBFUN int
xmlCatalogAdd (const xmlChar *type,
const xmlChar *orig,
const xmlChar *replace);
XMLPUBFUN int
xmlCatalogRemove (const xmlChar *value);
XML_DEPRECATED
XMLPUBFUN xmlDoc *
xmlParseCatalogFile (const char *filename);
#ifdef LIBXML_SGML_CATALOG_ENABLED
XML_DEPRECATED
XMLPUBFUN int
xmlCatalogConvert (void);
#endif /* LIBXML_SGML_CATALOG_ENABLED */
/*
* Strictly minimal interfaces for per-document catalogs used
* by the parser.
*/
XMLPUBFUN void
xmlCatalogFreeLocal (void *catalogs);
XMLPUBFUN void *
xmlCatalogAddLocal (void *catalogs,
const xmlChar *URL);
XMLPUBFUN xmlChar *
xmlCatalogLocalResolve (void *catalogs,
const xmlChar *pubID,
const xmlChar *sysID);
XMLPUBFUN xmlChar *
xmlCatalogLocalResolveURI(void *catalogs,
const xmlChar *URI);
/*
* Preference settings.
*/
XMLPUBFUN int
xmlCatalogSetDebug (int level);
XML_DEPRECATED
XMLPUBFUN xmlCatalogPrefer
xmlCatalogSetDefaultPrefer(xmlCatalogPrefer prefer);
XMLPUBFUN void
xmlCatalogSetDefaults (xmlCatalogAllow allow);
XMLPUBFUN xmlCatalogAllow
xmlCatalogGetDefaults (void);
/* DEPRECATED interfaces */
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlCatalogGetSystem (const xmlChar *sysID);
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlCatalogGetPublic (const xmlChar *pubID);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_CATALOG_ENABLED */
#endif /* __XML_CATALOG_H__ */
+218
View File
@@ -0,0 +1,218 @@
/**
* @file
*
* @brief Unicode character range checking
*
* this module exports interfaces for the character
* range validation APIs
*/
#ifndef __XML_CHVALID_H__
#define __XML_CHVALID_H__
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
/** @cond ignore */
/*
* Define our typedefs and structures
*
*/
typedef struct _xmlChSRange xmlChSRange;
typedef xmlChSRange *xmlChSRangePtr;
struct _xmlChSRange {
unsigned short low;
unsigned short high;
};
typedef struct _xmlChLRange xmlChLRange;
typedef xmlChLRange *xmlChLRangePtr;
struct _xmlChLRange {
unsigned int low;
unsigned int high;
};
typedef struct _xmlChRangeGroup xmlChRangeGroup;
typedef xmlChRangeGroup *xmlChRangeGroupPtr;
struct _xmlChRangeGroup {
int nbShortRange;
int nbLongRange;
const xmlChSRange *shortRange; /* points to an array of ranges */
const xmlChLRange *longRange;
};
XMLPUBVAR const xmlChRangeGroup xmlIsBaseCharGroup;
XMLPUBVAR const xmlChRangeGroup xmlIsCharGroup;
XMLPUBVAR const xmlChRangeGroup xmlIsCombiningGroup;
XMLPUBVAR const xmlChRangeGroup xmlIsDigitGroup;
XMLPUBVAR const xmlChRangeGroup xmlIsExtenderGroup;
XMLPUBVAR const xmlChRangeGroup xmlIsIdeographicGroup;
XMLPUBVAR const unsigned char xmlIsPubidChar_tab[256];
/**
* Range checking routine
*/
XMLPUBFUN int
xmlCharInRange(unsigned int val, const xmlChRangeGroup *group);
/** @endcond */
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsBaseChar_ch(c) (((0x41 <= (c)) && ((c) <= 0x5a)) || \
((0x61 <= (c)) && ((c) <= 0x7a)) || \
((0xc0 <= (c)) && ((c) <= 0xd6)) || \
((0xd8 <= (c)) && ((c) <= 0xf6)) || \
(0xf8 <= (c)))
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsBaseCharQ(c) (((c) < 0x100) ? \
xmlIsBaseChar_ch((c)) : \
xmlCharInRange((c), &xmlIsBaseCharGroup))
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsBlank_ch(c) (((c) == 0x20) || \
((0x9 <= (c)) && ((c) <= 0xa)) || \
((c) == 0xd))
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsBlankQ(c) (((c) < 0x100) ? \
xmlIsBlank_ch((c)) : 0)
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsChar_ch(c) (((0x9 <= (c)) && ((c) <= 0xa)) || \
((c) == 0xd) || \
(0x20 <= (c)))
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsCharQ(c) (((c) < 0x100) ? \
xmlIsChar_ch((c)) :\
(((0x100 <= (c)) && ((c) <= 0xd7ff)) || \
((0xe000 <= (c)) && ((c) <= 0xfffd)) || \
((0x10000 <= (c)) && ((c) <= 0x10ffff))))
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsCombiningQ(c) (((c) < 0x100) ? \
0 : \
xmlCharInRange((c), &xmlIsCombiningGroup))
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsDigit_ch(c) (((0x30 <= (c)) && ((c) <= 0x39)))
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsDigitQ(c) (((c) < 0x100) ? \
xmlIsDigit_ch((c)) : \
xmlCharInRange((c), &xmlIsDigitGroup))
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsExtender_ch(c) (((c) == 0xb7))
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsExtenderQ(c) (((c) < 0x100) ? \
xmlIsExtender_ch((c)) : \
xmlCharInRange((c), &xmlIsExtenderGroup))
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsIdeographicQ(c) (((c) < 0x100) ? \
0 :\
(((0x4e00 <= (c)) && ((c) <= 0x9fa5)) || \
((c) == 0x3007) || \
((0x3021 <= (c)) && ((c) <= 0x3029))))
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsPubidChar_ch(c) (xmlIsPubidChar_tab[(c)])
/**
* Automatically generated by genChRanges.py
*
* @param c char to validate
*/
#define xmlIsPubidCharQ(c) (((c) < 0x100) ? \
xmlIsPubidChar_ch((c)) : 0)
XML_DEPRECATED
XMLPUBFUN int
xmlIsBaseChar(unsigned int ch);
XML_DEPRECATED
XMLPUBFUN int
xmlIsBlank(unsigned int ch);
XML_DEPRECATED
XMLPUBFUN int
xmlIsChar(unsigned int ch);
XML_DEPRECATED
XMLPUBFUN int
xmlIsCombining(unsigned int ch);
XML_DEPRECATED
XMLPUBFUN int
xmlIsDigit(unsigned int ch);
XML_DEPRECATED
XMLPUBFUN int
xmlIsExtender(unsigned int ch);
XML_DEPRECATED
XMLPUBFUN int
xmlIsIdeographic(unsigned int ch);
XML_DEPRECATED
XMLPUBFUN int
xmlIsPubidChar(unsigned int ch);
#ifdef __cplusplus
}
#endif
#endif /* __XML_CHVALID_H__ */
+82
View File
@@ -0,0 +1,82 @@
/**
* @file
*
* @brief Tree debugging APIs
*
* Interfaces to a set of routines used for debugging the tree
* produced by the XML parser.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __DEBUG_XML__
#define __DEBUG_XML__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_DEBUG_ENABLED
#include <libxml/xpath.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The standard Dump routines.
*/
XMLPUBFUN void
xmlDebugDumpString (FILE *output,
const xmlChar *str);
XMLPUBFUN void
xmlDebugDumpAttr (FILE *output,
xmlAttr *attr,
int depth);
XMLPUBFUN void
xmlDebugDumpAttrList (FILE *output,
xmlAttr *attr,
int depth);
XMLPUBFUN void
xmlDebugDumpOneNode (FILE *output,
xmlNode *node,
int depth);
XMLPUBFUN void
xmlDebugDumpNode (FILE *output,
xmlNode *node,
int depth);
XMLPUBFUN void
xmlDebugDumpNodeList (FILE *output,
xmlNode *node,
int depth);
XMLPUBFUN void
xmlDebugDumpDocumentHead(FILE *output,
xmlDoc *doc);
XMLPUBFUN void
xmlDebugDumpDocument (FILE *output,
xmlDoc *doc);
XMLPUBFUN void
xmlDebugDumpDTD (FILE *output,
xmlDtd *dtd);
XMLPUBFUN void
xmlDebugDumpEntities (FILE *output,
xmlDoc *doc);
/****************************************************************
* *
* Checking routines *
* *
****************************************************************/
XMLPUBFUN int
xmlDebugCheckDocument (FILE * output,
xmlDoc *doc);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_DEBUG_ENABLED */
#endif /* __DEBUG_XML__ */
+85
View File
@@ -0,0 +1,85 @@
/**
* @file
*
* @brief string dictionary
*
* dictionary of reusable strings, just used to avoid allocation
* and freeing operations.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_DICT_H__
#define __XML_DICT_H__
#include <stddef.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Dictionary (pool for interned strings)
*/
typedef struct _xmlDict xmlDict;
typedef xmlDict *xmlDictPtr;
/*
* Initializer
*/
XML_DEPRECATED
XMLPUBFUN int xmlInitializeDict(void);
/*
* Constructor and destructor.
*/
XMLPUBFUN xmlDict *
xmlDictCreate (void);
XMLPUBFUN size_t
xmlDictSetLimit (xmlDict *dict,
size_t limit);
XMLPUBFUN size_t
xmlDictGetUsage (xmlDict *dict);
XMLPUBFUN xmlDict *
xmlDictCreateSub(xmlDict *sub);
XMLPUBFUN int
xmlDictReference(xmlDict *dict);
XMLPUBFUN void
xmlDictFree (xmlDict *dict);
/*
* Lookup of entry in the dictionary.
*/
XMLPUBFUN const xmlChar *
xmlDictLookup (xmlDict *dict,
const xmlChar *name,
int len);
XMLPUBFUN const xmlChar *
xmlDictExists (xmlDict *dict,
const xmlChar *name,
int len);
XMLPUBFUN const xmlChar *
xmlDictQLookup (xmlDict *dict,
const xmlChar *prefix,
const xmlChar *name);
XMLPUBFUN int
xmlDictOwns (xmlDict *dict,
const xmlChar *str);
XMLPUBFUN int
xmlDictSize (xmlDict *dict);
/*
* Cleanup function
*/
XML_DEPRECATED
XMLPUBFUN void
xmlDictCleanup (void);
#ifdef __cplusplus
}
#endif
#endif /* ! __XML_DICT_H__ */
+340
View File
@@ -0,0 +1,340 @@
/**
* @file
*
* @brief Character encoding conversion functions
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_CHAR_ENCODING_H__
#define __XML_CHAR_ENCODING_H__
#include <libxml/xmlversion.h>
#include <libxml/xmlerror.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Backward compatibility
*/
/** @cond ignore */
#define UTF8Toisolat1 xmlUTF8ToIsolat1
#define isolat1ToUTF8 xmlIsolat1ToUTF8
/** @endcond */
/**
* Encoding conversion errors
*/
typedef enum {
/** Success */
XML_ENC_ERR_SUCCESS = 0,
/** Internal or unclassified error */
XML_ENC_ERR_INTERNAL = -1,
/** Invalid or untranslatable input sequence */
XML_ENC_ERR_INPUT = -2,
/** Not enough space in output buffer */
XML_ENC_ERR_SPACE = -3,
/** Out-of-memory error */
XML_ENC_ERR_MEMORY = -4
} xmlCharEncError;
/**
* Predefined values for some standard encodings.
*/
typedef enum {
/** No char encoding detected */
XML_CHAR_ENCODING_ERROR= -1,
/** No char encoding detected */
XML_CHAR_ENCODING_NONE= 0,
/** UTF-8 */
XML_CHAR_ENCODING_UTF8= 1,
/** UTF-16 little endian */
XML_CHAR_ENCODING_UTF16LE= 2,
/** UTF-16 big endian */
XML_CHAR_ENCODING_UTF16BE= 3,
/** UCS-4 little endian */
XML_CHAR_ENCODING_UCS4LE= 4,
/** UCS-4 big endian */
XML_CHAR_ENCODING_UCS4BE= 5,
/** EBCDIC uh! */
XML_CHAR_ENCODING_EBCDIC= 6,
/** UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS4_2143=7,
/** UCS-4 unusual ordering */
XML_CHAR_ENCODING_UCS4_3412=8,
/** UCS-2 */
XML_CHAR_ENCODING_UCS2= 9,
/** ISO-8859-1 ISO Latin 1 */
XML_CHAR_ENCODING_8859_1= 10,
/** ISO-8859-2 ISO Latin 2 */
XML_CHAR_ENCODING_8859_2= 11,
/** ISO-8859-3 */
XML_CHAR_ENCODING_8859_3= 12,
/** ISO-8859-4 */
XML_CHAR_ENCODING_8859_4= 13,
/** ISO-8859-5 */
XML_CHAR_ENCODING_8859_5= 14,
/** ISO-8859-6 */
XML_CHAR_ENCODING_8859_6= 15,
/** ISO-8859-7 */
XML_CHAR_ENCODING_8859_7= 16,
/** ISO-8859-8 */
XML_CHAR_ENCODING_8859_8= 17,
/** ISO-8859-9 */
XML_CHAR_ENCODING_8859_9= 18,
/** ISO-2022-JP */
XML_CHAR_ENCODING_2022_JP= 19,
/** Shift_JIS */
XML_CHAR_ENCODING_SHIFT_JIS=20,
/** EUC-JP */
XML_CHAR_ENCODING_EUC_JP= 21,
/** pure ASCII */
XML_CHAR_ENCODING_ASCII= 22,
/** UTF-16 native, available since 2.14 */
XML_CHAR_ENCODING_UTF16= 23,
/** HTML (output only), available since 2.14 */
XML_CHAR_ENCODING_HTML= 24,
/** ISO-8859-10, available since 2.14 */
XML_CHAR_ENCODING_8859_10= 25,
/** ISO-8859-11, available since 2.14 */
XML_CHAR_ENCODING_8859_11= 26,
/** ISO-8859-13, available since 2.14 */
XML_CHAR_ENCODING_8859_13= 27,
/** ISO-8859-14, available since 2.14 */
XML_CHAR_ENCODING_8859_14= 28,
/** ISO-8859-15, available since 2.14 */
XML_CHAR_ENCODING_8859_15= 29,
/** ISO-8859-16, available since 2.14 */
XML_CHAR_ENCODING_8859_16= 30,
/** windows-1252, available since 2.15 */
XML_CHAR_ENCODING_WINDOWS_1252 = 31
} xmlCharEncoding;
/**
* Encoding conversion flags
*/
typedef enum {
/** Create converter for input (conversion to UTF-8) */
XML_ENC_INPUT = (1 << 0),
/** Create converter for output (conversion from UTF-8) */
XML_ENC_OUTPUT = (1 << 1),
/** Use HTML5 mappings */
XML_ENC_HTML = (1 << 2)
} xmlCharEncFlags;
/**
* Convert characters to UTF-8.
*
* On success, the value of `inlen` after return is the number of
* bytes consumed and `outlen` is the number of bytes produced.
*
* @param out a pointer to an array of bytes to store the UTF-8 result
* @param outlen the length of `out`
* @param in a pointer to an array of chars in the original encoding
* @param inlen the length of `in`
* @returns the number of bytes written or an xmlCharEncError code.
*/
typedef int (*xmlCharEncodingInputFunc)(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen);
/**
* Convert characters from UTF-8.
*
* On success, the value of `inlen` after return is the number of
* bytes consumed and `outlen` is the number of bytes produced.
*
* @param out a pointer to an array of bytes to store the result
* @param outlen the length of `out`
* @param in a pointer to an array of UTF-8 chars
* @param inlen the length of `in`
* @returns the number of bytes written or an xmlCharEncError code.
*/
typedef int (*xmlCharEncodingOutputFunc)(unsigned char *out, int *outlen,
const unsigned char *in, int *inlen);
/**
* Convert between character encodings.
*
* The value of `inlen` after return is the number of bytes consumed
* and `outlen` is the number of bytes produced.
*
* If the converter can consume partial multi-byte sequences, the
* `flush` flag can be used to detect truncated sequences at EOF.
* Otherwise, the flag can be ignored.
*
* @param vctxt conversion context
* @param out a pointer to an array of bytes to store the result
* @param outlen the length of `out`
* @param in a pointer to an array of input bytes
* @param inlen the length of `in`
* @param flush end of input
* @returns an xmlCharEncError code.
*/
typedef xmlCharEncError
(*xmlCharEncConvFunc)(void *vctxt, unsigned char *out, int *outlen,
const unsigned char *in, int *inlen, int flush);
/**
* Free a conversion context.
*
* @param vctxt conversion context
*/
typedef void
(*xmlCharEncConvCtxtDtor)(void *vctxt);
/** Character encoding converter */
typedef struct _xmlCharEncodingHandler xmlCharEncodingHandler;
typedef xmlCharEncodingHandler *xmlCharEncodingHandlerPtr;
/**
* A character encoding conversion handler for non UTF-8 encodings.
*
* This structure will be made private.
*/
struct _xmlCharEncodingHandler {
char *name XML_DEPRECATED_MEMBER;
union {
xmlCharEncConvFunc func;
xmlCharEncodingInputFunc legacyFunc;
} input XML_DEPRECATED_MEMBER;
union {
xmlCharEncConvFunc func;
xmlCharEncodingOutputFunc legacyFunc;
} output XML_DEPRECATED_MEMBER;
void *inputCtxt XML_DEPRECATED_MEMBER;
void *outputCtxt XML_DEPRECATED_MEMBER;
xmlCharEncConvCtxtDtor ctxtDtor XML_DEPRECATED_MEMBER;
int flags XML_DEPRECATED_MEMBER;
};
/**
* If this function returns XML_ERR_OK, it must fill the `out`
* pointer with an encoding handler. The handler can be obtained
* from #xmlCharEncNewCustomHandler.
*
* `flags` can contain XML_ENC_INPUT, XML_ENC_OUTPUT or both.
*
* @param vctxt user data
* @param name encoding name
* @param flags bit mask of flags
* @param out pointer to resulting handler
* @returns an xmlParserErrors code.
*/
typedef xmlParserErrors
(*xmlCharEncConvImpl)(void *vctxt, const char *name, xmlCharEncFlags flags,
xmlCharEncodingHandler **out);
/*
* Interfaces for encoding handlers.
*/
XML_DEPRECATED
XMLPUBFUN void
xmlInitCharEncodingHandlers (void);
XML_DEPRECATED
XMLPUBFUN void
xmlCleanupCharEncodingHandlers (void);
XML_DEPRECATED
XMLPUBFUN void
xmlRegisterCharEncodingHandler (xmlCharEncodingHandler *handler);
XMLPUBFUN xmlParserErrors
xmlLookupCharEncodingHandler (xmlCharEncoding enc,
xmlCharEncodingHandler **out);
XMLPUBFUN xmlParserErrors
xmlOpenCharEncodingHandler (const char *name,
int output,
xmlCharEncodingHandler **out);
XMLPUBFUN xmlParserErrors
xmlCreateCharEncodingHandler (const char *name,
xmlCharEncFlags flags,
xmlCharEncConvImpl impl,
void *implCtxt,
xmlCharEncodingHandler **out);
XMLPUBFUN xmlCharEncodingHandler *
xmlGetCharEncodingHandler (xmlCharEncoding enc);
XMLPUBFUN xmlCharEncodingHandler *
xmlFindCharEncodingHandler (const char *name);
XML_DEPRECATED
XMLPUBFUN xmlCharEncodingHandler *
xmlNewCharEncodingHandler (const char *name,
xmlCharEncodingInputFunc input,
xmlCharEncodingOutputFunc output);
XMLPUBFUN xmlParserErrors
xmlCharEncNewCustomHandler (const char *name,
xmlCharEncConvFunc input,
xmlCharEncConvFunc output,
xmlCharEncConvCtxtDtor ctxtDtor,
void *inputCtxt,
void *outputCtxt,
xmlCharEncodingHandler **out);
/*
* Interfaces for encoding names and aliases.
*/
XML_DEPRECATED
XMLPUBFUN int
xmlAddEncodingAlias (const char *name,
const char *alias);
XML_DEPRECATED
XMLPUBFUN int
xmlDelEncodingAlias (const char *alias);
XML_DEPRECATED
XMLPUBFUN const char *
xmlGetEncodingAlias (const char *alias);
XML_DEPRECATED
XMLPUBFUN void
xmlCleanupEncodingAliases (void);
XMLPUBFUN xmlCharEncoding
xmlParseCharEncoding (const char *name);
XMLPUBFUN const char *
xmlGetCharEncodingName (xmlCharEncoding enc);
/*
* Interfaces directly used by the parsers.
*/
XMLPUBFUN xmlCharEncoding
xmlDetectCharEncoding (const unsigned char *in,
int len);
struct _xmlBuffer;
XMLPUBFUN int
xmlCharEncOutFunc (xmlCharEncodingHandler *handler,
struct _xmlBuffer *out,
struct _xmlBuffer *in);
XMLPUBFUN int
xmlCharEncInFunc (xmlCharEncodingHandler *handler,
struct _xmlBuffer *out,
struct _xmlBuffer *in);
XML_DEPRECATED
XMLPUBFUN int
xmlCharEncFirstLine (xmlCharEncodingHandler *handler,
struct _xmlBuffer *out,
struct _xmlBuffer *in);
XMLPUBFUN int
xmlCharEncCloseFunc (xmlCharEncodingHandler *handler);
/*
* Export a few useful functions
*/
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN int
xmlUTF8ToIsolat1 (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
#endif /* LIBXML_OUTPUT_ENABLED */
XMLPUBFUN int
xmlIsolat1ToUTF8 (unsigned char *out,
int *outlen,
const unsigned char *in,
int *inlen);
#ifdef __cplusplus
}
#endif
#endif /* __XML_CHAR_ENCODING_H__ */
+167
View File
@@ -0,0 +1,167 @@
/**
* @file
*
* @brief XML entities
*
* This module provides an API to work with XML entities.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_ENTITIES_H__
#define __XML_ENTITIES_H__
#include <libxml/xmlversion.h>
#define XML_TREE_INTERNALS
#include <libxml/tree.h>
#undef XML_TREE_INTERNALS
#ifdef __cplusplus
extern "C" {
#endif
/**
* The different entity types.
*/
typedef enum {
/** internal general entity */
XML_INTERNAL_GENERAL_ENTITY = 1,
/** external general parsed entity */
XML_EXTERNAL_GENERAL_PARSED_ENTITY = 2,
/** external general unparsed entity */
XML_EXTERNAL_GENERAL_UNPARSED_ENTITY = 3,
/** internal parameter entity */
XML_INTERNAL_PARAMETER_ENTITY = 4,
/** external parameter entity */
XML_EXTERNAL_PARAMETER_ENTITY = 5,
/** internal predefined entity */
XML_INTERNAL_PREDEFINED_ENTITY = 6
} xmlEntityType;
/**
* An entity declaration
*/
struct _xmlEntity {
/** application data */
void *_private;
/** XML_ENTITY_DECL, must be second ! */
xmlElementType type;
/** Entity name */
const xmlChar *name;
/** First child link */
struct _xmlNode *children;
/** Last child link */
struct _xmlNode *last;
/** -> DTD */
struct _xmlDtd *parent;
/** next sibling link */
struct _xmlNode *next;
/** previous sibling link */
struct _xmlNode *prev;
/** the containing document */
struct _xmlDoc *doc;
/** content without ref substitution */
xmlChar *orig;
/** content or ndata if unparsed */
xmlChar *content;
/** the content length */
int length;
/** The entity type */
xmlEntityType etype;
/** External identifier for PUBLIC */
const xmlChar *ExternalID;
/** URI for a SYSTEM or PUBLIC Entity */
const xmlChar *SystemID;
/** unused */
struct _xmlEntity *nexte;
/** the full URI as computed */
const xmlChar *URI;
/** unused */
int owner;
/** various flags */
int flags;
/** expanded size */
unsigned long expandedSize;
};
typedef struct _xmlHashTable xmlEntitiesTable;
typedef xmlEntitiesTable *xmlEntitiesTablePtr;
XMLPUBFUN xmlEntity *
xmlNewEntity (xmlDoc *doc,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *content);
XMLPUBFUN void
xmlFreeEntity (xmlEntity *entity);
XMLPUBFUN int
xmlAddEntity (xmlDoc *doc,
int extSubset,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *content,
xmlEntity **out);
XMLPUBFUN xmlEntity *
xmlAddDocEntity (xmlDoc *doc,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *content);
XMLPUBFUN xmlEntity *
xmlAddDtdEntity (xmlDoc *doc,
const xmlChar *name,
int type,
const xmlChar *publicId,
const xmlChar *systemId,
const xmlChar *content);
XMLPUBFUN xmlEntity *
xmlGetPredefinedEntity (const xmlChar *name);
XMLPUBFUN xmlEntity *
xmlGetDocEntity (const xmlDoc *doc,
const xmlChar *name);
XMLPUBFUN xmlEntity *
xmlGetDtdEntity (xmlDoc *doc,
const xmlChar *name);
XMLPUBFUN xmlEntity *
xmlGetParameterEntity (xmlDoc *doc,
const xmlChar *name);
XMLPUBFUN xmlChar *
xmlEncodeEntitiesReentrant(xmlDoc *doc,
const xmlChar *input);
XMLPUBFUN xmlChar *
xmlEncodeSpecialChars (const xmlDoc *doc,
const xmlChar *input);
XML_DEPRECATED
XMLPUBFUN xmlEntitiesTable *
xmlCreateEntitiesTable (void);
XML_DEPRECATED
XMLPUBFUN xmlEntitiesTable *
xmlCopyEntitiesTable (xmlEntitiesTable *table);
XML_DEPRECATED
XMLPUBFUN void
xmlFreeEntitiesTable (xmlEntitiesTable *table);
#ifdef LIBXML_OUTPUT_ENABLED
XML_DEPRECATED
XMLPUBFUN void
xmlDumpEntitiesTable (xmlBuffer *buf,
xmlEntitiesTable *table);
XML_DEPRECATED
XMLPUBFUN void
xmlDumpEntityDecl (xmlBuffer *buf,
xmlEntity *ent);
#endif /* LIBXML_OUTPUT_ENABLED */
#ifdef __cplusplus
}
#endif
# endif /* __XML_ENTITIES_H__ */
+28
View File
@@ -0,0 +1,28 @@
/**
* @file
*
* @brief interface for all global variables of the library
*
* Deprecated, don't use
*
* @copyright See Copyright for the status of this software.
*/
#ifndef __XML_GLOBALS_H
#define __XML_GLOBALS_H
#include <libxml/xmlversion.h>
/*
* This file was required to access global variables until version v2.12.0.
*
* These includes are for backward compatibility.
*/
#include <libxml/HTMLparser.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlIO.h>
#include <libxml/xmlsave.h>
#include <libxml/threads.h>
#endif /* __XML_GLOBALS_H */
+248
View File
@@ -0,0 +1,248 @@
/**
* @file
*
* @brief Chained hash tables
*
* This module implements the hash table support used in
* various places in the library.
*
* @copyright See Copyright for the status of this software.
*/
#ifndef __XML_HASH_H__
#define __XML_HASH_H__
#include <libxml/xmlversion.h>
#include <libxml/dict.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Hash table mapping strings to pointers
*
* Also supports lookup using two or three strings as key.
*/
typedef struct _xmlHashTable xmlHashTable;
typedef xmlHashTable *xmlHashTablePtr;
/*
* Recent version of gcc produce a warning when a function pointer is assigned
* to an object pointer, or vice versa. The following macro is a dirty hack
* to allow suppression of the warning. If your architecture has function
* pointers which are a different size than a void pointer, there may be some
* serious trouble within the library.
*/
/**
* Macro to do a casting from an object pointer to a
* function pointer without encountering a warning from
* gcc
*
* \#define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
* This macro violated ISO C aliasing rules (gcc4 on s390 broke)
* so it is disabled now
*
* @param fptr pointer to a function
*/
#define XML_CAST_FPTR(fptr) fptr
/*
* function types:
*/
/**
* Callback to free data from a hash.
*
* @param payload the data in the hash
* @param name the name associated
*/
typedef void (*xmlHashDeallocator)(void *payload, const xmlChar *name);
/**
* Callback to copy data from a hash.
*
* @param payload the data in the hash
* @param name the name associated
* @returns a copy of the data or NULL in case of error.
*/
typedef void *(*xmlHashCopier)(void *payload, const xmlChar *name);
/**
* Callback when scanning data in a hash with the simple scanner.
*
* @param payload the data in the hash
* @param data extra scanner data
* @param name the name associated
*/
typedef void (*xmlHashScanner)(void *payload, void *data, const xmlChar *name);
/**
* Callback when scanning data in a hash with the full scanner.
*
* @param payload the data in the hash
* @param data extra scanner data
* @param name the name associated
* @param name2 the second name associated
* @param name3 the third name associated
*/
typedef void (*xmlHashScannerFull)(void *payload, void *data,
const xmlChar *name, const xmlChar *name2,
const xmlChar *name3);
/*
* Constructor and destructor.
*/
XMLPUBFUN xmlHashTable *
xmlHashCreate (int size);
XMLPUBFUN xmlHashTable *
xmlHashCreateDict (int size,
xmlDict *dict);
XMLPUBFUN void
xmlHashFree (xmlHashTable *hash,
xmlHashDeallocator dealloc);
XMLPUBFUN void
xmlHashDefaultDeallocator(void *entry,
const xmlChar *name);
/*
* Add a new entry to the hash table.
*/
XMLPUBFUN int
xmlHashAdd (xmlHashTable *hash,
const xmlChar *name,
void *userdata);
XMLPUBFUN int
xmlHashAddEntry (xmlHashTable *hash,
const xmlChar *name,
void *userdata);
XMLPUBFUN int
xmlHashUpdateEntry (xmlHashTable *hash,
const xmlChar *name,
void *userdata,
xmlHashDeallocator dealloc);
XMLPUBFUN int
xmlHashAdd2 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2,
void *userdata);
XMLPUBFUN int
xmlHashAddEntry2 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2,
void *userdata);
XMLPUBFUN int
xmlHashUpdateEntry2 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2,
void *userdata,
xmlHashDeallocator dealloc);
XMLPUBFUN int
xmlHashAdd3 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
void *userdata);
XMLPUBFUN int
xmlHashAddEntry3 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
void *userdata);
XMLPUBFUN int
xmlHashUpdateEntry3 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
void *userdata,
xmlHashDeallocator dealloc);
/*
* Remove an entry from the hash table.
*/
XMLPUBFUN int
xmlHashRemoveEntry (xmlHashTable *hash,
const xmlChar *name,
xmlHashDeallocator dealloc);
XMLPUBFUN int
xmlHashRemoveEntry2 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2,
xmlHashDeallocator dealloc);
XMLPUBFUN int
xmlHashRemoveEntry3 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
xmlHashDeallocator dealloc);
/*
* Retrieve the payload.
*/
XMLPUBFUN void *
xmlHashLookup (xmlHashTable *hash,
const xmlChar *name);
XMLPUBFUN void *
xmlHashLookup2 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2);
XMLPUBFUN void *
xmlHashLookup3 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3);
XMLPUBFUN void *
xmlHashQLookup (xmlHashTable *hash,
const xmlChar *prefix,
const xmlChar *name);
XMLPUBFUN void *
xmlHashQLookup2 (xmlHashTable *hash,
const xmlChar *prefix,
const xmlChar *name,
const xmlChar *prefix2,
const xmlChar *name2);
XMLPUBFUN void *
xmlHashQLookup3 (xmlHashTable *hash,
const xmlChar *prefix,
const xmlChar *name,
const xmlChar *prefix2,
const xmlChar *name2,
const xmlChar *prefix3,
const xmlChar *name3);
/*
* Helpers.
*/
XMLPUBFUN xmlHashTable *
xmlHashCopySafe (xmlHashTable *hash,
xmlHashCopier copy,
xmlHashDeallocator dealloc);
XMLPUBFUN xmlHashTable *
xmlHashCopy (xmlHashTable *hash,
xmlHashCopier copy);
XMLPUBFUN int
xmlHashSize (xmlHashTable *hash);
XMLPUBFUN void
xmlHashScan (xmlHashTable *hash,
xmlHashScanner scan,
void *data);
XMLPUBFUN void
xmlHashScan3 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
xmlHashScanner scan,
void *data);
XMLPUBFUN void
xmlHashScanFull (xmlHashTable *hash,
xmlHashScannerFull scan,
void *data);
XMLPUBFUN void
xmlHashScanFull3 (xmlHashTable *hash,
const xmlChar *name,
const xmlChar *name2,
const xmlChar *name3,
xmlHashScannerFull scan,
void *data);
#ifdef __cplusplus
}
#endif
#endif /* ! __XML_HASH_H__ */
+145
View File
@@ -0,0 +1,145 @@
/**
* @file
*
* @brief lists interfaces
*
* this module implement the list support used in
* various place in the library.
*
* @copyright See Copyright for the status of this software.
*
* @author Gary Pennington
*/
#ifndef __XML_LINK_INCLUDE__
#define __XML_LINK_INCLUDE__
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Linked list item
*
* @deprecated Don't use in new code.
*/
typedef struct _xmlLink xmlLink;
typedef xmlLink *xmlLinkPtr;
/**
* Linked list
*
* @deprecated Don't use in new code.
*/
typedef struct _xmlList xmlList;
typedef xmlList *xmlListPtr;
/**
* Callback function used to free data from a list.
*
* @param lk the data to deallocate
*/
typedef void (*xmlListDeallocator) (xmlLink *lk);
/**
* Callback function used to compare 2 data.
*
* @param data0 the first data
* @param data1 the second data
* @returns 0 is equality, -1 or 1 otherwise depending on the ordering.
*/
typedef int (*xmlListDataCompare) (const void *data0, const void *data1);
/**
* Callback function used when walking a list with #xmlListWalk.
*
* @param data the data found in the list
* @param user extra user provided data to the walker
* @returns 0 to stop walking the list, 1 otherwise.
*/
typedef int (*xmlListWalker) (const void *data, void *user);
/* Creation/Deletion */
XMLPUBFUN xmlList *
xmlListCreate (xmlListDeallocator deallocator,
xmlListDataCompare compare);
XMLPUBFUN void
xmlListDelete (xmlList *l);
/* Basic Operators */
XMLPUBFUN void *
xmlListSearch (xmlList *l,
void *data);
XMLPUBFUN void *
xmlListReverseSearch (xmlList *l,
void *data);
XMLPUBFUN int
xmlListInsert (xmlList *l,
void *data) ;
XMLPUBFUN int
xmlListAppend (xmlList *l,
void *data) ;
XMLPUBFUN int
xmlListRemoveFirst (xmlList *l,
void *data);
XMLPUBFUN int
xmlListRemoveLast (xmlList *l,
void *data);
XMLPUBFUN int
xmlListRemoveAll (xmlList *l,
void *data);
XMLPUBFUN void
xmlListClear (xmlList *l);
XMLPUBFUN int
xmlListEmpty (xmlList *l);
XMLPUBFUN xmlLink *
xmlListFront (xmlList *l);
XMLPUBFUN xmlLink *
xmlListEnd (xmlList *l);
XMLPUBFUN int
xmlListSize (xmlList *l);
XMLPUBFUN void
xmlListPopFront (xmlList *l);
XMLPUBFUN void
xmlListPopBack (xmlList *l);
XMLPUBFUN int
xmlListPushFront (xmlList *l,
void *data);
XMLPUBFUN int
xmlListPushBack (xmlList *l,
void *data);
/* Advanced Operators */
XMLPUBFUN void
xmlListReverse (xmlList *l);
XMLPUBFUN void
xmlListSort (xmlList *l);
XMLPUBFUN void
xmlListWalk (xmlList *l,
xmlListWalker walker,
void *user);
XMLPUBFUN void
xmlListReverseWalk (xmlList *l,
xmlListWalker walker,
void *user);
XMLPUBFUN void
xmlListMerge (xmlList *l1,
xmlList *l2);
XMLPUBFUN xmlList *
xmlListDup (xmlList *old);
XMLPUBFUN int
xmlListCopy (xmlList *cur,
xmlList *old);
/* Link operators */
XMLPUBFUN void *
xmlLinkGetData (xmlLink *lk);
/* xmlListUnique() */
/* xmlListSwap */
#ifdef __cplusplus
}
#endif
#endif /* __XML_LINK_INCLUDE__ */
+99
View File
@@ -0,0 +1,99 @@
## xmlversion.h
xmlversion_h = configuration_data()
xmlversion_h.set('VERSION', meson.project_version())
xmlversion_h.set('LIBXML_VERSION_NUMBER', v_nbr.to_string())
xmlversion_h.set('LIBXML_VERSION_EXTRA', v_extra)
xmlversion_h.set10('WITH_C14N', want_c14n)
xmlversion_h.set10('WITH_CATALOG', want_catalog)
xmlversion_h.set10('WITH_DEBUG', want_debug)
xmlversion_h.set10('WITH_HTML', want_html)
xmlversion_h.set10('WITH_HTTP', want_http)
xmlversion_h.set10('WITH_ICONV', want_iconv)
xmlversion_h.set10('WITH_ICU', want_icu)
xmlversion_h.set10('WITH_ISO8859X', want_iso8859x)
xmlversion_h.set10('WITH_LEGACY', want_legacy)
xmlversion_h.set10('WITH_MODULES', want_modules)
xmlversion_h.set('MODULE_EXTENSION', module_extension)
xmlversion_h.set10('WITH_OUTPUT', want_output)
xmlversion_h.set10('WITH_PATTERN', want_pattern)
xmlversion_h.set10('WITH_PUSH', want_push)
xmlversion_h.set10('WITH_READER', want_reader)
xmlversion_h.set10('WITH_REGEXPS', want_regexps)
xmlversion_h.set10('WITH_RELAXNG', want_relaxng)
xmlversion_h.set10('WITH_SAX1', want_sax1)
xmlversion_h.set10('WITH_SCHEMAS', want_schemas)
xmlversion_h.set10('WITH_SCHEMATRON', want_schematron)
xmlversion_h.set10('WITH_THREADS', want_threads)
xmlversion_h.set10('WITH_THREAD_ALLOC', want_thread_alloc)
xmlversion_h.set10('WITH_VALID', want_valid)
xmlversion_h.set10('WITH_WINPATH', want_winpath)
xmlversion_h.set10('WITH_WRITER', want_writer)
xmlversion_h.set10('WITH_XINCLUDE', want_xinclude)
xmlversion_h.set10('WITH_XPATH', want_xpath)
xmlversion_h.set10('WITH_XPTR', want_xptr)
xmlversion_h.set10('WITH_ZLIB', want_zlib)
configure_file(
input: 'xmlversion.h.in',
output: 'xmlversion.h',
configuration: xmlversion_h,
install_dir: dir_pkginclude + '/libxml',
)
#vcs_tag(
# command : [ 'git', 'describe', '2>/dev/null' ],
# input : 'xmlversion.h.in',
# output : 'xmlversion.h',
# replace_string : 'LIBXML_VERSION_EXTRA'
#)
libxml_headers = files(
'HTMLparser.h',
'HTMLtree.h',
'SAX.h',
'SAX2.h',
'c14n.h',
'catalog.h',
'chvalid.h',
'debugXML.h',
'dict.h',
'encoding.h',
'entities.h',
'globals.h',
'hash.h',
'list.h',
'nanoftp.h',
'nanohttp.h',
'parser.h',
'parserInternals.h',
'pattern.h',
'relaxng.h',
'schemasInternals.h',
'schematron.h',
'threads.h',
'tree.h',
'uri.h',
'valid.h',
'xinclude.h',
'xlink.h',
'xmlIO.h',
'xmlautomata.h',
'xmlerror.h',
'xmlexports.h',
'xmlmemory.h',
'xmlmodule.h',
'xmlreader.h',
'xmlregexp.h',
'xmlsave.h',
'xmlschemas.h',
'xmlschemastypes.h',
'xmlstring.h',
'xmlunicode.h',
'xmlwriter.h',
'xpath.h',
'xpathInternals.h',
'xpointer.h',
)
install_headers(libxml_headers, install_dir: dir_pkginclude / 'libxml')
+19
View File
@@ -0,0 +1,19 @@
/**
* @file
*
* @brief Removed legacy symbols for an outdated FTP client
*
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __NANO_FTP_H__
#define __NANO_FTP_H__
#ifdef __GNUC__
#warning "libxml/nanoftp.h is deprecated"
#endif
#endif /* __NANO_FTP_H__ */
+101
View File
@@ -0,0 +1,101 @@
/**
* @file
*
* @brief minimal HTTP implementation
*
* minimal HTTP implementation allowing to fetch resources
* like external subset.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __NANO_HTTP_H__
#define __NANO_HTTP_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_HTTP_STUBS_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
XML_DEPRECATED
XMLPUBFUN void
xmlNanoHTTPInit (void);
XML_DEPRECATED
XMLPUBFUN void
xmlNanoHTTPCleanup (void);
XML_DEPRECATED
XMLPUBFUN void
xmlNanoHTTPScanProxy (const char *URL);
XML_DEPRECATED
XMLPUBFUN int
xmlNanoHTTPFetch (const char *URL,
const char *filename,
char **contentType);
XML_DEPRECATED
XMLPUBFUN void *
xmlNanoHTTPMethod (const char *URL,
const char *method,
const char *input,
char **contentType,
const char *headers,
int ilen);
XML_DEPRECATED
XMLPUBFUN void *
xmlNanoHTTPMethodRedir (const char *URL,
const char *method,
const char *input,
char **contentType,
char **redir,
const char *headers,
int ilen);
XML_DEPRECATED
XMLPUBFUN void *
xmlNanoHTTPOpen (const char *URL,
char **contentType);
XML_DEPRECATED
XMLPUBFUN void *
xmlNanoHTTPOpenRedir (const char *URL,
char **contentType,
char **redir);
XML_DEPRECATED
XMLPUBFUN int
xmlNanoHTTPReturnCode (void *ctx);
XML_DEPRECATED
XMLPUBFUN const char *
xmlNanoHTTPAuthHeader (void *ctx);
XML_DEPRECATED
XMLPUBFUN const char *
xmlNanoHTTPRedir (void *ctx);
XML_DEPRECATED
XMLPUBFUN int
xmlNanoHTTPContentLength( void * ctx );
XML_DEPRECATED
XMLPUBFUN const char *
xmlNanoHTTPEncoding (void *ctx);
XML_DEPRECATED
XMLPUBFUN const char *
xmlNanoHTTPMimeType (void *ctx);
XML_DEPRECATED
XMLPUBFUN int
xmlNanoHTTPRead (void *ctx,
void *dest,
int len);
#ifdef LIBXML_OUTPUT_ENABLED
XML_DEPRECATED
XMLPUBFUN int
xmlNanoHTTPSave (void *ctxt,
const char *filename);
#endif /* LIBXML_OUTPUT_ENABLED */
XML_DEPRECATED
XMLPUBFUN void
xmlNanoHTTPClose (void *ctx);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_HTTP_STUBS_ENABLED */
#endif /* __NANO_HTTP_H__ */
File diff suppressed because it is too large Load Diff
+544
View File
@@ -0,0 +1,544 @@
/**
* @file
*
* @brief Internals routines and limits exported by the parser.
*
* Except for some I/O-related functions, most of these macros and
* functions are deprecated.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_PARSER_INTERNALS_H__
#define __XML_PARSER_INTERNALS_H__
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#include <libxml/HTMLparser.h>
#include <libxml/chvalid.h>
#include <libxml/SAX2.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Push an input on the stack.
*
* @deprecated Use #xmlCtxtPushInput
*/
#define inputPush xmlCtxtPushInput
/**
* Pop an input from the stack.
*
* @deprecated Use #xmlCtxtPushInput
*/
#define inputPop xmlCtxtPopInput
/**
* Maximum element nesting depth (without XML_PARSE_HUGE).
*/
#define xmlParserMaxDepth 256
/**
* Maximum size allowed for a single text node when building a tree.
* This is not a limitation of the parser but a safety boundary feature,
* use XML_PARSE_HUGE option to override it.
* Introduced in 2.9.0
*/
#define XML_MAX_TEXT_LENGTH 10000000
/**
* Maximum size allowed when XML_PARSE_HUGE is set.
*/
#define XML_MAX_HUGE_LENGTH 1000000000
/**
* Maximum size allowed for a markup identifier.
* This is not a limitation of the parser but a safety boundary feature,
* use XML_PARSE_HUGE option to override it.
* Note that with the use of parsing dictionaries overriding the limit
* may result in more runtime memory usage in face of "unfriendly' content
* Introduced in 2.9.0
*/
#define XML_MAX_NAME_LENGTH 50000
/**
* Maximum size allowed by the parser for a dictionary by default
* This is not a limitation of the parser but a safety boundary feature,
* use XML_PARSE_HUGE option to override it.
* Introduced in 2.9.0
*/
#define XML_MAX_DICTIONARY_LIMIT 100000000
/**
* Maximum size allowed by the parser for ahead lookup
* This is an upper boundary enforced by the parser to avoid bad
* behaviour on "unfriendly' content
* Introduced in 2.9.0
*/
#define XML_MAX_LOOKUP_LIMIT 10000000
/**
* Identifiers can be longer, but this will be more costly
* at runtime.
*/
#define XML_MAX_NAMELEN 100
/************************************************************************
* *
* UNICODE version of the macros. *
* *
************************************************************************/
/**
* Macro to check the following production in the XML spec:
*
* [2] Char ::= #x9 | #xA | #xD | [#x20...]
*
* any byte character in the accepted range
*
* @param c an byte value (int)
*/
#define IS_BYTE_CHAR(c) xmlIsChar_ch(c)
/**
* 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.
*
* @param c an UNICODE value (int)
*/
#define IS_CHAR(c) xmlIsCharQ(c)
/**
* Behaves like IS_CHAR on single-byte value
*
* @param c an xmlChar (usually an unsigned char)
*/
#define IS_CHAR_CH(c) xmlIsChar_ch(c)
/**
* Macro to check the following production in the XML spec:
*
* [3] S ::= (#x20 | #x9 | #xD | #xA)+
* @param c an UNICODE value (int)
*/
#define IS_BLANK(c) xmlIsBlankQ(c)
/**
* Behaviour same as IS_BLANK
*
* @param c an xmlChar value (normally unsigned char)
*/
#define IS_BLANK_CH(c) xmlIsBlank_ch(c)
/**
* Macro to check the following production in the XML spec:
*
* [85] BaseChar ::= ... long list see REC ...
* @param c an UNICODE value (int)
*/
#define IS_BASECHAR(c) xmlIsBaseCharQ(c)
/**
* Macro to check the following production in the XML spec:
*
* [88] Digit ::= ... long list see REC ...
* @param c an UNICODE value (int)
*/
#define IS_DIGIT(c) xmlIsDigitQ(c)
/**
* Behaves like IS_DIGIT but with a single byte argument
*
* @param c an xmlChar value (usually an unsigned char)
*/
#define IS_DIGIT_CH(c) xmlIsDigit_ch(c)
/**
* Macro to check the following production in the XML spec:
*
* [87] CombiningChar ::= ... long list see REC ...
* @param c an UNICODE value (int)
*/
#define IS_COMBINING(c) xmlIsCombiningQ(c)
/**
* Always false (all combining chars > 0xff)
*
* @param c an xmlChar (usually an unsigned char)
*/
#define IS_COMBINING_CH(c) 0
/**
* 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]
* @param c an UNICODE value (int)
*/
#define IS_EXTENDER(c) xmlIsExtenderQ(c)
/**
* Behaves like IS_EXTENDER but with a single-byte argument
*
* @param c an xmlChar value (usually an unsigned char)
*/
#define IS_EXTENDER_CH(c) xmlIsExtender_ch(c)
/**
* Macro to check the following production in the XML spec:
*
* [86] Ideographic ::= [#x4E00-#x9FA5] | #x3007 | [#x3021-#x3029]
* @param c an UNICODE value (int)
*/
#define IS_IDEOGRAPHIC(c) xmlIsIdeographicQ(c)
/**
* Macro to check the following production in the XML spec:
*
* [84] Letter ::= BaseChar | Ideographic
* @param c an UNICODE value (int)
*/
#define IS_LETTER(c) (IS_BASECHAR(c) || IS_IDEOGRAPHIC(c))
/**
* Macro behaves like IS_LETTER, but only check base chars
*
* @param c an xmlChar value (normally unsigned char)
*/
#define IS_LETTER_CH(c) xmlIsBaseChar_ch(c)
/**
* Macro to check [a-zA-Z]
*
* @param c an xmlChar value
*/
#define IS_ASCII_LETTER(c) ((0x61 <= ((c) | 0x20)) && \
(((c) | 0x20) <= 0x7a))
/**
* Macro to check [0-9]
*
* @param c an xmlChar value
*/
#define IS_ASCII_DIGIT(c) ((0x30 <= (c)) && ((c) <= 0x39))
/**
* Macro to check the following production in the XML spec:
*
* [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] |
* [-'()+,./:=?;!*#@$_%]
* @param c an UNICODE value (int)
*/
#define IS_PUBIDCHAR(c) xmlIsPubidCharQ(c)
/**
* Same as IS_PUBIDCHAR but for single-byte value
*
* @param c an xmlChar value (normally unsigned char)
*/
#define IS_PUBIDCHAR_CH(c) xmlIsPubidChar_ch(c)
/*
* Global variables used for predefined strings.
*/
/** @cond ignore */
XMLPUBVAR const xmlChar xmlStringText[];
XMLPUBVAR const xmlChar xmlStringTextNoenc[];
XML_DEPRECATED
XMLPUBVAR const xmlChar xmlStringComment[];
/** @endcond */
XML_DEPRECATED
XMLPUBFUN int xmlIsLetter (int c);
/*
* Parser context.
*/
XMLPUBFUN xmlParserCtxt *
xmlCreateFileParserCtxt (const char *filename);
XMLPUBFUN xmlParserCtxt *
xmlCreateURLParserCtxt (const char *filename,
int options);
XMLPUBFUN xmlParserCtxt *
xmlCreateMemoryParserCtxt(const char *buffer,
int size);
XML_DEPRECATED
XMLPUBFUN xmlParserCtxt *
xmlCreateEntityParserCtxt(const xmlChar *URL,
const xmlChar *ID,
const xmlChar *base);
XMLPUBFUN void
xmlCtxtErrMemory (xmlParserCtxt *ctxt);
XMLPUBFUN int
xmlSwitchEncoding (xmlParserCtxt *ctxt,
xmlCharEncoding enc);
XMLPUBFUN int
xmlSwitchEncodingName (xmlParserCtxt *ctxt,
const char *encoding);
XMLPUBFUN int
xmlSwitchToEncoding (xmlParserCtxt *ctxt,
xmlCharEncodingHandler *handler);
XML_DEPRECATED
XMLPUBFUN int
xmlSwitchInputEncoding (xmlParserCtxt *ctxt,
xmlParserInput *input,
xmlCharEncodingHandler *handler);
/*
* Input Streams.
*/
XMLPUBFUN xmlParserInput *
xmlNewStringInputStream (xmlParserCtxt *ctxt,
const xmlChar *buffer);
XML_DEPRECATED
XMLPUBFUN xmlParserInput *
xmlNewEntityInputStream (xmlParserCtxt *ctxt,
xmlEntity *entity);
XMLPUBFUN int
xmlCtxtPushInput (xmlParserCtxt *ctxt,
xmlParserInput *input);
XMLPUBFUN xmlParserInput *
xmlCtxtPopInput (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN int
xmlPushInput (xmlParserCtxt *ctxt,
xmlParserInput *input);
XML_DEPRECATED
XMLPUBFUN xmlChar
xmlPopInput (xmlParserCtxt *ctxt);
XMLPUBFUN void
xmlFreeInputStream (xmlParserInput *input);
XMLPUBFUN xmlParserInput *
xmlNewInputFromFile (xmlParserCtxt *ctxt,
const char *filename);
XMLPUBFUN xmlParserInput *
xmlNewInputStream (xmlParserCtxt *ctxt);
/*
* Namespaces.
*/
XMLPUBFUN xmlChar *
xmlSplitQName (xmlParserCtxt *ctxt,
const xmlChar *name,
xmlChar **prefix);
/*
* Generic production rules.
*/
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlParseName (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseNmtoken (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseEntityValue (xmlParserCtxt *ctxt,
xmlChar **orig);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseAttValue (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseSystemLiteral (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParsePubidLiteral (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseCharData (xmlParserCtxt *ctxt,
int cdata);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseExternalID (xmlParserCtxt *ctxt,
xmlChar **publicId,
int strict);
XML_DEPRECATED
XMLPUBFUN void
xmlParseComment (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlParsePITarget (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParsePI (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseNotationDecl (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseEntityDecl (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN int
xmlParseDefaultDecl (xmlParserCtxt *ctxt,
xmlChar **value);
XML_DEPRECATED
XMLPUBFUN xmlEnumeration *
xmlParseNotationType (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlEnumeration *
xmlParseEnumerationType (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN int
xmlParseEnumeratedType (xmlParserCtxt *ctxt,
xmlEnumeration **tree);
XML_DEPRECATED
XMLPUBFUN int
xmlParseAttributeType (xmlParserCtxt *ctxt,
xmlEnumeration **tree);
XML_DEPRECATED
XMLPUBFUN void
xmlParseAttributeListDecl(xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlElementContent *
xmlParseElementMixedContentDecl
(xmlParserCtxt *ctxt,
int inputchk);
XML_DEPRECATED
XMLPUBFUN xmlElementContent *
xmlParseElementChildrenContentDecl
(xmlParserCtxt *ctxt,
int inputchk);
XML_DEPRECATED
XMLPUBFUN int
xmlParseElementContentDecl(xmlParserCtxt *ctxt,
const xmlChar *name,
xmlElementContent **result);
XML_DEPRECATED
XMLPUBFUN int
xmlParseElementDecl (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseMarkupDecl (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN int
xmlParseCharRef (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlEntity *
xmlParseEntityRef (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseReference (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParsePEReference (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseDocTypeDecl (xmlParserCtxt *ctxt);
#ifdef LIBXML_SAX1_ENABLED
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlParseAttribute (xmlParserCtxt *ctxt,
xmlChar **value);
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlParseStartTag (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseEndTag (xmlParserCtxt *ctxt);
#endif /* LIBXML_SAX1_ENABLED */
XML_DEPRECATED
XMLPUBFUN void
xmlParseCDSect (xmlParserCtxt *ctxt);
XMLPUBFUN void
xmlParseContent (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseElement (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseVersionNum (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseVersionInfo (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlParseEncName (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN const xmlChar *
xmlParseEncodingDecl (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN int
xmlParseSDDecl (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseXMLDecl (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseTextDecl (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseMisc (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlParseExternalSubset (xmlParserCtxt *ctxt,
const xmlChar *publicId,
const xmlChar *systemId);
/** @cond ignore */
#define XML_SUBSTITUTE_NONE 0
#define XML_SUBSTITUTE_REF 1
#define XML_SUBSTITUTE_PEREF 2
#define XML_SUBSTITUTE_BOTH 3
/** @endcond */
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlStringDecodeEntities (xmlParserCtxt *ctxt,
const xmlChar *str,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlStringLenDecodeEntities (xmlParserCtxt *ctxt,
const xmlChar *str,
int len,
int what,
xmlChar end,
xmlChar end2,
xmlChar end3);
/*
* other commodities shared between parser.c and parserInternals.
*/
XML_DEPRECATED
XMLPUBFUN int xmlSkipBlankChars (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN int xmlStringCurrentChar (xmlParserCtxt *ctxt,
const xmlChar *cur,
int *len);
XML_DEPRECATED
XMLPUBFUN void xmlParserHandlePEReference(xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN int xmlCheckLanguageID (const xmlChar *lang);
/*
* Really core function shared with HTML parser.
*/
XML_DEPRECATED
XMLPUBFUN int xmlCurrentChar (xmlParserCtxt *ctxt,
int *len);
XML_DEPRECATED
XMLPUBFUN int xmlCopyCharMultiByte (xmlChar *out,
int val);
XML_DEPRECATED
XMLPUBFUN int xmlCopyChar (int len,
xmlChar *out,
int val);
XML_DEPRECATED
XMLPUBFUN void xmlNextChar (xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN void xmlParserInputShrink (xmlParserInput *in);
#ifdef __cplusplus
}
#endif
#endif /* __XML_PARSER_INTERNALS_H__ */
+104
View File
@@ -0,0 +1,104 @@
/**
* @file
*
* @brief pattern expression handling
*
* allows to compile and test pattern expressions for nodes
* either in a tree or based on a parser state.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_PATTERN_H__
#define __XML_PATTERN_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/dict.h>
#ifdef LIBXML_PATTERN_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* A compiled (XPath based) pattern to select nodes
*/
typedef struct _xmlPattern xmlPattern;
typedef xmlPattern *xmlPatternPtr;
/**
* Internal type. This is the set of options affecting the behaviour
* of pattern matching with this module.
*/
typedef enum {
XML_PATTERN_DEFAULT = 0, /* simple pattern match */
XML_PATTERN_XPATH = 1<<0, /* standard XPath pattern */
XML_PATTERN_XSSEL = 1<<1, /* XPath subset for schema selector */
XML_PATTERN_XSFIELD = 1<<2 /* XPath subset for schema field */
} xmlPatternFlags;
XMLPUBFUN void
xmlFreePattern (xmlPattern *comp);
XMLPUBFUN void
xmlFreePatternList (xmlPattern *comp);
XMLPUBFUN xmlPattern *
xmlPatterncompile (const xmlChar *pattern,
xmlDict *dict,
int flags,
const xmlChar **namespaces);
XMLPUBFUN int
xmlPatternCompileSafe (const xmlChar *pattern,
xmlDict *dict,
int flags,
const xmlChar **namespaces,
xmlPattern **patternOut);
XMLPUBFUN int
xmlPatternMatch (xmlPattern *comp,
xmlNode *node);
/** State object for streaming interface */
typedef struct _xmlStreamCtxt xmlStreamCtxt;
typedef xmlStreamCtxt *xmlStreamCtxtPtr;
XMLPUBFUN int
xmlPatternStreamable (xmlPattern *comp);
XMLPUBFUN int
xmlPatternMaxDepth (xmlPattern *comp);
XMLPUBFUN int
xmlPatternMinDepth (xmlPattern *comp);
XMLPUBFUN int
xmlPatternFromRoot (xmlPattern *comp);
XMLPUBFUN xmlStreamCtxt *
xmlPatternGetStreamCtxt (xmlPattern *comp);
XMLPUBFUN void
xmlFreeStreamCtxt (xmlStreamCtxt *stream);
XMLPUBFUN int
xmlStreamPushNode (xmlStreamCtxt *stream,
const xmlChar *name,
const xmlChar *ns,
int nodeType);
XMLPUBFUN int
xmlStreamPush (xmlStreamCtxt *stream,
const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int
xmlStreamPushAttr (xmlStreamCtxt *stream,
const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int
xmlStreamPop (xmlStreamCtxt *stream);
XMLPUBFUN int
xmlStreamWantsAnyNode (xmlStreamCtxt *stream);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_PATTERN_ENABLED */
#endif /* __XML_PATTERN_H__ */
+229
View File
@@ -0,0 +1,229 @@
/**
* @file
*
* @brief implementation of the Relax-NG validation
*
* implementation of the Relax-NG validation
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_RELAX_NG__
#define __XML_RELAX_NG__
#include <libxml/xmlversion.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlstring.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#ifdef LIBXML_RELAXNG_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/** RelaxNG schema */
typedef struct _xmlRelaxNG xmlRelaxNG;
typedef xmlRelaxNG *xmlRelaxNGPtr;
/**
* Signature of an error callback from a Relax-NG validation
*
* @param ctx the validation context
* @param msg the message
* @param ... extra arguments
*/
typedef void (*xmlRelaxNGValidityErrorFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* Signature of a warning callback from a Relax-NG validation
*
* @param ctx the validation context
* @param msg the message
* @param ... extra arguments
*/
typedef void (*xmlRelaxNGValidityWarningFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/** RelaxNG parser context */
typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt;
typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr;
/** RelaxNG validation context */
typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt;
typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr;
/**
* List of possible Relax NG validation errors
*/
typedef enum {
XML_RELAXNG_OK = 0,
XML_RELAXNG_ERR_MEMORY,
XML_RELAXNG_ERR_TYPE,
XML_RELAXNG_ERR_TYPEVAL,
XML_RELAXNG_ERR_DUPID,
XML_RELAXNG_ERR_TYPECMP,
XML_RELAXNG_ERR_NOSTATE,
XML_RELAXNG_ERR_NODEFINE,
XML_RELAXNG_ERR_LISTEXTRA,
XML_RELAXNG_ERR_LISTEMPTY,
XML_RELAXNG_ERR_INTERNODATA,
XML_RELAXNG_ERR_INTERSEQ,
XML_RELAXNG_ERR_INTEREXTRA,
XML_RELAXNG_ERR_ELEMNAME,
XML_RELAXNG_ERR_ATTRNAME,
XML_RELAXNG_ERR_ELEMNONS,
XML_RELAXNG_ERR_ATTRNONS,
XML_RELAXNG_ERR_ELEMWRONGNS,
XML_RELAXNG_ERR_ATTRWRONGNS,
XML_RELAXNG_ERR_ELEMEXTRANS,
XML_RELAXNG_ERR_ATTREXTRANS,
XML_RELAXNG_ERR_ELEMNOTEMPTY,
XML_RELAXNG_ERR_NOELEM,
XML_RELAXNG_ERR_NOTELEM,
XML_RELAXNG_ERR_ATTRVALID,
XML_RELAXNG_ERR_CONTENTVALID,
XML_RELAXNG_ERR_EXTRACONTENT,
XML_RELAXNG_ERR_INVALIDATTR,
XML_RELAXNG_ERR_DATAELEM,
XML_RELAXNG_ERR_VALELEM,
XML_RELAXNG_ERR_LISTELEM,
XML_RELAXNG_ERR_DATATYPE,
XML_RELAXNG_ERR_VALUE,
XML_RELAXNG_ERR_LIST,
XML_RELAXNG_ERR_NOGRAMMAR,
XML_RELAXNG_ERR_EXTRADATA,
XML_RELAXNG_ERR_LACKDATA,
XML_RELAXNG_ERR_INTERNAL,
XML_RELAXNG_ERR_ELEMWRONG,
XML_RELAXNG_ERR_TEXTWRONG
} xmlRelaxNGValidErr;
/**
* List of possible Relax NG Parser flags
*/
typedef enum {
XML_RELAXNGP_NONE = 0,
XML_RELAXNGP_FREE_DOC = 1,
XML_RELAXNGP_CRNG = 2
} xmlRelaxNGParserFlag;
XMLPUBFUN int
xmlRelaxNGInitTypes (void);
XML_DEPRECATED
XMLPUBFUN void
xmlRelaxNGCleanupTypes (void);
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlRelaxNGParserCtxt *
xmlRelaxNGNewParserCtxt (const char *URL);
XMLPUBFUN xmlRelaxNGParserCtxt *
xmlRelaxNGNewMemParserCtxt (const char *buffer,
int size);
XMLPUBFUN xmlRelaxNGParserCtxt *
xmlRelaxNGNewDocParserCtxt (xmlDoc *doc);
XMLPUBFUN int
xmlRelaxParserSetFlag (xmlRelaxNGParserCtxt *ctxt,
int flag);
XMLPUBFUN int
xmlRelaxParserSetIncLImit (xmlRelaxNGParserCtxt *ctxt,
int limit);
XMLPUBFUN void
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxt *ctxt);
XMLPUBFUN void
xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxt *ctxt,
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int
xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxt *ctxt,
xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN void
xmlRelaxNGSetParserStructuredErrors(
xmlRelaxNGParserCtxt *ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN void
xmlRelaxNGSetResourceLoader (xmlRelaxNGParserCtxt *ctxt,
xmlResourceLoader loader,
void *vctxt);
XMLPUBFUN xmlRelaxNG *
xmlRelaxNGParse (xmlRelaxNGParserCtxt *ctxt);
XMLPUBFUN void
xmlRelaxNGFree (xmlRelaxNG *schema);
#ifdef LIBXML_DEBUG_ENABLED
XMLPUBFUN void
xmlRelaxNGDump (FILE *output,
xmlRelaxNG *schema);
#endif /* LIBXML_DEBUG_ENABLED */
#ifdef LIBXML_OUTPUT_ENABLED
XMLPUBFUN void
xmlRelaxNGDumpTree (FILE * output,
xmlRelaxNG *schema);
#endif /* LIBXML_OUTPUT_ENABLED */
/*
* Interfaces for validating
*/
XMLPUBFUN void
xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxt *ctxt,
xmlRelaxNGValidityErrorFunc err,
xmlRelaxNGValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxt *ctxt,
xmlRelaxNGValidityErrorFunc *err,
xmlRelaxNGValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN void
xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxt *ctxt,
xmlStructuredErrorFunc serror, void *ctx);
XMLPUBFUN xmlRelaxNGValidCtxt *
xmlRelaxNGNewValidCtxt (xmlRelaxNG *schema);
XMLPUBFUN void
xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxt *ctxt);
XMLPUBFUN int
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxt *ctxt,
xmlDoc *doc);
/*
* Interfaces for progressive validation when possible
*/
XMLPUBFUN int
xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxt *ctxt,
xmlDoc *doc,
xmlNode *elem);
XMLPUBFUN int
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxt *ctxt,
const xmlChar *data,
int len);
XMLPUBFUN int
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxt *ctxt,
xmlDoc *doc,
xmlNode *elem);
XMLPUBFUN int
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxt *ctxt,
xmlDoc *doc,
xmlNode *elem);
XMLPUBFUN void
xmlRelaxNGValidCtxtClearErrors(xmlRelaxNGValidCtxt* ctxt);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_RELAXNG_ENABLED */
#endif /* __XML_RELAX_NG__ */
+805
View File
@@ -0,0 +1,805 @@
/**
* @file
*
* @brief internal interfaces for XML Schemas
*
* internal interfaces for the XML Schemas handling
* and schema validity checking
* The Schemas development is a Work In Progress.
* Some of those interfaces are not guaranteed to be API or ABI stable !
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#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>
#include <libxml/dict.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Schema value type
*/
typedef enum {
XML_SCHEMAS_UNKNOWN = 0,
XML_SCHEMAS_STRING = 1,
XML_SCHEMAS_NORMSTRING = 2,
XML_SCHEMAS_DECIMAL = 3,
XML_SCHEMAS_TIME = 4,
XML_SCHEMAS_GDAY = 5,
XML_SCHEMAS_GMONTH = 6,
XML_SCHEMAS_GMONTHDAY = 7,
XML_SCHEMAS_GYEAR = 8,
XML_SCHEMAS_GYEARMONTH = 9,
XML_SCHEMAS_DATE = 10,
XML_SCHEMAS_DATETIME = 11,
XML_SCHEMAS_DURATION = 12,
XML_SCHEMAS_FLOAT = 13,
XML_SCHEMAS_DOUBLE = 14,
XML_SCHEMAS_BOOLEAN = 15,
XML_SCHEMAS_TOKEN = 16,
XML_SCHEMAS_LANGUAGE = 17,
XML_SCHEMAS_NMTOKEN = 18,
XML_SCHEMAS_NMTOKENS = 19,
XML_SCHEMAS_NAME = 20,
XML_SCHEMAS_QNAME = 21,
XML_SCHEMAS_NCNAME = 22,
XML_SCHEMAS_ID = 23,
XML_SCHEMAS_IDREF = 24,
XML_SCHEMAS_IDREFS = 25,
XML_SCHEMAS_ENTITY = 26,
XML_SCHEMAS_ENTITIES = 27,
XML_SCHEMAS_NOTATION = 28,
XML_SCHEMAS_ANYURI = 29,
XML_SCHEMAS_INTEGER = 30,
XML_SCHEMAS_NPINTEGER = 31,
XML_SCHEMAS_NINTEGER = 32,
XML_SCHEMAS_NNINTEGER = 33,
XML_SCHEMAS_PINTEGER = 34,
XML_SCHEMAS_INT = 35,
XML_SCHEMAS_UINT = 36,
XML_SCHEMAS_LONG = 37,
XML_SCHEMAS_ULONG = 38,
XML_SCHEMAS_SHORT = 39,
XML_SCHEMAS_USHORT = 40,
XML_SCHEMAS_BYTE = 41,
XML_SCHEMAS_UBYTE = 42,
XML_SCHEMAS_HEXBINARY = 43,
XML_SCHEMAS_BASE64BINARY = 44,
XML_SCHEMAS_ANYTYPE = 45,
XML_SCHEMAS_ANYSIMPLETYPE = 46
} xmlSchemaValType;
/**
* XML Schemas defines multiple type of types.
*/
typedef enum {
XML_SCHEMA_TYPE_BASIC = 1, /* A built-in datatype */
XML_SCHEMA_TYPE_ANY,
XML_SCHEMA_TYPE_FACET,
XML_SCHEMA_TYPE_SIMPLE,
XML_SCHEMA_TYPE_COMPLEX,
XML_SCHEMA_TYPE_SEQUENCE = 6,
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_TYPE_ANY_ATTRIBUTE,
XML_SCHEMA_TYPE_IDC_UNIQUE,
XML_SCHEMA_TYPE_IDC_KEY,
XML_SCHEMA_TYPE_IDC_KEYREF,
XML_SCHEMA_TYPE_PARTICLE = 25,
XML_SCHEMA_TYPE_ATTRIBUTE_USE,
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,
XML_SCHEMA_EXTRA_QNAMEREF = 2000,
XML_SCHEMA_EXTRA_ATTR_USE_PROHIB
} xmlSchemaTypeType;
/**
* Schema content type
*/
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, /* Obsolete */
XML_SCHEMA_CONTENT_BASIC,
XML_SCHEMA_CONTENT_ANY
} xmlSchemaContentType;
/** Schema value */
typedef struct _xmlSchemaVal xmlSchemaVal;
typedef xmlSchemaVal *xmlSchemaValPtr;
/** Schema type */
typedef struct _xmlSchemaType xmlSchemaType;
typedef xmlSchemaType *xmlSchemaTypePtr;
/** Schema facet */
typedef struct _xmlSchemaFacet xmlSchemaFacet;
typedef xmlSchemaFacet *xmlSchemaFacetPtr;
/** Schema annotation */
typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
/**
* Annotation
*/
struct _xmlSchemaAnnot {
struct _xmlSchemaAnnot *next;
xmlNode *content; /* the annotation */
};
/**
* Skip unknown attribute from validation
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_SKIP 1
/**
* Ignore validation non definition on attributes
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_LAX 2
/**
* Apply strict validation rules on attributes
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ANYATTR_STRICT 3
/**
* Skip unknown attribute from validation
*/
#define XML_SCHEMAS_ANY_SKIP 1
/**
* Used by wildcards.
* Validate if type found, don't worry if not found
*/
#define XML_SCHEMAS_ANY_LAX 2
/**
* Used by wildcards.
* Apply strict validation rules
*/
#define XML_SCHEMAS_ANY_STRICT 3
/**
* Used by wildcards.
* The attribute is prohibited.
*/
#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
/**
* The attribute is required.
*/
#define XML_SCHEMAS_ATTR_USE_REQUIRED 1
/**
* The attribute is optional.
*/
#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
/**
* allow elements in no namespace
*/
#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0
/**
* allow elements in no namespace
*/
#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7
/**
* this is set when the "type" and "ref" references
* have been resolved.
*/
#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8
/**
* the attribute has a fixed value
*/
#define XML_SCHEMAS_ATTR_FIXED 1 << 9
/** Schema attribute definition */
typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
/**
* An attribute definition.
*/
struct _xmlSchemaAttribute {
xmlSchemaTypeType type;
struct _xmlSchemaAttribute *next; /* the next attribute (not used?) */
const xmlChar *name; /* the name of the declaration */
const xmlChar *id; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
const xmlChar *typeName; /* the local name of the type definition */
const xmlChar *typeNs; /* the ns URI of the type definition */
xmlSchemaAnnot *annot;
xmlSchemaType *base; /* Deprecated; not used */
int occurs; /* Deprecated; not used */
const xmlChar *defValue; /* The initial value of the value constraint */
xmlSchemaType *subtypes; /* the type definition */
xmlNode *node;
const xmlChar *targetNamespace;
int flags;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaVal *defVal; /* The compiled value constraint */
xmlSchemaAttribute *refDecl; /* Deprecated; not used */
};
/** Linked list of schema attributes */
typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr;
/**
* Used to build a list of attribute uses on complexType definitions.
* WARNING: Deprecated; not used.
*/
struct _xmlSchemaAttributeLink {
struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */
struct _xmlSchemaAttribute *attr;/* the linked attribute */
};
/**
* If the wildcard is complete.
*/
#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0
/** Namespace wildcard */
typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr;
/**
* Used to build a list of namespaces on wildcards.
*/
struct _xmlSchemaWildcardNs {
struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */
const xmlChar *value;/* the value */
};
/** Name wildcard */
typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
typedef xmlSchemaWildcard *xmlSchemaWildcardPtr;
/**
* A wildcard.
*/
struct _xmlSchemaWildcard {
xmlSchemaTypeType type; /* The kind of type */
const xmlChar *id; /* Deprecated; not used */
xmlSchemaAnnot *annot;
xmlNode *node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int processContents;
int any; /* Indicates if the ns constraint is of ##any */
xmlSchemaWildcardNs *nsSet; /* The list of allowed namespaces */
xmlSchemaWildcardNs *negNsSet; /* The negated namespace */
int flags;
};
/**
* The attribute wildcard has been built.
*/
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
/**
* The attribute group has been defined.
*/
#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
/**
* Marks the attr group as marked; used for circular checks.
*/
#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2
/**
* The attr group was redefined.
*/
#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3
/**
* Whether this attr. group contains attr. group references.
*/
#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4
/** Attribute group */
typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
/**
* An attribute group definition.
*
* xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
* must be kept similar
*/
struct _xmlSchemaAttributeGroup {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
const xmlChar *name;
const xmlChar *id;
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnot *annot;
xmlSchemaAttribute *attributes; /* Deprecated; not used */
xmlNode *node;
int flags;
xmlSchemaWildcard *attributeWildcard;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaAttributeGroup *refItem; /* Deprecated; not used */
const xmlChar *targetNamespace;
void *attrUses;
};
/** Linked list of schema types */
typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink;
typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr;
/**
* Used to build a list of types (e.g. member types of
* simpleType with variety "union").
*/
struct _xmlSchemaTypeLink {
struct _xmlSchemaTypeLink *next;/* the next type link ... */
xmlSchemaType *type;/* the linked type */
};
/** Linked list of schema facets */
typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink;
typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr;
/**
* Used to build a list of facets.
*/
struct _xmlSchemaFacetLink {
struct _xmlSchemaFacetLink *next;/* the next facet link ... */
xmlSchemaFacet *facet;/* the linked facet */
};
/**
* the element content type is mixed
*/
#define XML_SCHEMAS_TYPE_MIXED 1 << 0
/**
* the simple or complex type has a derivation method of "extension".
*/
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1
/**
* the simple or complex type has a derivation method of "restriction".
*/
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2
/**
* the type is global
*/
#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3
/**
* the complexType owns an attribute wildcard, i.e.
* it can be freed by the complexType
*/
#define XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD 1 << 4 /* Obsolete. */
/**
* the simpleType has a variety of "absent".
* TODO: Actually not necessary :-/, since if
* none of the variety flags occur then it's
* automatically absent.
*/
#define XML_SCHEMAS_TYPE_VARIETY_ABSENT 1 << 5
/**
* the simpleType has a variety of "list".
*/
#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6
/**
* the simpleType has a variety of "union".
*/
#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7
/**
* the simpleType has a variety of "union".
*/
#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8
/**
* the complexType has a final of "extension".
*/
#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9
/**
* the simpleType/complexType has a final of "restriction".
*/
#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10
/**
* the simpleType has a final of "list".
*/
#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11
/**
* the simpleType has a final of "union".
*/
#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12
/**
* the simpleType has a final of "default".
*/
#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13
/**
* Marks the item as a builtin primitive.
*/
#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14
/**
* Marks the item as marked; used for circular checks.
*/
#define XML_SCHEMAS_TYPE_MARKED 1 << 16
/**
* the complexType did not specify 'block' so use the default of the
* `<schema>` item.
*/
#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17
/**
* the complexType has a 'block' of "extension".
*/
#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18
/**
* the complexType has a 'block' of "restriction".
*/
#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19
/**
* the simple/complexType is abstract.
*/
#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20
/**
* indicates if the facets need a computed value
*/
#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21
/**
* indicates that the type was typefixed
*/
#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22
/**
* indicates that the type is invalid
*/
#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23
/**
* a whitespace-facet value of "preserve"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24
/**
* a whitespace-facet value of "replace"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25
/**
* a whitespace-facet value of "collapse"
*/
#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26
/**
* has facets
*/
#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27
/**
* indicates if the facets (pattern) need a normalized value
*/
#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28
/**
* First stage of fixup was done.
*/
#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29
/**
* The type was redefined.
*/
#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30
#if 0
/**
* The type redefines an other type.
*/
#define XML_SCHEMAS_TYPE_REDEFINING 1 << 31
#endif
/**
* Schemas type definition.
*/
struct _xmlSchemaType {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaType *next; /* the next type if in a sequence ... */
const xmlChar *name;
const xmlChar *id ; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnot *annot;
xmlSchemaType *subtypes;
xmlSchemaAttribute *attributes; /* Deprecated; not used */
xmlNode *node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int flags;
xmlSchemaContentType contentType;
const xmlChar *base; /* Base type's local name */
const xmlChar *baseNs; /* Base type's target namespace */
xmlSchemaType *baseType; /* The base type component */
xmlSchemaFacet *facets; /* Local facets */
struct _xmlSchemaType *redef; /* Deprecated; not used */
int recurse; /* Obsolete */
xmlSchemaAttributeLink **attributeUses; /* Deprecated; not used */
xmlSchemaWildcard *attributeWildcard;
int builtInType; /* Type of built-in types. */
xmlSchemaTypeLink *memberTypes; /* member-types if a union type. */
xmlSchemaFacetLink *facetSet; /* All facets (incl. inherited) */
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaType *contentTypeDef; /* Used for the simple content of complex types.
Could we use @subtypes for this? */
xmlRegexp *contModel; /* Holds the automaton of the content model */
const xmlChar *targetNamespace;
void *attrUses;
};
/**
* the element is nillable
*/
#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
/**
* the element is global
*/
#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
/**
* the element has a default value
*/
#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
/**
* the element has a fixed value
*/
#define XML_SCHEMAS_ELEM_FIXED 1 << 3
/**
* the element is abstract
*/
#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
/**
* the element is top level
* obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
*/
#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
/**
* the element is a reference to a type
*/
#define XML_SCHEMAS_ELEM_REF 1 << 6
/**
* allow elements in no namespace
* Obsolete, not used anymore.
*/
#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7
/**
* this is set when "type", "ref", "substitutionGroup"
* references have been resolved.
*/
#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8
/**
* a helper flag for the search of circular references.
*/
#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9
/**
* the "block" attribute is absent
*/
#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10
/**
* disallowed substitutions are absent
*/
#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11
/**
* disallowed substitutions: "restriction"
*/
#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12
/**
* disallowed substitutions: "substitution"
*/
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13
/**
* substitution group exclusions are absent
*/
#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14
/**
* substitution group exclusions: "extension"
*/
#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15
/**
* substitution group exclusions: "restriction"
*/
#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16
/**
* the declaration is a substitution group head
*/
#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17
/**
* this is set when the elem decl has been checked against
* all constraints
*/
#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18
/** Schema element definition */
typedef struct _xmlSchemaElement xmlSchemaElement;
typedef xmlSchemaElement *xmlSchemaElementPtr;
/**
* An element definition.
*
* xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
* structures must be kept similar
*/
struct _xmlSchemaElement {
xmlSchemaTypeType type; /* The kind of type */
struct _xmlSchemaType *next; /* Not used? */
const xmlChar *name;
const xmlChar *id; /* Deprecated; not used */
const xmlChar *ref; /* Deprecated; not used */
const xmlChar *refNs; /* Deprecated; not used */
xmlSchemaAnnot *annot;
xmlSchemaType *subtypes; /* the type definition */
xmlSchemaAttribute *attributes;
xmlNode *node;
int minOccurs; /* Deprecated; not used */
int maxOccurs; /* Deprecated; not used */
int flags;
const xmlChar *targetNamespace;
const xmlChar *namedType;
const xmlChar *namedTypeNs;
const xmlChar *substGroup;
const xmlChar *substGroupNs;
const xmlChar *scope;
const xmlChar *value; /* The original value of the value constraint. */
struct _xmlSchemaElement *refDecl; /* This will now be used for the
substitution group affiliation */
xmlRegexp *contModel; /* Obsolete for WXS, maybe used for RelaxNG */
xmlSchemaContentType contentType;
const xmlChar *refPrefix; /* Deprecated; not used */
xmlSchemaVal *defVal; /* The compiled value constraint. */
void *idcs; /* The identity-constraint defs */
};
/**
* unknown facet handling
*/
#define XML_SCHEMAS_FACET_UNKNOWN 0
/**
* preserve the type of the facet
*/
#define XML_SCHEMAS_FACET_PRESERVE 1
/**
* replace the type of the facet
*/
#define XML_SCHEMAS_FACET_REPLACE 2
/**
* 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 ... */
const xmlChar *value; /* The original value */
const xmlChar *id; /* Obsolete */
xmlSchemaAnnot *annot;
xmlNode *node;
int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */
int whitespace;
xmlSchemaVal *val; /* The compiled value */
xmlRegexp *regexp; /* The regex for patterns */
};
/** Schema notation */
typedef struct _xmlSchemaNotation xmlSchemaNotation;
typedef xmlSchemaNotation *xmlSchemaNotationPtr;
/**
* A notation definition.
*/
struct _xmlSchemaNotation {
xmlSchemaTypeType type; /* The kind of type */
const xmlChar *name;
xmlSchemaAnnot *annot;
const xmlChar *identifier;
const xmlChar *targetNamespace;
};
/*
* TODO: Actually all those flags used for the schema should sit
* on the schema parser context, since they are used only
* during parsing an XML schema document, and not available
* on the component level as per spec.
*/
/**
* Reflects elementFormDefault == qualified in
* an XML schema document.
*/
#define XML_SCHEMAS_QUALIF_ELEM 1 << 0
/**
* Reflects attributeFormDefault == qualified in
* an XML schema document.
*/
#define XML_SCHEMAS_QUALIF_ATTR 1 << 1
/**
* the schema has "extension" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2
/**
* the schema has "restriction" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3
/**
* the schema has "list" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4
/**
* the schema has "union" in the set of finalDefault.
*/
#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5
/**
* the schema has "extension" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6
/**
* the schema has "restriction" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7
/**
* the schema has "substitution" in the set of blockDefault.
*/
#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8
/**
* the schema is currently including an other schema with
* no target namespace.
*/
#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9
/**
* A Schemas definition
*/
struct _xmlSchema {
const xmlChar *name; /* schema name */
const xmlChar *targetNamespace; /* the target namespace */
const xmlChar *version;
const xmlChar *id; /* Obsolete */
xmlDoc *doc;
xmlSchemaAnnot *annot;
int flags;
xmlHashTable *typeDecl;
xmlHashTable *attrDecl;
xmlHashTable *attrgrpDecl;
xmlHashTable *elemDecl;
xmlHashTable *notaDecl;
xmlHashTable *schemasImports;
void *_private; /* unused by the library for users or bindings */
xmlHashTable *groupDecl;
xmlDict *dict;
void *includes; /* the includes, this is opaque for now */
int preserve; /* whether to free the document */
int counter; /* used to give anonymous components unique names */
xmlHashTable *idcDef; /* All identity-constraint defs. */
void *volatiles; /* Obsolete */
};
XMLPUBFUN void xmlSchemaFreeType (xmlSchemaType *type);
XMLPUBFUN void xmlSchemaFreeWildcard(xmlSchemaWildcard *wildcard);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_INTERNALS_H__ */
+151
View File
@@ -0,0 +1,151 @@
/**
* @file
*
* @brief XML Schematron implementation
*
* interface to the XML Schematron validity checking.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_SCHEMATRON_H__
#define __XML_SCHEMATRON_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMATRON_ENABLED
#include <libxml/xmlerror.h>
#include <libxml/tree.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Schematron validation options
*/
typedef enum {
/** quiet no report */
XML_SCHEMATRON_OUT_QUIET = 1 << 0,
/** build a textual report */
XML_SCHEMATRON_OUT_TEXT = 1 << 1,
/** output SVRL */
XML_SCHEMATRON_OUT_XML = 1 << 2,
/** output via xmlStructuredErrorFunc */
XML_SCHEMATRON_OUT_ERROR = 1 << 3,
/** output to a file descriptor */
XML_SCHEMATRON_OUT_FILE = 1 << 8,
/** output to a buffer */
XML_SCHEMATRON_OUT_BUFFER = 1 << 9,
/** output to I/O mechanism */
XML_SCHEMATRON_OUT_IO = 1 << 10
} xmlSchematronValidOptions;
/** Schematron schema */
typedef struct _xmlSchematron xmlSchematron;
typedef xmlSchematron *xmlSchematronPtr;
/**
* Signature of an error callback from a Schematron validation
*
* @param ctx the validation context
* @param msg the message
* @param ... extra arguments
*/
typedef void (*xmlSchematronValidityErrorFunc) (void *ctx, const char *msg, ...);
/**
* Signature of a warning callback from a Schematron validation
*
* @param ctx the validation context
* @param msg the message
* @param ... extra arguments
*/
typedef void (*xmlSchematronValidityWarningFunc) (void *ctx, const char *msg, ...);
/** Schematron parser context */
typedef struct _xmlSchematronParserCtxt xmlSchematronParserCtxt;
typedef xmlSchematronParserCtxt *xmlSchematronParserCtxtPtr;
/** Schematron validation context */
typedef struct _xmlSchematronValidCtxt xmlSchematronValidCtxt;
typedef xmlSchematronValidCtxt *xmlSchematronValidCtxtPtr;
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlSchematronParserCtxt *
xmlSchematronNewParserCtxt (const char *URL);
XMLPUBFUN xmlSchematronParserCtxt *
xmlSchematronNewMemParserCtxt(const char *buffer,
int size);
XMLPUBFUN xmlSchematronParserCtxt *
xmlSchematronNewDocParserCtxt(xmlDoc *doc);
XMLPUBFUN void
xmlSchematronFreeParserCtxt (xmlSchematronParserCtxt *ctxt);
/*****
XMLPUBFUN void
xmlSchematronSetParserErrors(xmlSchematronParserCtxt *ctxt,
xmlSchematronValidityErrorFunc err,
xmlSchematronValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int
xmlSchematronGetParserErrors(xmlSchematronParserCtxt *ctxt,
xmlSchematronValidityErrorFunc * err,
xmlSchematronValidityWarningFunc * warn,
void **ctx);
XMLPUBFUN int
xmlSchematronIsValid (xmlSchematronValidCtxt *ctxt);
*****/
XMLPUBFUN xmlSchematron *
xmlSchematronParse (xmlSchematronParserCtxt *ctxt);
XMLPUBFUN void
xmlSchematronFree (xmlSchematron *schema);
/*
* Interfaces for validating
*/
XMLPUBFUN void
xmlSchematronSetValidStructuredErrors(
xmlSchematronValidCtxt *ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
/******
XMLPUBFUN void
xmlSchematronSetValidErrors (xmlSchematronValidCtxt *ctxt,
xmlSchematronValidityErrorFunc err,
xmlSchematronValidityWarningFunc warn,
void *ctx);
XMLPUBFUN int
xmlSchematronGetValidErrors (xmlSchematronValidCtxt *ctxt,
xmlSchematronValidityErrorFunc *err,
xmlSchematronValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN int
xmlSchematronSetValidOptions(xmlSchematronValidCtxt *ctxt,
int options);
XMLPUBFUN int
xmlSchematronValidCtxtGetOptions(xmlSchematronValidCtxt *ctxt);
XMLPUBFUN int
xmlSchematronValidateOneElement (xmlSchematronValidCtxt *ctxt,
xmlNode *elem);
*******/
XMLPUBFUN xmlSchematronValidCtxt *
xmlSchematronNewValidCtxt (xmlSchematron *schema,
int options);
XMLPUBFUN void
xmlSchematronFreeValidCtxt (xmlSchematronValidCtxt *ctxt);
XMLPUBFUN int
xmlSchematronValidateDoc (xmlSchematronValidCtxt *ctxt,
xmlDoc *instance);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMATRON_ENABLED */
#endif /* __XML_SCHEMATRON_H__ */
+80
View File
@@ -0,0 +1,80 @@
/**
* @file
*
* @brief interfaces for thread handling
*
* set of generic threading related routines
* should work with pthreads, Windows native or TLS threads
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_THREADS_H__
#define __XML_THREADS_H__
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/** Mutual exclusion object */
typedef struct _xmlMutex xmlMutex;
typedef xmlMutex *xmlMutexPtr;
/** Reentrant mutual exclusion object */
typedef struct _xmlRMutex xmlRMutex;
typedef xmlRMutex *xmlRMutexPtr;
XMLPUBFUN int
xmlCheckThreadLocalStorage(void);
XMLPUBFUN xmlMutex *
xmlNewMutex (void);
XMLPUBFUN void
xmlMutexLock (xmlMutex *tok);
XMLPUBFUN void
xmlMutexUnlock (xmlMutex *tok);
XMLPUBFUN void
xmlFreeMutex (xmlMutex *tok);
XMLPUBFUN xmlRMutex *
xmlNewRMutex (void);
XMLPUBFUN void
xmlRMutexLock (xmlRMutex *tok);
XMLPUBFUN void
xmlRMutexUnlock (xmlRMutex *tok);
XMLPUBFUN void
xmlFreeRMutex (xmlRMutex *tok);
/*
* Library wide APIs.
*/
XML_DEPRECATED
XMLPUBFUN void
xmlInitThreads (void);
XMLPUBFUN void
xmlLockLibrary (void);
XMLPUBFUN void
xmlUnlockLibrary(void);
XML_DEPRECATED
XMLPUBFUN void
xmlCleanupThreads(void);
/** @cond IGNORE */
#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \
defined(LIBXML_STATIC_FOR_DLL)
int
xmlDllMain(void *hinstDLL, unsigned long fdwReason,
void *lpvReserved);
#endif
/** @endcond */
#ifdef __cplusplus
}
#endif
#endif /* __XML_THREADS_H__ */
File diff suppressed because it is too large Load Diff
+105
View File
@@ -0,0 +1,105 @@
/**
* @file
*
* @brief library of generic URI related routines
*
* library of generic URI related routines
* Implements RFC 2396
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_URI_H__
#define __XML_URI_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
/** Parsed URI */
typedef struct _xmlURI xmlURI;
typedef xmlURI *xmlURIPtr;
/**
* A parsed URI reference.
*
* This is a struct containing the various fields
* as described in RFC 2396 but separated for further processing.
*
* Note: query is a deprecated field which is incorrectly unescaped.
* query_raw takes precedence over query if the former is set.
* See: http://mail.gnome.org/archives/xml/2007-April/thread.html\#00127
*/
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 (deprecated - use with caution) */
char *fragment; /* the fragment identifier */
int cleanup; /* parsing potentially unclean URI */
char *query_raw; /* the query string (as it appears in the URI) */
};
XMLPUBFUN xmlURI *
xmlCreateURI (void);
XMLPUBFUN int
xmlBuildURISafe (const xmlChar *URI,
const xmlChar *base,
xmlChar **out);
XMLPUBFUN xmlChar *
xmlBuildURI (const xmlChar *URI,
const xmlChar *base);
XMLPUBFUN int
xmlBuildRelativeURISafe (const xmlChar *URI,
const xmlChar *base,
xmlChar **out);
XMLPUBFUN xmlChar *
xmlBuildRelativeURI (const xmlChar *URI,
const xmlChar *base);
XMLPUBFUN xmlURI *
xmlParseURI (const char *str);
XMLPUBFUN int
xmlParseURISafe (const char *str,
xmlURI **uri);
XMLPUBFUN xmlURI *
xmlParseURIRaw (const char *str,
int raw);
XMLPUBFUN int
xmlParseURIReference (xmlURI *uri,
const char *str);
XMLPUBFUN xmlChar *
xmlSaveUri (xmlURI *uri);
XMLPUBFUN void
xmlPrintURI (FILE *stream,
xmlURI *uri);
XMLPUBFUN xmlChar *
xmlURIEscapeStr (const xmlChar *str,
const xmlChar *list);
XMLPUBFUN char *
xmlURIUnescapeString (const char *str,
int len,
char *target);
XMLPUBFUN int
xmlNormalizeURIPath (char *path);
XMLPUBFUN xmlChar *
xmlURIEscape (const xmlChar *str);
XMLPUBFUN void
xmlFreeURI (xmlURI *uri);
XMLPUBFUN xmlChar*
xmlCanonicPath (const xmlChar *path);
XMLPUBFUN xmlChar*
xmlPathToURI (const xmlChar *path);
#ifdef __cplusplus
}
#endif
#endif /* __XML_URI_H__ */
+452
View File
@@ -0,0 +1,452 @@
/**
* @file
*
* @brief DTD validator
*
* API to handle XML Document Type Definitions and validate
* documents.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_VALID_H__
#define __XML_VALID_H__
#include <libxml/xmlversion.h>
#include <libxml/xmlerror.h>
#define XML_TREE_INTERNALS
#include <libxml/tree.h>
#undef XML_TREE_INTERNALS
#include <libxml/list.h>
#include <libxml/xmlautomata.h>
#include <libxml/xmlregexp.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Validation state added for non-deterministic content model.
*/
typedef struct _xmlValidState xmlValidState;
typedef xmlValidState *xmlValidStatePtr;
/**
* Report a validity error.
*
* @param ctx user data (usually an xmlValidCtxt)
* @param msg printf-like format string
* @param ... arguments to format
*/
typedef void (*xmlValidityErrorFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
/**
* Report a validity warning.
*
* @param ctx user data (usually an xmlValidCtxt)
* @param msg printf-like format string
* @param ... arguments to format
*/
typedef void (*xmlValidityWarningFunc) (void *ctx,
const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);
typedef struct _xmlValidCtxt xmlValidCtxt;
typedef xmlValidCtxt *xmlValidCtxtPtr;
/**
* An xmlValidCtxt is used for error reporting when validating.
*/
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 */
xmlNode *node; /* Current parsed Node */
int nodeNr; /* Depth of the parsing stack */
int nodeMax; /* Max depth of the parsing stack */
xmlNode **nodeTab; /* array of nodes */
unsigned int flags; /* internal flags */
xmlDoc *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
xmlAutomata *am; /* the automata */
xmlAutomataState *state; /* used to build the automata */
#else
void *am;
void *state;
#endif
};
typedef struct _xmlHashTable xmlNotationTable;
typedef xmlNotationTable *xmlNotationTablePtr;
typedef struct _xmlHashTable xmlElementTable;
typedef xmlElementTable *xmlElementTablePtr;
typedef struct _xmlHashTable xmlAttributeTable;
typedef xmlAttributeTable *xmlAttributeTablePtr;
typedef struct _xmlHashTable xmlIDTable;
typedef xmlIDTable *xmlIDTablePtr;
typedef struct _xmlHashTable xmlRefTable;
typedef xmlRefTable *xmlRefTablePtr;
/* Notation */
XMLPUBFUN xmlNotation *
xmlAddNotationDecl (xmlValidCtxt *ctxt,
xmlDtd *dtd,
const xmlChar *name,
const xmlChar *publicId,
const xmlChar *systemId);
XML_DEPRECATED
XMLPUBFUN xmlNotationTable *
xmlCopyNotationTable (xmlNotationTable *table);
XML_DEPRECATED
XMLPUBFUN void
xmlFreeNotationTable (xmlNotationTable *table);
#ifdef LIBXML_OUTPUT_ENABLED
XML_DEPRECATED
XMLPUBFUN void
xmlDumpNotationDecl (xmlBuffer *buf,
xmlNotation *nota);
/* XML_DEPRECATED, still used in lxml */
XMLPUBFUN void
xmlDumpNotationTable (xmlBuffer *buf,
xmlNotationTable *table);
#endif /* LIBXML_OUTPUT_ENABLED */
/* Element Content */
XML_DEPRECATED
XMLPUBFUN xmlElementContent *
xmlNewElementContent (const xmlChar *name,
xmlElementContentType type);
XML_DEPRECATED
XMLPUBFUN xmlElementContent *
xmlCopyElementContent (xmlElementContent *content);
XML_DEPRECATED
XMLPUBFUN void
xmlFreeElementContent (xmlElementContent *cur);
XML_DEPRECATED
XMLPUBFUN xmlElementContent *
xmlNewDocElementContent (xmlDoc *doc,
const xmlChar *name,
xmlElementContentType type);
XML_DEPRECATED
XMLPUBFUN xmlElementContent *
xmlCopyDocElementContent(xmlDoc *doc,
xmlElementContent *content);
XML_DEPRECATED
XMLPUBFUN void
xmlFreeDocElementContent(xmlDoc *doc,
xmlElementContent *cur);
XML_DEPRECATED
XMLPUBFUN void
xmlSnprintfElementContent(char *buf,
int size,
xmlElementContent *content,
int englob);
#ifdef LIBXML_OUTPUT_ENABLED
XML_DEPRECATED
XMLPUBFUN void
xmlSprintfElementContent(char *buf,
xmlElementContent *content,
int englob);
#endif /* LIBXML_OUTPUT_ENABLED */
/* Element */
XMLPUBFUN xmlElement *
xmlAddElementDecl (xmlValidCtxt *ctxt,
xmlDtd *dtd,
const xmlChar *name,
xmlElementTypeVal type,
xmlElementContent *content);
XML_DEPRECATED
XMLPUBFUN xmlElementTable *
xmlCopyElementTable (xmlElementTable *table);
XML_DEPRECATED
XMLPUBFUN void
xmlFreeElementTable (xmlElementTable *table);
#ifdef LIBXML_OUTPUT_ENABLED
XML_DEPRECATED
XMLPUBFUN void
xmlDumpElementTable (xmlBuffer *buf,
xmlElementTable *table);
XML_DEPRECATED
XMLPUBFUN void
xmlDumpElementDecl (xmlBuffer *buf,
xmlElement *elem);
#endif /* LIBXML_OUTPUT_ENABLED */
/* Enumeration */
XML_DEPRECATED
XMLPUBFUN xmlEnumeration *
xmlCreateEnumeration (const xmlChar *name);
/* XML_DEPRECATED, needed for custom attributeDecl SAX handler */
XMLPUBFUN void
xmlFreeEnumeration (xmlEnumeration *cur);
XML_DEPRECATED
XMLPUBFUN xmlEnumeration *
xmlCopyEnumeration (xmlEnumeration *cur);
/* Attribute */
XMLPUBFUN xmlAttribute *
xmlAddAttributeDecl (xmlValidCtxt *ctxt,
xmlDtd *dtd,
const xmlChar *elem,
const xmlChar *name,
const xmlChar *ns,
xmlAttributeType type,
xmlAttributeDefault def,
const xmlChar *defaultValue,
xmlEnumeration *tree);
XML_DEPRECATED
XMLPUBFUN xmlAttributeTable *
xmlCopyAttributeTable (xmlAttributeTable *table);
XML_DEPRECATED
XMLPUBFUN void
xmlFreeAttributeTable (xmlAttributeTable *table);
#ifdef LIBXML_OUTPUT_ENABLED
XML_DEPRECATED
XMLPUBFUN void
xmlDumpAttributeTable (xmlBuffer *buf,
xmlAttributeTable *table);
XML_DEPRECATED
XMLPUBFUN void
xmlDumpAttributeDecl (xmlBuffer *buf,
xmlAttribute *attr);
#endif /* LIBXML_OUTPUT_ENABLED */
/* IDs */
XMLPUBFUN int
xmlAddIDSafe (xmlAttr *attr,
const xmlChar *value);
XMLPUBFUN xmlID *
xmlAddID (xmlValidCtxt *ctxt,
xmlDoc *doc,
const xmlChar *value,
xmlAttr *attr);
XMLPUBFUN void
xmlFreeIDTable (xmlIDTable *table);
XMLPUBFUN xmlAttr *
xmlGetID (xmlDoc *doc,
const xmlChar *ID);
XMLPUBFUN int
xmlIsID (xmlDoc *doc,
xmlNode *elem,
xmlAttr *attr);
XMLPUBFUN int
xmlRemoveID (xmlDoc *doc,
xmlAttr *attr);
/* IDREFs */
XML_DEPRECATED
XMLPUBFUN xmlRef *
xmlAddRef (xmlValidCtxt *ctxt,
xmlDoc *doc,
const xmlChar *value,
xmlAttr *attr);
XML_DEPRECATED
XMLPUBFUN void
xmlFreeRefTable (xmlRefTable *table);
XML_DEPRECATED
XMLPUBFUN int
xmlIsRef (xmlDoc *doc,
xmlNode *elem,
xmlAttr *attr);
XML_DEPRECATED
XMLPUBFUN int
xmlRemoveRef (xmlDoc *doc,
xmlAttr *attr);
XML_DEPRECATED
XMLPUBFUN xmlList *
xmlGetRefs (xmlDoc *doc,
const xmlChar *ID);
/**
* The public function calls related to validity checking.
*/
#ifdef LIBXML_VALID_ENABLED
/* Allocate/Release Validation Contexts */
XMLPUBFUN xmlValidCtxt *
xmlNewValidCtxt(void);
XMLPUBFUN void
xmlFreeValidCtxt(xmlValidCtxt *);
XML_DEPRECATED
XMLPUBFUN int
xmlValidateRoot (xmlValidCtxt *ctxt,
xmlDoc *doc);
XML_DEPRECATED
XMLPUBFUN int
xmlValidateElementDecl (xmlValidCtxt *ctxt,
xmlDoc *doc,
xmlElement *elem);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlValidNormalizeAttributeValue(xmlDoc *doc,
xmlNode *elem,
const xmlChar *name,
const xmlChar *value);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlValidCtxtNormalizeAttributeValue(xmlValidCtxt *ctxt,
xmlDoc *doc,
xmlNode *elem,
const xmlChar *name,
const xmlChar *value);
XML_DEPRECATED
XMLPUBFUN int
xmlValidateAttributeDecl(xmlValidCtxt *ctxt,
xmlDoc *doc,
xmlAttribute *attr);
XML_DEPRECATED
XMLPUBFUN int
xmlValidateAttributeValue(xmlAttributeType type,
const xmlChar *value);
XML_DEPRECATED
XMLPUBFUN int
xmlValidateNotationDecl (xmlValidCtxt *ctxt,
xmlDoc *doc,
xmlNotation *nota);
XMLPUBFUN int
xmlValidateDtd (xmlValidCtxt *ctxt,
xmlDoc *doc,
xmlDtd *dtd);
XML_DEPRECATED
XMLPUBFUN int
xmlValidateDtdFinal (xmlValidCtxt *ctxt,
xmlDoc *doc);
XMLPUBFUN int
xmlValidateDocument (xmlValidCtxt *ctxt,
xmlDoc *doc);
XMLPUBFUN int
xmlValidateElement (xmlValidCtxt *ctxt,
xmlDoc *doc,
xmlNode *elem);
XML_DEPRECATED
XMLPUBFUN int
xmlValidateOneElement (xmlValidCtxt *ctxt,
xmlDoc *doc,
xmlNode *elem);
XML_DEPRECATED
XMLPUBFUN int
xmlValidateOneAttribute (xmlValidCtxt *ctxt,
xmlDoc *doc,
xmlNode *elem,
xmlAttr *attr,
const xmlChar *value);
XML_DEPRECATED
XMLPUBFUN int
xmlValidateOneNamespace (xmlValidCtxt *ctxt,
xmlDoc *doc,
xmlNode *elem,
const xmlChar *prefix,
xmlNs *ns,
const xmlChar *value);
XML_DEPRECATED
XMLPUBFUN int
xmlValidateDocumentFinal(xmlValidCtxt *ctxt,
xmlDoc *doc);
XML_DEPRECATED
XMLPUBFUN int
xmlValidateNotationUse (xmlValidCtxt *ctxt,
xmlDoc *doc,
const xmlChar *notationName);
#endif /* LIBXML_VALID_ENABLED */
XML_DEPRECATED
XMLPUBFUN int
xmlIsMixedElement (xmlDoc *doc,
const xmlChar *name);
XMLPUBFUN xmlAttribute *
xmlGetDtdAttrDesc (xmlDtd *dtd,
const xmlChar *elem,
const xmlChar *name);
XMLPUBFUN xmlAttribute *
xmlGetDtdQAttrDesc (xmlDtd *dtd,
const xmlChar *elem,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN xmlNotation *
xmlGetDtdNotationDesc (xmlDtd *dtd,
const xmlChar *name);
XMLPUBFUN xmlElement *
xmlGetDtdQElementDesc (xmlDtd *dtd,
const xmlChar *name,
const xmlChar *prefix);
XMLPUBFUN xmlElement *
xmlGetDtdElementDesc (xmlDtd *dtd,
const xmlChar *name);
#ifdef LIBXML_VALID_ENABLED
XMLPUBFUN int
xmlValidGetPotentialChildren(xmlElementContent *ctree,
const xmlChar **names,
int *len,
int max);
/* only needed for `xmllint --insert` */
XMLPUBFUN int
xmlValidGetValidElements(xmlNode *prev,
xmlNode *next,
const xmlChar **names,
int max);
XMLPUBFUN int
xmlValidateNameValue (const xmlChar *value);
XMLPUBFUN int
xmlValidateNamesValue (const xmlChar *value);
XMLPUBFUN int
xmlValidateNmtokenValue (const xmlChar *value);
XMLPUBFUN int
xmlValidateNmtokensValue(const xmlChar *value);
#ifdef LIBXML_REGEXP_ENABLED
/*
* Validation based on the regexp support
*/
XML_DEPRECATED
XMLPUBFUN int
xmlValidBuildContentModel(xmlValidCtxt *ctxt,
xmlElement *elem);
XML_DEPRECATED
XMLPUBFUN int
xmlValidatePushElement (xmlValidCtxt *ctxt,
xmlDoc *doc,
xmlNode *elem,
const xmlChar *qname);
XML_DEPRECATED
XMLPUBFUN int
xmlValidatePushCData (xmlValidCtxt *ctxt,
const xmlChar *data,
int len);
XML_DEPRECATED
XMLPUBFUN int
xmlValidatePopElement (xmlValidCtxt *ctxt,
xmlDoc *doc,
xmlNode *elem,
const xmlChar *qname);
#endif /* LIBXML_REGEXP_ENABLED */
#endif /* LIBXML_VALID_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* __XML_VALID_H__ */
+122
View File
@@ -0,0 +1,122 @@
/**
* @file
*
* @brief Implementation of XInclude 1.0
*
* API to process XML Inclusions.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_XINCLUDE_H__
#define __XML_XINCLUDE_H__
#include <libxml/xmlversion.h>
#include <libxml/xmlerror.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#ifdef LIBXML_XINCLUDE_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude
*/
#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude"
/**
* Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude
*/
#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude"
/**
* Macro defining "include"
*/
#define XINCLUDE_NODE (const xmlChar *) "include"
/**
* Macro defining "fallback"
*/
#define XINCLUDE_FALLBACK (const xmlChar *) "fallback"
/**
* Macro defining "href"
*/
#define XINCLUDE_HREF (const xmlChar *) "href"
/**
* Macro defining "parse"
*/
#define XINCLUDE_PARSE (const xmlChar *) "parse"
/**
* Macro defining "xml"
*/
#define XINCLUDE_PARSE_XML (const xmlChar *) "xml"
/**
* Macro defining "text"
*/
#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text"
/**
* Macro defining "encoding"
*/
#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding"
/**
* Macro defining "xpointer"
*/
#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer"
/** XInclude context */
typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt;
typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
/*
* standalone processing
*/
XMLPUBFUN int
xmlXIncludeProcess (xmlDoc *doc);
XMLPUBFUN int
xmlXIncludeProcessFlags (xmlDoc *doc,
int flags);
XMLPUBFUN int
xmlXIncludeProcessFlagsData(xmlDoc *doc,
int flags,
void *data);
XMLPUBFUN int
xmlXIncludeProcessTreeFlagsData(xmlNode *tree,
int flags,
void *data);
XMLPUBFUN int
xmlXIncludeProcessTree (xmlNode *tree);
XMLPUBFUN int
xmlXIncludeProcessTreeFlags(xmlNode *tree,
int flags);
/*
* contextual processing
*/
XMLPUBFUN xmlXIncludeCtxt *
xmlXIncludeNewContext (xmlDoc *doc);
XMLPUBFUN int
xmlXIncludeSetFlags (xmlXIncludeCtxt *ctxt,
int flags);
XMLPUBFUN void
xmlXIncludeSetErrorHandler(xmlXIncludeCtxt *ctxt,
xmlStructuredErrorFunc handler,
void *data);
XMLPUBFUN void
xmlXIncludeSetResourceLoader(xmlXIncludeCtxt *ctxt,
xmlResourceLoader loader,
void *data);
XMLPUBFUN int
xmlXIncludeGetLastError (xmlXIncludeCtxt *ctxt);
XMLPUBFUN void
xmlXIncludeFreeContext (xmlXIncludeCtxt *ctxt);
XMLPUBFUN int
xmlXIncludeProcessNode (xmlXIncludeCtxt *ctxt,
xmlNode *tree);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XINCLUDE_ENABLED */
#endif /* __XML_XINCLUDE_H__ */
+197
View File
@@ -0,0 +1,197 @@
/**
* @file
*
* @brief unfinished XLink detection module
*
* This module is deprecated, don't use.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_XLINK_H__
#define __XML_XLINK_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_XPTR_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/** @cond ignore */
/**
* 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-References 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;
/** @endcond */
/**
* This is the prototype for the link detection routine.
* It calls the default link detection callbacks upon link detection.
*
* @param ctx user data pointer
* @param node the node to check
*/
typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNode *node);
/*
* The link detection module interact with the upper layers using
* a set of callback registered at parsing time.
*/
/**
* This is the prototype for a simple link detection callback.
*
* @param ctx user data pointer
* @param node the node carrying the link
* @param href the target of the link
* @param role the role string
* @param title the link title
*/
typedef void
(*xlinkSimpleLinkFunk) (void *ctx,
xmlNode *node,
const xlinkHRef href,
const xlinkRole role,
const xlinkTitle title);
/**
* This is the prototype for a extended link detection callback.
*
* @param ctx user data pointer
* @param node the node carrying the link
* @param nbLocators the number of locators detected on the link
* @param hrefs pointer to the array of locator hrefs
* @param roles pointer to the array of locator roles
* @param nbArcs the number of arcs detected on the link
* @param from pointer to the array of source roles found on the arcs
* @param to pointer to the array of target roles found on the arcs
* @param show array of values for the show attributes found on the arcs
* @param actuate array of values for the actuate attributes found on the arcs
* @param nbTitles the number of titles detected on the link
* @param titles array of titles detected on the link
* @param langs array of xml:lang values for the titles
*/
typedef void
(*xlinkExtendedLinkFunk)(void *ctx,
xmlNode *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);
/**
* This is the prototype for a extended link set detection callback.
*
* @param ctx user data pointer
* @param node the node carrying the link
* @param nbLocators the number of locators detected on the link
* @param hrefs pointer to the array of locator hrefs
* @param roles pointer to the array of locator roles
* @param nbTitles the number of titles detected on the link
* @param titles array of titles detected on the link
* @param langs array of xml:lang values for the titles
*/
typedef void
(*xlinkExtendedLinkSetFunk) (void *ctx,
xmlNode *node,
int nbLocators,
const xlinkHRef *hrefs,
const xlinkRole *roles,
int nbTitles,
const xlinkTitle *titles,
const xmlChar **langs);
typedef struct _xlinkHandler xlinkHandler;
typedef xlinkHandler *xlinkHandlerPtr;
/**
* 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.
*/
struct _xlinkHandler {
xlinkSimpleLinkFunk simple;
xlinkExtendedLinkFunk extended;
xlinkExtendedLinkSetFunk set;
};
/*
* The default detection routine, can be overridden, they call the default
* detection callbacks.
*/
XML_DEPRECATED
XMLPUBFUN xlinkNodeDetectFunc
xlinkGetDefaultDetect (void);
XML_DEPRECATED
XMLPUBFUN void
xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
/*
* Routines to set/get the default handlers.
*/
XML_DEPRECATED
XMLPUBFUN xlinkHandler *
xlinkGetDefaultHandler (void);
XML_DEPRECATED
XMLPUBFUN void
xlinkSetDefaultHandler (xlinkHandler *handler);
/*
* Link detection module itself.
*/
XML_DEPRECATED
XMLPUBFUN xlinkType
xlinkIsLink (xmlDoc *doc,
xmlNode *node);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPTR_ENABLED */
#endif /* __XML_XLINK_H__ */
+401
View File
@@ -0,0 +1,401 @@
/**
* @file
*
* @brief I/O interfaces used by the parser
*
* Functions and datatypes for parser input and output.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_IO_H__
#define __XML_IO_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/encoding.h>
#define XML_TREE_INTERNALS
#include <libxml/tree.h>
#undef XML_TREE_INTERNALS
#ifdef __cplusplus
extern "C" {
#endif
/**
* Callback used in the I/O Input API to detect if the current handler
* can provide input functionality for this resource.
*
* @param filename the filename or URI
* @returns 1 if yes and 0 if another Input module should be used
*/
typedef int (*xmlInputMatchCallback) (const char *filename);
/**
* Callback used in the I/O Input API to open the resource
*
* @param filename the filename or URI
* @returns an Input context or NULL in case or error
*/
typedef void * (*xmlInputOpenCallback) (const char *filename);
/**
* Callback used in the I/O Input API to read the resource
*
* @param context an Input context
* @param buffer the buffer to store data read
* @param len the length of the buffer in bytes
* @returns the number of bytes read or -1 in case of error
*/
typedef int (*xmlInputReadCallback) (void * context, char * buffer, int len);
/**
* Callback used in the I/O Input API to close the resource
*
* @param context an Input context
* @returns 0 or -1 in case of error
*/
typedef int (*xmlInputCloseCallback) (void * context);
#ifdef LIBXML_OUTPUT_ENABLED
/**
* Callback used in the I/O Output API to detect if the current handler
* can provide output functionality for this resource.
*
* @param filename the filename or URI
* @returns 1 if yes and 0 if another Output module should be used
*/
typedef int (*xmlOutputMatchCallback) (const char *filename);
/**
* Callback used in the I/O Output API to open the resource
*
* @param filename the filename or URI
* @returns an Output context or NULL in case or error
*/
typedef void * (*xmlOutputOpenCallback) (const char *filename);
/**
* Callback used in the I/O Output API to write to the resource
*
* @param context an Output context
* @param buffer the buffer of data to write
* @param len the length of the buffer in bytes
* @returns the number of bytes written or -1 in case of error
*/
typedef int (*xmlOutputWriteCallback) (void * context, const char * buffer,
int len);
/**
* Callback used in the I/O Output API to close the resource
*
* @param context an Output context
* @returns 0 or -1 in case of error
*/
typedef int (*xmlOutputCloseCallback) (void * context);
#endif /* LIBXML_OUTPUT_ENABLED */
/**
* Signature for the function doing the lookup for a suitable input method
* corresponding to an URI.
*
* @param URI the URI to read from
* @param enc the requested source encoding
* @returns the new xmlParserInputBuffer in case of success or NULL if no
* method was found.
*/
typedef xmlParserInputBuffer *
(*xmlParserInputBufferCreateFilenameFunc)(const char *URI, xmlCharEncoding enc);
/**
* Signature for the function doing the lookup for a suitable output method
* corresponding to an URI.
*
* @param URI the URI to write to
* @param encoder the requested target encoding
* @param compression compression level
* @returns the new xmlOutputBuffer in case of success or NULL if no
* method was found.
*/
typedef xmlOutputBuffer *
(*xmlOutputBufferCreateFilenameFunc)(const char *URI,
xmlCharEncodingHandler *encoder, int compression);
/**
* Parser input buffer
*
* This struct and all related functions should ultimately
* be removed from the public interface.
*/
struct _xmlParserInputBuffer {
void* context XML_DEPRECATED_MEMBER;
xmlInputReadCallback readcallback XML_DEPRECATED_MEMBER;
xmlInputCloseCallback closecallback XML_DEPRECATED_MEMBER;
/* I18N conversions to UTF-8 */
xmlCharEncodingHandler *encoder XML_DEPRECATED_MEMBER;
/* Local buffer encoded in UTF-8 */
xmlBuf *buffer XML_DEPRECATED_MEMBER;
/* if encoder != NULL buffer for raw input */
xmlBuf *raw XML_DEPRECATED_MEMBER;
/* -1=unknown, 0=not compressed, 1=compressed */
int compressed XML_DEPRECATED_MEMBER;
int error XML_DEPRECATED_MEMBER;
/* amount consumed from raw */
unsigned long rawconsumed XML_DEPRECATED_MEMBER;
};
#ifdef LIBXML_OUTPUT_ENABLED
/**
* Output buffer
*/
struct _xmlOutputBuffer {
void* context;
xmlOutputWriteCallback writecallback;
xmlOutputCloseCallback closecallback;
/* I18N conversions to UTF-8 */
xmlCharEncodingHandler *encoder;
/* Local buffer encoded in UTF-8 or ISOLatin */
xmlBuf *buffer;
/* if encoder != NULL buffer for output */
xmlBuf *conv;
/* total number of byte written */
int written;
int error;
};
#endif /* LIBXML_OUTPUT_ENABLED */
/** @cond ignore */
XML_DEPRECATED
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc *
__xmlParserInputBufferCreateFilenameValue(void);
XML_DEPRECATED
XMLPUBFUN xmlOutputBufferCreateFilenameFunc *
__xmlOutputBufferCreateFilenameValue(void);
#ifndef XML_GLOBALS_NO_REDEFINITION
#define xmlParserInputBufferCreateFilenameValue \
(*__xmlParserInputBufferCreateFilenameValue())
#define xmlOutputBufferCreateFilenameValue \
(*__xmlOutputBufferCreateFilenameValue())
#endif
/** @endcond */
/*
* Interfaces for input
*/
XMLPUBFUN void
xmlCleanupInputCallbacks (void);
XMLPUBFUN int
xmlPopInputCallbacks (void);
XMLPUBFUN void
xmlRegisterDefaultInputCallbacks (void);
XMLPUBFUN xmlParserInputBuffer *
xmlAllocParserInputBuffer (xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBuffer *
xmlParserInputBufferCreateFilename (const char *URI,
xmlCharEncoding enc);
XML_DEPRECATED
XMLPUBFUN xmlParserInputBuffer *
xmlParserInputBufferCreateFile (FILE *file,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBuffer *
xmlParserInputBufferCreateFd (int fd,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBuffer *
xmlParserInputBufferCreateMem (const char *mem, int size,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBuffer *
xmlParserInputBufferCreateStatic (const char *mem, int size,
xmlCharEncoding enc);
XMLPUBFUN xmlParserInputBuffer *
xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
xmlCharEncoding enc);
XML_DEPRECATED
XMLPUBFUN int
xmlParserInputBufferRead (xmlParserInputBuffer *in,
int len);
XML_DEPRECATED
XMLPUBFUN int
xmlParserInputBufferGrow (xmlParserInputBuffer *in,
int len);
XML_DEPRECATED
XMLPUBFUN int
xmlParserInputBufferPush (xmlParserInputBuffer *in,
int len,
const char *buf);
XMLPUBFUN void
xmlFreeParserInputBuffer (xmlParserInputBuffer *in);
XMLPUBFUN char *
xmlParserGetDirectory (const char *filename);
XMLPUBFUN int
xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
xmlInputOpenCallback openFunc,
xmlInputReadCallback readFunc,
xmlInputCloseCallback closeFunc);
XMLPUBFUN xmlParserInputBuffer *
__xmlParserInputBufferCreateFilename(const char *URI,
xmlCharEncoding enc);
#ifdef LIBXML_OUTPUT_ENABLED
/*
* Interfaces for output
*/
XMLPUBFUN void
xmlCleanupOutputCallbacks (void);
XMLPUBFUN int
xmlPopOutputCallbacks (void);
XMLPUBFUN void
xmlRegisterDefaultOutputCallbacks(void);
XMLPUBFUN xmlOutputBuffer *
xmlAllocOutputBuffer (xmlCharEncodingHandler *encoder);
XMLPUBFUN xmlOutputBuffer *
xmlOutputBufferCreateFilename (const char *URI,
xmlCharEncodingHandler *encoder,
int compression);
XMLPUBFUN xmlOutputBuffer *
xmlOutputBufferCreateFile (FILE *file,
xmlCharEncodingHandler *encoder);
XMLPUBFUN xmlOutputBuffer *
xmlOutputBufferCreateBuffer (xmlBuffer *buffer,
xmlCharEncodingHandler *encoder);
XMLPUBFUN xmlOutputBuffer *
xmlOutputBufferCreateFd (int fd,
xmlCharEncodingHandler *encoder);
XMLPUBFUN xmlOutputBuffer *
xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void *ioctx,
xmlCharEncodingHandler *encoder);
/* Couple of APIs to get the output without digging into the buffers */
XMLPUBFUN const xmlChar *
xmlOutputBufferGetContent (xmlOutputBuffer *out);
XMLPUBFUN size_t
xmlOutputBufferGetSize (xmlOutputBuffer *out);
XMLPUBFUN int
xmlOutputBufferWrite (xmlOutputBuffer *out,
int len,
const char *buf);
XMLPUBFUN int
xmlOutputBufferWriteString (xmlOutputBuffer *out,
const char *str);
XMLPUBFUN int
xmlOutputBufferWriteEscape (xmlOutputBuffer *out,
const xmlChar *str,
xmlCharEncodingOutputFunc escaping);
XMLPUBFUN int
xmlOutputBufferFlush (xmlOutputBuffer *out);
XMLPUBFUN int
xmlOutputBufferClose (xmlOutputBuffer *out);
XMLPUBFUN int
xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
xmlOutputOpenCallback openFunc,
xmlOutputWriteCallback writeFunc,
xmlOutputCloseCallback closeFunc);
XMLPUBFUN xmlOutputBuffer *
__xmlOutputBufferCreateFilename(const char *URI,
xmlCharEncodingHandler *encoder,
int compression);
#endif /* LIBXML_OUTPUT_ENABLED */
XML_DEPRECATED
XMLPUBFUN xmlParserInput *
xmlCheckHTTPInput (xmlParserCtxt *ctxt,
xmlParserInput *ret);
XML_DEPRECATED
XMLPUBFUN xmlParserInput *
xmlNoNetExternalEntityLoader (const char *URL,
const char *ID,
xmlParserCtxt *ctxt);
XML_DEPRECATED
XMLPUBFUN xmlChar *
xmlNormalizeWindowsPath (const xmlChar *path);
XML_DEPRECATED
XMLPUBFUN int
xmlCheckFilename (const char *path);
XML_DEPRECATED
XMLPUBFUN int
xmlFileMatch (const char *filename);
XML_DEPRECATED
XMLPUBFUN void *
xmlFileOpen (const char *filename);
XML_DEPRECATED
XMLPUBFUN int
xmlFileRead (void * context,
char * buffer,
int len);
XML_DEPRECATED
XMLPUBFUN int
xmlFileClose (void * context);
#ifdef LIBXML_HTTP_STUBS_ENABLED
/** @cond IGNORE */
XML_DEPRECATED
XMLPUBFUN int
xmlIOHTTPMatch (const char *filename);
XML_DEPRECATED
XMLPUBFUN void *
xmlIOHTTPOpen (const char *filename);
#ifdef LIBXML_OUTPUT_ENABLED
XML_DEPRECATED
XMLPUBFUN void
xmlRegisterHTTPPostCallbacks (void );
XML_DEPRECATED
XMLPUBFUN void *
xmlIOHTTPOpenW (const char * post_uri,
int compression );
#endif /* LIBXML_OUTPUT_ENABLED */
XML_DEPRECATED
XMLPUBFUN int
xmlIOHTTPRead (void * context,
char * buffer,
int len);
XML_DEPRECATED
XMLPUBFUN int
xmlIOHTTPClose (void * context);
/** @endcond */
#endif /* LIBXML_HTTP_STUBS_ENABLED */
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
xmlParserInputBufferCreateFilenameDefault(
xmlParserInputBufferCreateFilenameFunc func);
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
xmlOutputBufferCreateFilenameDefault(
xmlOutputBufferCreateFilenameFunc func);
XML_DEPRECATED
XMLPUBFUN xmlOutputBufferCreateFilenameFunc
xmlThrDefOutputBufferCreateFilenameDefault(
xmlOutputBufferCreateFilenameFunc func);
XML_DEPRECATED
XMLPUBFUN xmlParserInputBufferCreateFilenameFunc
xmlThrDefParserInputBufferCreateFilenameDefault(
xmlParserInputBufferCreateFilenameFunc func);
#ifdef __cplusplus
}
#endif
#endif /* __XML_IO_H__ */
+164
View File
@@ -0,0 +1,164 @@
/**
* @file
*
* @brief API to build regexp automata
*
* These are internal functions and shouldn't be used.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_AUTOMATA_H__
#define __XML_AUTOMATA_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_REGEXP_ENABLED
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* A libxml automata description
*
* It can be compiled into a regexp
*/
typedef struct _xmlAutomata xmlAutomata;
typedef xmlAutomata *xmlAutomataPtr;
/**
* A state in the automata description
*/
typedef struct _xmlAutomataState xmlAutomataState;
typedef xmlAutomataState *xmlAutomataStatePtr;
/*
* Building API
*/
XML_DEPRECATED
XMLPUBFUN xmlAutomata *
xmlNewAutomata (void);
XML_DEPRECATED
XMLPUBFUN void
xmlFreeAutomata (xmlAutomata *am);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataGetInitState (xmlAutomata *am);
XML_DEPRECATED
XMLPUBFUN int
xmlAutomataSetFinalState (xmlAutomata *am,
xmlAutomataState *state);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewState (xmlAutomata *am);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewTransition (xmlAutomata *am,
xmlAutomataState *from,
xmlAutomataState *to,
const xmlChar *token,
void *data);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewTransition2 (xmlAutomata *am,
xmlAutomataState *from,
xmlAutomataState *to,
const xmlChar *token,
const xmlChar *token2,
void *data);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewNegTrans (xmlAutomata *am,
xmlAutomataState *from,
xmlAutomataState *to,
const xmlChar *token,
const xmlChar *token2,
void *data);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewCountTrans (xmlAutomata *am,
xmlAutomataState *from,
xmlAutomataState *to,
const xmlChar *token,
int min,
int max,
void *data);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewCountTrans2 (xmlAutomata *am,
xmlAutomataState *from,
xmlAutomataState *to,
const xmlChar *token,
const xmlChar *token2,
int min,
int max,
void *data);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewOnceTrans (xmlAutomata *am,
xmlAutomataState *from,
xmlAutomataState *to,
const xmlChar *token,
int min,
int max,
void *data);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewOnceTrans2 (xmlAutomata *am,
xmlAutomataState *from,
xmlAutomataState *to,
const xmlChar *token,
const xmlChar *token2,
int min,
int max,
void *data);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewAllTrans (xmlAutomata *am,
xmlAutomataState *from,
xmlAutomataState *to,
int lax);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewEpsilon (xmlAutomata *am,
xmlAutomataState *from,
xmlAutomataState *to);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewCountedTrans (xmlAutomata *am,
xmlAutomataState *from,
xmlAutomataState *to,
int counter);
XML_DEPRECATED
XMLPUBFUN xmlAutomataState *
xmlAutomataNewCounterTrans (xmlAutomata *am,
xmlAutomataState *from,
xmlAutomataState *to,
int counter);
XML_DEPRECATED
XMLPUBFUN int
xmlAutomataNewCounter (xmlAutomata *am,
int min,
int max);
XML_DEPRECATED
XMLPUBFUN struct _xmlRegexp *
xmlAutomataCompile (xmlAutomata *am);
XML_DEPRECATED
XMLPUBFUN int
xmlAutomataIsDeterminist (xmlAutomata *am);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_REGEXP_ENABLED */
#endif /* __XML_AUTOMATA_H__ */
File diff suppressed because it is too large Load Diff
+98
View File
@@ -0,0 +1,98 @@
/**
* @file
*
* @brief macros for marking symbols as exportable/importable.
*
* macros for marking symbols as exportable/importable.
*
* @copyright See Copyright for the status of this software.
*/
#ifndef __XML_EXPORTS_H__
#define __XML_EXPORTS_H__
/*
* Symbol visibility
*/
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined(LIBXML_STATIC)
#if defined(IN_LIBXML)
#define XMLPUBFUN __declspec(dllexport)
#define XMLPUBVAR __declspec(dllexport) extern
#else
#define XMLPUBFUN __declspec(dllimport)
#define XMLPUBVAR __declspec(dllimport) extern
#endif
#else /* not Windows */
#define XMLPUBFUN
#define XMLPUBVAR extern
#endif /* platform switch */
/* Compatibility */
#define XMLCALL
#define XMLCDECL
#ifndef LIBXML_DLL_IMPORT
#define LIBXML_DLL_IMPORT XMLPUBVAR
#endif
/*
* Attributes
*/
#if !defined(__clang__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 403)
#define LIBXML_ATTR_ALLOC_SIZE(x) __attribute__((alloc_size(x)))
#else
#define LIBXML_ATTR_ALLOC_SIZE(x)
#endif
#if __GNUC__ * 100 + __GNUC_MINOR__ >= 303
#define LIBXML_ATTR_FORMAT(fmt,args) \
__attribute__((__format__(__printf__,fmt,args)))
#else
#define LIBXML_ATTR_FORMAT(fmt,args)
#endif
#ifndef XML_DEPRECATED
#if defined(IN_LIBXML)
#define XML_DEPRECATED
#elif __GNUC__ * 100 + __GNUC_MINOR__ >= 405
/* GCC 4.5+ supports deprecated with message */
#define XML_DEPRECATED __attribute__((deprecated("See https://gnome.pages.gitlab.gnome.org/libxml2/html/deprecated.html")))
#elif __GNUC__ * 100 + __GNUC_MINOR__ >= 301
/* GCC 3.1+ supports deprecated without message */
#define XML_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER) && _MSC_VER >= 1400
/* Available since Visual Studio 2005 */
#define XML_DEPRECATED __declspec(deprecated("See https://gnome.pages.gitlab.gnome.org/libxml2/html/deprecated.html"))
#else
#define XML_DEPRECATED
#endif
#endif
#ifndef XML_DEPRECATED_MEMBER
#if defined(IN_LIBXML)
#define XML_DEPRECATED_MEMBER
#elif __GNUC__ * 100 + __GNUC_MINOR__ >= 301
#define XML_DEPRECATED_MEMBER __attribute__((deprecated))
#else
#define XML_DEPRECATED_MEMBER
#endif
#endif
/*
* Originally declared in xmlversion.h which is generated
*/
#ifdef __cplusplus
extern "C" {
#endif
XMLPUBFUN void xmlCheckVersion(int version);
#ifdef __cplusplus
}
#endif
#endif /* __XML_EXPORTS_H__ */
+203
View File
@@ -0,0 +1,203 @@
/**
* @file
*
* @brief interface for the memory allocator
*
* provides interfaces for the memory allocator,
* including debugging capabilities.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __DEBUG_MEMORY_ALLOC__
#define __DEBUG_MEMORY_ALLOC__
#include <stdio.h>
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The XML memory wrapper support 4 basic overloadable functions.
*/
/**
* Signature for a free() implementation.
*
* @param mem an already allocated block of memory
*/
typedef void (*xmlFreeFunc)(void *mem);
/**
* Signature for a malloc() implementation.
*
* @param size the size requested in bytes
* @returns a pointer to the newly allocated block or NULL in case of error.
*/
typedef void *(*xmlMallocFunc)(size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
/**
* Signature for a realloc() implementation.
*
* @param mem an already allocated block of memory
* @param size the new size requested in bytes
* @returns a pointer to the newly reallocated block or NULL in case of error.
*/
typedef void *(*xmlReallocFunc)(void *mem, size_t size);
/**
* Signature for an strdup() implementation.
*
* @param str a zero terminated string
* @returns the copy of the string or NULL in case of error.
*/
typedef char *(*xmlStrdupFunc)(const char *str);
/*
* In general the memory allocation entry points are not kept
* thread specific but this can be overridden by LIBXML_THREAD_ALLOC_ENABLED
* - xmlMalloc
* - xmlMallocAtomic
* - xmlRealloc
* - xmlMemStrdup
* - xmlFree
*/
#ifdef LIBXML_THREAD_ALLOC_ENABLED
XMLPUBFUN xmlMallocFunc *__xmlMalloc(void);
XMLPUBFUN xmlMallocFunc *__xmlMallocAtomic(void);
XMLPUBFUN xmlReallocFunc *__xmlRealloc(void);
XMLPUBFUN xmlFreeFunc *__xmlFree(void);
XMLPUBFUN xmlStrdupFunc *__xmlMemStrdup(void);
#ifndef XML_GLOBALS_NO_REDEFINITION
#define xmlMalloc (*__xmlMalloc())
#define xmlMallocAtomic (*__xmlMallocAtomic())
#define xmlRealloc (*__xmlRealloc())
#define xmlFree (*__xmlFree())
#define xmlMemStrdup (*__xmlMemStrdup())
#endif
#else
/**
* The variable holding the libxml malloc() implementation
*/
XMLPUBVAR xmlMallocFunc xmlMalloc;
/**
* The variable holding the libxml malloc() implementation for atomic
* data (i.e. blocks not containing pointers), useful when using a
* garbage collecting allocator.
*
* @deprecated Use #xmlMalloc
*/
XMLPUBVAR xmlMallocFunc xmlMallocAtomic;
/**
* The variable holding the libxml realloc() implementation
*/
XMLPUBVAR xmlReallocFunc xmlRealloc;
/**
* The variable holding the libxml free() implementation
*/
XMLPUBVAR xmlFreeFunc xmlFree;
/**
* The variable holding the libxml strdup() implementation
*/
XMLPUBVAR xmlStrdupFunc xmlMemStrdup;
#endif
/*
* The way to overload the existing functions.
* The xmlGc function have an extra entry for atomic block
* allocations useful for garbage collected memory allocators
*/
XMLPUBFUN int
xmlMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc);
XMLPUBFUN int
xmlMemGet (xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlReallocFunc *reallocFunc,
xmlStrdupFunc *strdupFunc);
XML_DEPRECATED
XMLPUBFUN int
xmlGcMemSetup (xmlFreeFunc freeFunc,
xmlMallocFunc mallocFunc,
xmlMallocFunc mallocAtomicFunc,
xmlReallocFunc reallocFunc,
xmlStrdupFunc strdupFunc);
XML_DEPRECATED
XMLPUBFUN int
xmlGcMemGet (xmlFreeFunc *freeFunc,
xmlMallocFunc *mallocFunc,
xmlMallocFunc *mallocAtomicFunc,
xmlReallocFunc *reallocFunc,
xmlStrdupFunc *strdupFunc);
/*
* Initialization of the memory layer.
*/
XML_DEPRECATED
XMLPUBFUN int
xmlInitMemory (void);
/*
* Cleanup of the memory layer.
*/
XML_DEPRECATED
XMLPUBFUN void
xmlCleanupMemory (void);
/*
* These are specific to the XML debug memory wrapper.
*/
XMLPUBFUN size_t
xmlMemSize (void *ptr);
XMLPUBFUN int
xmlMemUsed (void);
XMLPUBFUN int
xmlMemBlocks (void);
XML_DEPRECATED
XMLPUBFUN void
xmlMemDisplay (FILE *fp);
XML_DEPRECATED
XMLPUBFUN void
xmlMemDisplayLast(FILE *fp, long nbBytes);
XML_DEPRECATED
XMLPUBFUN void
xmlMemShow (FILE *fp, int nr);
XML_DEPRECATED
XMLPUBFUN void
xmlMemoryDump (void);
XMLPUBFUN void *
xmlMemMalloc (size_t size) LIBXML_ATTR_ALLOC_SIZE(1);
XMLPUBFUN void *
xmlMemRealloc (void *ptr,size_t size);
XMLPUBFUN void
xmlMemFree (void *ptr);
XMLPUBFUN char *
xmlMemoryStrdup (const char *str);
XML_DEPRECATED
XMLPUBFUN void *
xmlMallocLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XML_DEPRECATED
XMLPUBFUN void *
xmlReallocLoc (void *ptr, size_t size, const char *file, int line);
XML_DEPRECATED
XMLPUBFUN void *
xmlMallocAtomicLoc (size_t size, const char *file, int line) LIBXML_ATTR_ALLOC_SIZE(1);
XML_DEPRECATED
XMLPUBFUN char *
xmlMemStrdupLoc (const char *str, const char *file, int line);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __DEBUG_MEMORY_ALLOC__ */
+60
View File
@@ -0,0 +1,60 @@
/**
* @file
*
* @brief Dynamic module loading
*
* API for dynamic module loading. Only used by old libxslt versions
* and subject to removal.
*
* @copyright See Copyright for the status of this software.
*
* @author Joel W. Reed
*/
#ifndef __XML_MODULE_H__
#define __XML_MODULE_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_MODULES_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* A handle to a dynamically loaded module
*/
typedef struct _xmlModule xmlModule;
typedef xmlModule *xmlModulePtr;
/**
* enumeration of options that can be passed down to #xmlModuleOpen
*/
typedef enum {
XML_MODULE_LAZY = 1, /* lazy binding */
XML_MODULE_LOCAL= 2 /* local binding */
} xmlModuleOption;
XML_DEPRECATED
XMLPUBFUN xmlModule *xmlModuleOpen (const char *filename,
int options);
XML_DEPRECATED
XMLPUBFUN int xmlModuleSymbol (xmlModule *module,
const char* name,
void **result);
XML_DEPRECATED
XMLPUBFUN int xmlModuleClose (xmlModule *module);
XML_DEPRECATED
XMLPUBFUN int xmlModuleFree (xmlModule *module);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_MODULES_ENABLED */
#endif /*__XML_MODULE_H__ */
+450
View File
@@ -0,0 +1,450 @@
/**
* @file
*
* @brief the XMLReader implementation
*
* API of the XML streaming API based on C\# interfaces.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_XMLREADER_H__
#define __XML_XMLREADER_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlIO.h>
#ifdef LIBXML_RELAXNG_ENABLED
#include <libxml/relaxng.h>
#endif
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/xmlschemas.h>
#endif
#include <libxml/parser.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* How severe an error callback is when the per-reader error callback API
* is used.
*/
typedef enum {
XML_PARSER_SEVERITY_VALIDITY_WARNING = 1,
XML_PARSER_SEVERITY_VALIDITY_ERROR = 2,
XML_PARSER_SEVERITY_WARNING = 3,
XML_PARSER_SEVERITY_ERROR = 4
} xmlParserSeverities;
#ifdef LIBXML_READER_ENABLED
/**
* Internal state values for the reader.
*/
typedef enum {
XML_TEXTREADER_MODE_INITIAL = 0,
XML_TEXTREADER_MODE_INTERACTIVE = 1,
XML_TEXTREADER_MODE_ERROR = 2,
XML_TEXTREADER_MODE_EOF =3,
XML_TEXTREADER_MODE_CLOSED = 4,
XML_TEXTREADER_MODE_READING = 5
} xmlTextReaderMode;
/**
* Some common options to use with #xmlTextReaderSetParserProp, but it
* is better to use xmlParserOption and the xmlReaderNewxxx and
* xmlReaderForxxx APIs now.
*/
typedef enum {
/* load external DTD */
XML_PARSER_LOADDTD = 1,
/* use default attributes */
XML_PARSER_DEFAULTATTRS = 2,
/* DTD validation */
XML_PARSER_VALIDATE = 3,
/* substitute entities */
XML_PARSER_SUBST_ENTITIES = 4
} xmlParserProperties;
/**
* Predefined constants for the different types of nodes.
*/
typedef enum {
/** unknown or error */
XML_READER_TYPE_NONE = 0,
/** element */
XML_READER_TYPE_ELEMENT = 1,
/** attribute */
XML_READER_TYPE_ATTRIBUTE = 2,
/** text */
XML_READER_TYPE_TEXT = 3,
/** CDATA section */
XML_READER_TYPE_CDATA = 4,
/** entity reference */
XML_READER_TYPE_ENTITY_REFERENCE = 5,
/** unused */
XML_READER_TYPE_ENTITY = 6,
/** processing instruction */
XML_READER_TYPE_PROCESSING_INSTRUCTION = 7,
/** comment */
XML_READER_TYPE_COMMENT = 8,
/** document */
XML_READER_TYPE_DOCUMENT = 9,
/** unused */
XML_READER_TYPE_DOCUMENT_TYPE = 10,
/** document fragment */
XML_READER_TYPE_DOCUMENT_FRAGMENT = 11,
/** notation, unused */
XML_READER_TYPE_NOTATION = 12,
/** whitespace */
XML_READER_TYPE_WHITESPACE = 13,
/** significant whitespace */
XML_READER_TYPE_SIGNIFICANT_WHITESPACE = 14,
/** end of element */
XML_READER_TYPE_END_ELEMENT = 15,
/** unused */
XML_READER_TYPE_END_ENTITY = 16,
/** unused */
XML_READER_TYPE_XML_DECLARATION = 17
} xmlReaderTypes;
/** xmlReader context */
typedef struct _xmlTextReader xmlTextReader;
typedef xmlTextReader *xmlTextReaderPtr;
/*
* Constructors & Destructor
*/
XMLPUBFUN xmlTextReader *
xmlNewTextReader (xmlParserInputBuffer *input,
const char *URI);
XMLPUBFUN xmlTextReader *
xmlNewTextReaderFilename(const char *URI);
XMLPUBFUN void
xmlFreeTextReader (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderSetup(xmlTextReader *reader,
xmlParserInputBuffer *input, const char *URL,
const char *encoding, int options);
XMLPUBFUN void
xmlTextReaderSetMaxAmplification(xmlTextReader *reader,
unsigned maxAmpl);
XMLPUBFUN const xmlError *
xmlTextReaderGetLastError(xmlTextReader *reader);
/*
* Iterators
*/
XMLPUBFUN int
xmlTextReaderRead (xmlTextReader *reader);
#ifdef LIBXML_WRITER_ENABLED
XMLPUBFUN xmlChar *
xmlTextReaderReadInnerXml(xmlTextReader *reader);
XMLPUBFUN xmlChar *
xmlTextReaderReadOuterXml(xmlTextReader *reader);
#endif
XMLPUBFUN xmlChar *
xmlTextReaderReadString (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderReadAttributeValue(xmlTextReader *reader);
/*
* Attributes of the node
*/
XMLPUBFUN int
xmlTextReaderAttributeCount(xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderDepth (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderHasAttributes(xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderHasValue(xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderIsDefault (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderIsEmptyElement(xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderNodeType (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderQuoteChar (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderReadState (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderIsNamespaceDecl(xmlTextReader *reader);
XMLPUBFUN const xmlChar *
xmlTextReaderConstBaseUri (xmlTextReader *reader);
XMLPUBFUN const xmlChar *
xmlTextReaderConstLocalName (xmlTextReader *reader);
XMLPUBFUN const xmlChar *
xmlTextReaderConstName (xmlTextReader *reader);
XMLPUBFUN const xmlChar *
xmlTextReaderConstNamespaceUri(xmlTextReader *reader);
XMLPUBFUN const xmlChar *
xmlTextReaderConstPrefix (xmlTextReader *reader);
XMLPUBFUN const xmlChar *
xmlTextReaderConstXmlLang (xmlTextReader *reader);
XMLPUBFUN const xmlChar *
xmlTextReaderConstString (xmlTextReader *reader,
const xmlChar *str);
XMLPUBFUN const xmlChar *
xmlTextReaderConstValue (xmlTextReader *reader);
/*
* use the Const version of the routine for
* better performance and simpler code
*/
XMLPUBFUN xmlChar *
xmlTextReaderBaseUri (xmlTextReader *reader);
XMLPUBFUN xmlChar *
xmlTextReaderLocalName (xmlTextReader *reader);
XMLPUBFUN xmlChar *
xmlTextReaderName (xmlTextReader *reader);
XMLPUBFUN xmlChar *
xmlTextReaderNamespaceUri(xmlTextReader *reader);
XMLPUBFUN xmlChar *
xmlTextReaderPrefix (xmlTextReader *reader);
XMLPUBFUN xmlChar *
xmlTextReaderXmlLang (xmlTextReader *reader);
XMLPUBFUN xmlChar *
xmlTextReaderValue (xmlTextReader *reader);
/*
* Methods of the XmlTextReader
*/
XMLPUBFUN int
xmlTextReaderClose (xmlTextReader *reader);
XMLPUBFUN xmlChar *
xmlTextReaderGetAttributeNo (xmlTextReader *reader,
int no);
XMLPUBFUN xmlChar *
xmlTextReaderGetAttribute (xmlTextReader *reader,
const xmlChar *name);
XMLPUBFUN xmlChar *
xmlTextReaderGetAttributeNs (xmlTextReader *reader,
const xmlChar *localName,
const xmlChar *namespaceURI);
XMLPUBFUN xmlParserInputBuffer *
xmlTextReaderGetRemainder (xmlTextReader *reader);
XMLPUBFUN xmlChar *
xmlTextReaderLookupNamespace(xmlTextReader *reader,
const xmlChar *prefix);
XMLPUBFUN int
xmlTextReaderMoveToAttributeNo(xmlTextReader *reader,
int no);
XMLPUBFUN int
xmlTextReaderMoveToAttribute(xmlTextReader *reader,
const xmlChar *name);
XMLPUBFUN int
xmlTextReaderMoveToAttributeNs(xmlTextReader *reader,
const xmlChar *localName,
const xmlChar *namespaceURI);
XMLPUBFUN int
xmlTextReaderMoveToFirstAttribute(xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderMoveToNextAttribute(xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderMoveToElement (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderNormalization (xmlTextReader *reader);
XMLPUBFUN const xmlChar *
xmlTextReaderConstEncoding (xmlTextReader *reader);
/*
* Extensions
*/
XMLPUBFUN int
xmlTextReaderSetParserProp (xmlTextReader *reader,
int prop,
int value);
XMLPUBFUN int
xmlTextReaderGetParserProp (xmlTextReader *reader,
int prop);
XMLPUBFUN xmlNode *
xmlTextReaderCurrentNode (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderGetParserLineNumber(xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderGetParserColumnNumber(xmlTextReader *reader);
XMLPUBFUN xmlNode *
xmlTextReaderPreserve (xmlTextReader *reader);
#ifdef LIBXML_PATTERN_ENABLED
XMLPUBFUN int
xmlTextReaderPreservePattern(xmlTextReader *reader,
const xmlChar *pattern,
const xmlChar **namespaces);
#endif /* LIBXML_PATTERN_ENABLED */
XMLPUBFUN xmlDoc *
xmlTextReaderCurrentDoc (xmlTextReader *reader);
XMLPUBFUN xmlNode *
xmlTextReaderExpand (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderNext (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderNextSibling (xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderIsValid (xmlTextReader *reader);
#ifdef LIBXML_RELAXNG_ENABLED
XMLPUBFUN int
xmlTextReaderRelaxNGValidate(xmlTextReader *reader,
const char *rng);
XMLPUBFUN int
xmlTextReaderRelaxNGValidateCtxt(xmlTextReader *reader,
xmlRelaxNGValidCtxt *ctxt,
int options);
XMLPUBFUN int
xmlTextReaderRelaxNGSetSchema(xmlTextReader *reader,
xmlRelaxNG *schema);
#endif
#ifdef LIBXML_SCHEMAS_ENABLED
XMLPUBFUN int
xmlTextReaderSchemaValidate (xmlTextReader *reader,
const char *xsd);
XMLPUBFUN int
xmlTextReaderSchemaValidateCtxt(xmlTextReader *reader,
xmlSchemaValidCtxt *ctxt,
int options);
XMLPUBFUN int
xmlTextReaderSetSchema (xmlTextReader *reader,
xmlSchema *schema);
#endif
XMLPUBFUN const xmlChar *
xmlTextReaderConstXmlVersion(xmlTextReader *reader);
XMLPUBFUN int
xmlTextReaderStandalone (xmlTextReader *reader);
/*
* Index lookup
*/
XMLPUBFUN long
xmlTextReaderByteConsumed (xmlTextReader *reader);
/*
* New more complete APIs for simpler creation and reuse of readers
*/
XMLPUBFUN xmlTextReader *
xmlReaderWalker (xmlDoc *doc);
XMLPUBFUN xmlTextReader *
xmlReaderForDoc (const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReader *
xmlReaderForFile (const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlTextReader *
xmlReaderForMemory (const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReader *
xmlReaderForFd (int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN xmlTextReader *
xmlReaderForIO (xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int
xmlReaderNewWalker (xmlTextReader *reader,
xmlDoc *doc);
XMLPUBFUN int
xmlReaderNewDoc (xmlTextReader *reader,
const xmlChar * cur,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int
xmlReaderNewFile (xmlTextReader *reader,
const char *filename,
const char *encoding,
int options);
XMLPUBFUN int
xmlReaderNewMemory (xmlTextReader *reader,
const char *buffer,
int size,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int
xmlReaderNewFd (xmlTextReader *reader,
int fd,
const char *URL,
const char *encoding,
int options);
XMLPUBFUN int
xmlReaderNewIO (xmlTextReader *reader,
xmlInputReadCallback ioread,
xmlInputCloseCallback ioclose,
void *ioctx,
const char *URL,
const char *encoding,
int options);
/*
* Error handling extensions
*/
typedef void * xmlTextReaderLocatorPtr;
/**
* Signature of an error callback from a reader parser
*
* @param arg the user argument
* @param msg the message
* @param severity the severity of the error
* @param locator a locator indicating where the error occurred
*/
typedef void (*xmlTextReaderErrorFunc)(void *arg,
const char *msg,
xmlParserSeverities severity,
xmlTextReaderLocatorPtr locator);
XMLPUBFUN int
xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator);
XMLPUBFUN xmlChar *
xmlTextReaderLocatorBaseURI (xmlTextReaderLocatorPtr locator);
XMLPUBFUN void
xmlTextReaderSetErrorHandler(xmlTextReader *reader,
xmlTextReaderErrorFunc f,
void *arg);
XMLPUBFUN void
xmlTextReaderSetStructuredErrorHandler(xmlTextReader *reader,
xmlStructuredErrorFunc f,
void *arg);
XMLPUBFUN void
xmlTextReaderGetErrorHandler(xmlTextReader *reader,
xmlTextReaderErrorFunc *f,
void **arg);
XMLPUBFUN void
xmlTextReaderSetResourceLoader(xmlTextReader *reader,
xmlResourceLoader loader,
void *data);
#endif /* LIBXML_READER_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* __XML_XMLREADER_H__ */
+113
View File
@@ -0,0 +1,113 @@
/**
* @file
*
* @brief Regular expressions
*
* A regular expression engine used for DTD and XML Schema
* validation.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_REGEXP_H__
#define __XML_REGEXP_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlstring.h>
#ifdef LIBXML_REGEXP_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* A libxml regular expression
*/
typedef struct _xmlRegexp xmlRegexp;
typedef xmlRegexp *xmlRegexpPtr;
/**
* A libxml progressive regular expression evaluation context
*/
typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
/*
* The POSIX like API
*/
XMLPUBFUN xmlRegexp *
xmlRegexpCompile (const xmlChar *regexp);
XMLPUBFUN void xmlRegFreeRegexp(xmlRegexp *regexp);
XMLPUBFUN int
xmlRegexpExec (xmlRegexp *comp,
const xmlChar *value);
XML_DEPRECATED
XMLPUBFUN void
xmlRegexpPrint (FILE *output,
xmlRegexp *regexp);
XMLPUBFUN int
xmlRegexpIsDeterminist(xmlRegexp *comp);
/**
* Callback function when doing a transition in the automata
*
* @param exec the regular expression context
* @param token the current token string
* @param transdata transition data
* @param inputdata input data
*/
typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxt *exec,
const xmlChar *token,
void *transdata,
void *inputdata);
/*
* The progressive API
*/
XML_DEPRECATED
XMLPUBFUN xmlRegExecCtxt *
xmlRegNewExecCtxt (xmlRegexp *comp,
xmlRegExecCallbacks callback,
void *data);
XML_DEPRECATED
XMLPUBFUN void
xmlRegFreeExecCtxt (xmlRegExecCtxt *exec);
XML_DEPRECATED
XMLPUBFUN int
xmlRegExecPushString(xmlRegExecCtxt *exec,
const xmlChar *value,
void *data);
XML_DEPRECATED
XMLPUBFUN int
xmlRegExecPushString2(xmlRegExecCtxt *exec,
const xmlChar *value,
const xmlChar *value2,
void *data);
XML_DEPRECATED
XMLPUBFUN int
xmlRegExecNextValues(xmlRegExecCtxt *exec,
int *nbval,
int *nbneg,
xmlChar **values,
int *terminal);
XML_DEPRECATED
XMLPUBFUN int
xmlRegExecErrInfo (xmlRegExecCtxt *exec,
const xmlChar **string,
int *nbval,
int *nbneg,
xmlChar **values,
int *terminal);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_REGEXP_ENABLED */
#endif /*__XML_REGEXP_H__ */
+156
View File
@@ -0,0 +1,156 @@
/**
* @file
*
* @brief XML/HTML serializer
*
* API to save documents or subtrees of documents.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_XMLSAVE_H__
#define __XML_XMLSAVE_H__
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#include <libxml/encoding.h>
#include <libxml/xmlIO.h>
#ifdef LIBXML_OUTPUT_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* This is the set of XML save options that can be passed down
* to the #xmlSaveToFd and similar calls.
*/
typedef enum {
/**
* Format output. This adds newlines and enables indenting
* by default.
*/
XML_SAVE_FORMAT = 1<<0,
/**
* Don't emit an XML declaration.
*/
XML_SAVE_NO_DECL = 1<<1,
/**
* Don't emit empty tags.
*/
XML_SAVE_NO_EMPTY = 1<<2,
/**
* Don't serialize as XHTML.
*/
XML_SAVE_NO_XHTML = 1<<3,
/**
* Always serialize as XHTML.
*/
XML_SAVE_XHTML = 1<<4,
/**
* Serialize HTML documents as XML.
*/
XML_SAVE_AS_XML = 1<<5,
/**
* Serialize XML documents as HTML.
*/
XML_SAVE_AS_HTML = 1<<6,
/**
* Format with non-significant whitespace.
* TODO: What does this mean?
*/
XML_SAVE_WSNONSIG = 1<<7,
/**
* Always emit empty tags. This is the default unless the
* deprecated thread-local setting xmlSaveNoEmptyTags is
* set to 1.
*
* @since 2.14
*/
XML_SAVE_EMPTY = 1<<8,
/**
* Don't indent output when formatting.
*
* @since 2.14
*/
XML_SAVE_NO_INDENT = 1<<9,
/**
* Always indent output when formatting. This is the default
* unless the deprecated thread-local setting
* xmlIndentTreeOutput is set to 0.
*
* @since 2.14
*/
XML_SAVE_INDENT = 1<<10
} xmlSaveOption;
/** XML and HTML serializer */
typedef struct _xmlSaveCtxt xmlSaveCtxt;
typedef xmlSaveCtxt *xmlSaveCtxtPtr;
XMLPUBFUN xmlSaveCtxt *
xmlSaveToFd (int fd,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxt *
xmlSaveToFilename (const char *filename,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxt *
xmlSaveToBuffer (xmlBuffer *buffer,
const char *encoding,
int options);
XMLPUBFUN xmlSaveCtxt *
xmlSaveToIO (xmlOutputWriteCallback iowrite,
xmlOutputCloseCallback ioclose,
void *ioctx,
const char *encoding,
int options);
XMLPUBFUN long
xmlSaveDoc (xmlSaveCtxt *ctxt,
xmlDoc *doc);
XMLPUBFUN long
xmlSaveTree (xmlSaveCtxt *ctxt,
xmlNode *node);
XMLPUBFUN int
xmlSaveFlush (xmlSaveCtxt *ctxt);
XMLPUBFUN int
xmlSaveClose (xmlSaveCtxt *ctxt);
XMLPUBFUN xmlParserErrors
xmlSaveFinish (xmlSaveCtxt *ctxt);
XMLPUBFUN int
xmlSaveSetIndentString (xmlSaveCtxt *ctxt,
const char *indent);
XML_DEPRECATED
XMLPUBFUN int
xmlSaveSetEscape (xmlSaveCtxt *ctxt,
xmlCharEncodingOutputFunc escape);
XML_DEPRECATED
XMLPUBFUN int
xmlSaveSetAttrEscape (xmlSaveCtxt *ctxt,
xmlCharEncodingOutputFunc escape);
XML_DEPRECATED
XMLPUBFUN int
xmlThrDefIndentTreeOutput(int v);
XML_DEPRECATED
XMLPUBFUN const char *
xmlThrDefTreeIndentString(const char * v);
XML_DEPRECATED
XMLPUBFUN int
xmlThrDefSaveNoEmptyTags(int v);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_OUTPUT_ENABLED */
#endif /* __XML_XMLSAVE_H__ */
+248
View File
@@ -0,0 +1,248 @@
/**
* @file
*
* @brief incomplete XML Schemas structure implementation
*
* interface to the XML Schemas handling and schema validity
* checking, it is incomplete right now.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_SCHEMA_H__
#define __XML_SCHEMA_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <stdio.h>
#include <libxml/encoding.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xmlerror.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* This error codes are obsolete; not used any more.
*/
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_VALUE,
XML_SCHEMAS_ERR_FACET,
XML_SCHEMAS_ERR_,
XML_SCHEMAS_ERR_XXX
} xmlSchemaValidError;
/*
* ATTENTION: Change xmlSchemaSetValidOptions's check
* for invalid values, if adding to the validation
* options below.
*/
/**
* This is the set of XML Schema validation options.
*/
typedef enum {
XML_SCHEMA_VAL_VC_I_CREATE = 1<<0
/* Default/fixed: create an attribute node
* or an element's text node on the instance.
*/
} xmlSchemaValidOption;
/*
XML_SCHEMA_VAL_XSI_ASSEMBLE = 1<<1,
* assemble schemata using
* xsi:schemaLocation and
* xsi:noNamespaceSchemaLocation
*/
/** XML schema */
typedef struct _xmlSchema xmlSchema;
typedef xmlSchema *xmlSchemaPtr;
/**
* Signature of an error callback from an XSD validation
*
* @param ctx the validation context
* @param msg the message
* @param ... extra arguments
*/
typedef void (*xmlSchemaValidityErrorFunc)
(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/**
* Signature of a warning callback from an XSD validation
*
* @param ctx the validation context
* @param msg the message
* @param ... extra arguments
*/
typedef void (*xmlSchemaValidityWarningFunc)
(void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
/** Schema parser context */
typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
/** Schema validation context */
typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
/**
* A schemas validation locator, a callback called by the validator.
* This is used when file or node information are not available
* to find out what file and line number are affected
*
* @param ctx user provided context
* @param file returned file information
* @param line returned line information
* @returns 0 in case of success and -1 in case of error
*/
typedef int (*xmlSchemaValidityLocatorFunc) (void *ctx,
const char **file, unsigned long *line);
/*
* Interfaces for parsing.
*/
XMLPUBFUN xmlSchemaParserCtxt *
xmlSchemaNewParserCtxt (const char *URL);
XMLPUBFUN xmlSchemaParserCtxt *
xmlSchemaNewMemParserCtxt (const char *buffer,
int size);
XMLPUBFUN xmlSchemaParserCtxt *
xmlSchemaNewDocParserCtxt (xmlDoc *doc);
XMLPUBFUN void
xmlSchemaFreeParserCtxt (xmlSchemaParserCtxt *ctxt);
XMLPUBFUN void
xmlSchemaSetParserErrors (xmlSchemaParserCtxt *ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void *ctx);
XMLPUBFUN void
xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxt *ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN int
xmlSchemaGetParserErrors (xmlSchemaParserCtxt *ctxt,
xmlSchemaValidityErrorFunc * err,
xmlSchemaValidityWarningFunc * warn,
void **ctx);
XMLPUBFUN void
xmlSchemaSetResourceLoader (xmlSchemaParserCtxt *ctxt,
xmlResourceLoader loader,
void *data);
XMLPUBFUN int
xmlSchemaIsValid (xmlSchemaValidCtxt *ctxt);
XMLPUBFUN xmlSchema *
xmlSchemaParse (xmlSchemaParserCtxt *ctxt);
XMLPUBFUN void
xmlSchemaFree (xmlSchema *schema);
#ifdef LIBXML_DEBUG_ENABLED
XMLPUBFUN void
xmlSchemaDump (FILE *output,
xmlSchema *schema);
#endif /* LIBXML_DEBUG_ENABLED */
/*
* Interfaces for validating
*/
XMLPUBFUN void
xmlSchemaSetValidErrors (xmlSchemaValidCtxt *ctxt,
xmlSchemaValidityErrorFunc err,
xmlSchemaValidityWarningFunc warn,
void *ctx);
XMLPUBFUN void
xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxt *ctxt,
xmlStructuredErrorFunc serror,
void *ctx);
XMLPUBFUN int
xmlSchemaGetValidErrors (xmlSchemaValidCtxt *ctxt,
xmlSchemaValidityErrorFunc *err,
xmlSchemaValidityWarningFunc *warn,
void **ctx);
XMLPUBFUN int
xmlSchemaSetValidOptions (xmlSchemaValidCtxt *ctxt,
int options);
XMLPUBFUN void
xmlSchemaValidateSetFilename(xmlSchemaValidCtxt *vctxt,
const char *filename);
XMLPUBFUN int
xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxt *ctxt);
XMLPUBFUN xmlSchemaValidCtxt *
xmlSchemaNewValidCtxt (xmlSchema *schema);
XMLPUBFUN void
xmlSchemaFreeValidCtxt (xmlSchemaValidCtxt *ctxt);
XMLPUBFUN int
xmlSchemaValidateDoc (xmlSchemaValidCtxt *ctxt,
xmlDoc *instance);
XMLPUBFUN int
xmlSchemaValidateOneElement (xmlSchemaValidCtxt *ctxt,
xmlNode *elem);
XMLPUBFUN int
xmlSchemaValidateStream (xmlSchemaValidCtxt *ctxt,
xmlParserInputBuffer *input,
xmlCharEncoding enc,
const xmlSAXHandler *sax,
void *user_data);
XMLPUBFUN int
xmlSchemaValidateFile (xmlSchemaValidCtxt *ctxt,
const char * filename,
int options);
XMLPUBFUN xmlParserCtxt *
xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxt *ctxt);
/**
* Interface to insert Schemas SAX validation in a SAX stream
*/
typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
XMLPUBFUN xmlSchemaSAXPlugStruct *
xmlSchemaSAXPlug (xmlSchemaValidCtxt *ctxt,
xmlSAXHandler **sax,
void **user_data);
XMLPUBFUN int
xmlSchemaSAXUnplug (xmlSchemaSAXPlugStruct *plug);
XMLPUBFUN void
xmlSchemaValidateSetLocator (xmlSchemaValidCtxt *vctxt,
xmlSchemaValidityLocatorFunc f,
void *ctxt);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_H__ */
+158
View File
@@ -0,0 +1,158 @@
/**
* @file
*
* @brief implementation of XML Schema Datatypes
*
* module providing the XML Schema Datatypes implementation
* both definition and validity checking
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_SCHEMA_TYPES_H__
#define __XML_SCHEMA_TYPES_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_SCHEMAS_ENABLED
#include <libxml/schemasInternals.h>
#include <libxml/xmlschemas.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Schema whitespace value type
*/
typedef enum {
XML_SCHEMA_WHITESPACE_UNKNOWN = 0,
XML_SCHEMA_WHITESPACE_PRESERVE = 1,
XML_SCHEMA_WHITESPACE_REPLACE = 2,
XML_SCHEMA_WHITESPACE_COLLAPSE = 3
} xmlSchemaWhitespaceValueType;
XMLPUBFUN int
xmlSchemaInitTypes (void);
XML_DEPRECATED
XMLPUBFUN void
xmlSchemaCleanupTypes (void);
XMLPUBFUN xmlSchemaType *
xmlSchemaGetPredefinedType (const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN int
xmlSchemaValidatePredefinedType (xmlSchemaType *type,
const xmlChar *value,
xmlSchemaVal **val);
XMLPUBFUN int
xmlSchemaValPredefTypeNode (xmlSchemaType *type,
const xmlChar *value,
xmlSchemaVal **val,
xmlNode *node);
XMLPUBFUN int
xmlSchemaValidateFacet (xmlSchemaType *base,
xmlSchemaFacet *facet,
const xmlChar *value,
xmlSchemaVal *val);
XMLPUBFUN int
xmlSchemaValidateFacetWhtsp (xmlSchemaFacet *facet,
xmlSchemaWhitespaceValueType fws,
xmlSchemaValType valType,
const xmlChar *value,
xmlSchemaVal *val,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN void
xmlSchemaFreeValue (xmlSchemaVal *val);
XMLPUBFUN xmlSchemaFacet *
xmlSchemaNewFacet (void);
XMLPUBFUN int
xmlSchemaCheckFacet (xmlSchemaFacet *facet,
xmlSchemaType *typeDecl,
xmlSchemaParserCtxt *ctxt,
const xmlChar *name);
XMLPUBFUN void
xmlSchemaFreeFacet (xmlSchemaFacet *facet);
XMLPUBFUN int
xmlSchemaCompareValues (xmlSchemaVal *x,
xmlSchemaVal *y);
XMLPUBFUN xmlSchemaType *
xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaType *type);
XMLPUBFUN int
xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacet *facet,
const xmlChar *value,
unsigned long actualLen,
unsigned long *expectedLen);
XMLPUBFUN xmlSchemaType *
xmlSchemaGetBuiltInType (xmlSchemaValType type);
XMLPUBFUN int
xmlSchemaIsBuiltInTypeFacet (xmlSchemaType *type,
int facetType);
XMLPUBFUN xmlChar *
xmlSchemaCollapseString (const xmlChar *value);
XMLPUBFUN xmlChar *
xmlSchemaWhiteSpaceReplace (const xmlChar *value);
XMLPUBFUN unsigned long
xmlSchemaGetFacetValueAsULong (xmlSchemaFacet *facet);
XMLPUBFUN int
xmlSchemaValidateLengthFacet (xmlSchemaType *type,
xmlSchemaFacet *facet,
const xmlChar *value,
xmlSchemaVal *val,
unsigned long *length);
XMLPUBFUN int
xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacet *facet,
xmlSchemaValType valType,
const xmlChar *value,
xmlSchemaVal *val,
unsigned long *length,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN int
xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaType *type,
const xmlChar *value,
xmlSchemaVal **val,
xmlNode *node);
XMLPUBFUN int
xmlSchemaGetCanonValue (xmlSchemaVal *val,
const xmlChar **retValue);
XMLPUBFUN int
xmlSchemaGetCanonValueWhtsp (xmlSchemaVal *val,
const xmlChar **retValue,
xmlSchemaWhitespaceValueType ws);
XMLPUBFUN int
xmlSchemaValueAppend (xmlSchemaVal *prev,
xmlSchemaVal *cur);
XMLPUBFUN xmlSchemaVal *
xmlSchemaValueGetNext (xmlSchemaVal *cur);
XMLPUBFUN const xmlChar *
xmlSchemaValueGetAsString (xmlSchemaVal *val);
XMLPUBFUN int
xmlSchemaValueGetAsBoolean (xmlSchemaVal *val);
XMLPUBFUN xmlSchemaVal *
xmlSchemaNewStringValue (xmlSchemaValType type,
const xmlChar *value);
XMLPUBFUN xmlSchemaVal *
xmlSchemaNewNOTATIONValue (const xmlChar *name,
const xmlChar *ns);
XMLPUBFUN xmlSchemaVal *
xmlSchemaNewQNameValue (const xmlChar *namespaceName,
const xmlChar *localName);
XMLPUBFUN int
xmlSchemaCompareValuesWhtsp (xmlSchemaVal *x,
xmlSchemaWhitespaceValueType xws,
xmlSchemaVal *y,
xmlSchemaWhitespaceValueType yws);
XMLPUBFUN xmlSchemaVal *
xmlSchemaCopyValue (xmlSchemaVal *val);
XMLPUBFUN xmlSchemaValType
xmlSchemaGetValType (xmlSchemaVal *val);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_SCHEMAS_ENABLED */
#endif /* __XML_SCHEMA_TYPES_H__ */
+139
View File
@@ -0,0 +1,139 @@
/**
* @file
*
* @brief set of routines to process strings
*
* type and interfaces needed for the internal string handling
* of the library, especially UTF8 processing.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_STRING_H__
#define __XML_STRING_H__
#include <stdarg.h>
#include <libxml/xmlversion.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* 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;
/**
* Macro to cast a string to an xmlChar * when one know its safe.
*/
#define BAD_CAST (xmlChar *)
/*
* xmlChar handling
*/
XMLPUBFUN xmlChar *
xmlStrdup (const xmlChar *cur);
XMLPUBFUN xmlChar *
xmlStrndup (const xmlChar *cur,
int len);
XMLPUBFUN xmlChar *
xmlCharStrndup (const char *cur,
int len);
XMLPUBFUN xmlChar *
xmlCharStrdup (const char *cur);
XMLPUBFUN xmlChar *
xmlStrsub (const xmlChar *str,
int start,
int len);
XMLPUBFUN const xmlChar *
xmlStrchr (const xmlChar *str,
xmlChar val);
XMLPUBFUN const xmlChar *
xmlStrstr (const xmlChar *str,
const xmlChar *val);
XMLPUBFUN const xmlChar *
xmlStrcasestr (const xmlChar *str,
const xmlChar *val);
XMLPUBFUN int
xmlStrcmp (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int
xmlStrncmp (const xmlChar *str1,
const xmlChar *str2,
int len);
XMLPUBFUN int
xmlStrcasecmp (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int
xmlStrncasecmp (const xmlChar *str1,
const xmlChar *str2,
int len);
XMLPUBFUN int
xmlStrEqual (const xmlChar *str1,
const xmlChar *str2);
XMLPUBFUN int
xmlStrQEqual (const xmlChar *pref,
const xmlChar *name,
const xmlChar *str);
XMLPUBFUN int
xmlStrlen (const xmlChar *str);
XMLPUBFUN xmlChar *
xmlStrcat (xmlChar *cur,
const xmlChar *add);
XMLPUBFUN xmlChar *
xmlStrncat (xmlChar *cur,
const xmlChar *add,
int len);
XMLPUBFUN xmlChar *
xmlStrncatNew (const xmlChar *str1,
const xmlChar *str2,
int len);
XMLPUBFUN int
xmlStrPrintf (xmlChar *buf,
int len,
const char *msg,
...) LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int
xmlStrVPrintf (xmlChar *buf,
int len,
const char *msg,
va_list ap) LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int
xmlGetUTF8Char (const unsigned char *utf,
int *len);
XMLPUBFUN int
xmlCheckUTF8 (const unsigned char *utf);
XMLPUBFUN int
xmlUTF8Strsize (const xmlChar *utf,
int len);
XMLPUBFUN xmlChar *
xmlUTF8Strndup (const xmlChar *utf,
int len);
XMLPUBFUN const xmlChar *
xmlUTF8Strpos (const xmlChar *utf,
int pos);
XMLPUBFUN int
xmlUTF8Strloc (const xmlChar *utf,
const xmlChar *utfchar);
XMLPUBFUN xmlChar *
xmlUTF8Strsub (const xmlChar *utf,
int start,
int len);
XMLPUBFUN int
xmlUTF8Strlen (const xmlChar *utf);
XMLPUBFUN int
xmlUTF8Size (const xmlChar *utf);
XMLPUBFUN int
xmlUTF8Charcmp (const xmlChar *utf1,
const xmlChar *utf2);
#ifdef __cplusplus
}
#endif
#endif /* __XML_STRING_H__ */
+18
View File
@@ -0,0 +1,18 @@
/**
* @file
*
* @brief Unicode character APIs
*
* API for the Unicode character APIs
*
* Deprecated, don't use.
*/
#ifndef __XML_UNICODE_H__
#define __XML_UNICODE_H__
#ifdef __GNUC__
#warning "libxml/xmlunicode.h is deprecated"
#endif
#endif /* __XML_UNICODE_H__ */
+262
View File
@@ -0,0 +1,262 @@
/**
* @file
*
* @brief compile-time version information
*
* compile-time version information for the XML library
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_VERSION_H__
#define __XML_VERSION_H__
/**
* the version string like "1.2.3"
*/
#define LIBXML_DOTTED_VERSION "@VERSION@"
/**
* the version number: 1.2.3 value is 10203
*/
#define LIBXML_VERSION @LIBXML_VERSION_NUMBER@
/**
* the version number string, 1.2.3 value is "10203"
*/
#define LIBXML_VERSION_STRING "@LIBXML_VERSION_NUMBER@"
/**
* extra version information, used to show a git commit description
*/
#define LIBXML_VERSION_EXTRA "@LIBXML_VERSION_EXTRA@"
/**
* 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(@LIBXML_VERSION_NUMBER@);
#if @WITH_THREADS@
/**
* Whether the thread support is configured in
*/
#define LIBXML_THREAD_ENABLED
#endif
#if @WITH_THREAD_ALLOC@
/**
* Whether the allocation hooks are per-thread
*/
#define LIBXML_THREAD_ALLOC_ENABLED
#endif
/**
* Always enabled since 2.14.0
*/
#define LIBXML_TREE_ENABLED
#if @WITH_OUTPUT@
/**
* Whether the serialization/saving support is configured in
*/
#define LIBXML_OUTPUT_ENABLED
#endif
#if @WITH_PUSH@
/**
* Whether the push parsing interfaces are configured in
*/
#define LIBXML_PUSH_ENABLED
#endif
#if @WITH_READER@
/**
* Whether the xmlReader parsing interface is configured in
*/
#define LIBXML_READER_ENABLED
#endif
#if @WITH_PATTERN@
/**
* Whether the xmlPattern node selection interface is configured in
*/
#define LIBXML_PATTERN_ENABLED
#endif
#if @WITH_WRITER@
/**
* Whether the xmlWriter saving interface is configured in
*/
#define LIBXML_WRITER_ENABLED
#endif
#if @WITH_SAX1@
/**
* Whether the older SAX1 interface is configured in
*/
#define LIBXML_SAX1_ENABLED
#endif
#if @WITH_HTTP@
/**
* HTTP support was removed in 2.15
*/
#define LIBXML_HTTP_STUBS_ENABLED
#endif
#if @WITH_VALID@
/**
* Whether the DTD validation support is configured in
*/
#define LIBXML_VALID_ENABLED
#endif
#if @WITH_HTML@
/**
* Whether the HTML support is configured in
*/
#define LIBXML_HTML_ENABLED
#endif
/*
* Removed in 2.14
*/
#undef LIBXML_LEGACY_ENABLED
#if @WITH_C14N@
/**
* Whether the Canonicalization support is configured in
*/
#define LIBXML_C14N_ENABLED
#endif
#if @WITH_CATALOG@
/**
* Whether the Catalog support is configured in
*/
#define LIBXML_CATALOG_ENABLED
#define LIBXML_SGML_CATALOG_ENABLED
#endif
#if @WITH_WINPATH@
/**
* Whether the Windows path support is configured in
*/
#define LIBXML_WINPATH_ENABLED
#endif
#if @WITH_XPATH@
/**
* Whether XPath is configured in
*/
#define LIBXML_XPATH_ENABLED
#endif
#if @WITH_XPTR@
/**
* Whether XPointer is configured in
*/
#define LIBXML_XPTR_ENABLED
#endif
#if @WITH_XINCLUDE@
/**
* Whether XInclude is configured in
*/
#define LIBXML_XINCLUDE_ENABLED
#endif
#if @WITH_ICONV@
/**
* Whether iconv support is available
*/
#define LIBXML_ICONV_ENABLED
#endif
#if @WITH_ICU@
/**
* Whether icu support is available
*/
#define LIBXML_ICU_ENABLED
#endif
#if @WITH_ISO8859X@
/**
* Whether ISO-8859-* support is made available in case iconv is not
*/
#define LIBXML_ISO8859X_ENABLED
#endif
#if @WITH_DEBUG@
/**
* Whether Debugging module is configured in
*/
#define LIBXML_DEBUG_ENABLED
#endif
/*
* Removed in 2.14
*/
#undef LIBXML_UNICODE_ENABLED
#if @WITH_REGEXPS@
/**
* Whether the regular expressions interfaces are compiled in
*/
#define LIBXML_REGEXP_ENABLED
#endif
#if @WITH_REGEXPS@
/**
* Whether the automata interfaces are compiled in
*/
#define LIBXML_AUTOMATA_ENABLED
#endif
#if @WITH_RELAXNG@
/**
* Whether the RelaxNG validation interfaces are compiled in
*/
#define LIBXML_RELAXNG_ENABLED
#endif
#if @WITH_SCHEMAS@
/**
* Whether the Schemas validation interfaces are compiled in
*/
#define LIBXML_SCHEMAS_ENABLED
#endif
#if @WITH_SCHEMATRON@
/**
* Whether the Schematron validation interfaces are compiled in
*/
#define LIBXML_SCHEMATRON_ENABLED
#endif
#if @WITH_MODULES@
/**
* Whether the module interfaces are compiled in
*/
#define LIBXML_MODULES_ENABLED
/**
* the string suffix used by dynamic modules (usually shared libraries)
*/
#define LIBXML_MODULE_EXTENSION "@MODULE_EXTENSION@"
#endif
#if @WITH_ZLIB@
/**
* Whether the Zlib support is compiled in
*/
#define LIBXML_ZLIB_ENABLED
#endif
#include <libxml/xmlexports.h>
#endif
+489
View File
@@ -0,0 +1,489 @@
/**
* @file
*
* @brief text writing API for XML
*
* text writing API for XML
*
* @copyright See Copyright for the status of this software.
*
* @author Alfred Mickautsch
*/
#ifndef __XML_XMLWRITER_H__
#define __XML_XMLWRITER_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_WRITER_ENABLED
#include <stdarg.h>
#include <libxml/xmlIO.h>
#include <libxml/list.h>
#include <libxml/xmlstring.h>
#ifdef __cplusplus
extern "C" {
#endif
/** Writer object */
typedef struct _xmlTextWriter xmlTextWriter;
typedef xmlTextWriter *xmlTextWriterPtr;
/*
* Constructors & Destructor
*/
XMLPUBFUN xmlTextWriter *
xmlNewTextWriter(xmlOutputBuffer *out);
XMLPUBFUN xmlTextWriter *
xmlNewTextWriterFilename(const char *uri, int compression);
XMLPUBFUN xmlTextWriter *
xmlNewTextWriterMemory(xmlBuffer *buf, int compression);
XMLPUBFUN xmlTextWriter *
xmlNewTextWriterPushParser(xmlParserCtxt *ctxt, int compression);
XMLPUBFUN xmlTextWriter *
xmlNewTextWriterDoc(xmlDoc ** doc, int compression);
XMLPUBFUN xmlTextWriter *
xmlNewTextWriterTree(xmlDoc *doc, xmlNode *node,
int compression);
XMLPUBFUN void xmlFreeTextWriter(xmlTextWriter *writer);
/*
* Functions
*/
/*
* Document
*/
XMLPUBFUN int
xmlTextWriterStartDocument(xmlTextWriter *writer,
const char *version,
const char *encoding,
const char *standalone);
XMLPUBFUN int xmlTextWriterEndDocument(xmlTextWriter *
writer);
/*
* Comments
*/
XMLPUBFUN int xmlTextWriterStartComment(xmlTextWriter *
writer);
XMLPUBFUN int xmlTextWriterEndComment(xmlTextWriter *writer);
XMLPUBFUN int
xmlTextWriterWriteFormatComment(xmlTextWriter *writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int
xmlTextWriterWriteVFormatComment(xmlTextWriter *writer,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int xmlTextWriterWriteComment(xmlTextWriter *
writer,
const xmlChar *
content);
/*
* Elements
*/
XMLPUBFUN int
xmlTextWriterStartElement(xmlTextWriter *writer,
const xmlChar * name);
XMLPUBFUN int xmlTextWriterStartElementNS(xmlTextWriter *
writer,
const xmlChar *
prefix,
const xmlChar * name,
const xmlChar *
namespaceURI);
XMLPUBFUN int xmlTextWriterEndElement(xmlTextWriter *writer);
XMLPUBFUN int xmlTextWriterFullEndElement(xmlTextWriter *
writer);
/*
* Elements conveniency functions
*/
XMLPUBFUN int
xmlTextWriterWriteFormatElement(xmlTextWriter *writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int
xmlTextWriterWriteVFormatElement(xmlTextWriter *writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int xmlTextWriterWriteElement(xmlTextWriter *
writer,
const xmlChar * name,
const xmlChar *
content);
XMLPUBFUN int
xmlTextWriterWriteFormatElementNS(xmlTextWriter *writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int
xmlTextWriterWriteVFormatElementNS(xmlTextWriter *writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int xmlTextWriterWriteElementNS(xmlTextWriter *
writer,
const xmlChar *
prefix,
const xmlChar * name,
const xmlChar *
namespaceURI,
const xmlChar *
content);
/*
* Text
*/
XMLPUBFUN int
xmlTextWriterWriteFormatRaw(xmlTextWriter *writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int
xmlTextWriterWriteVFormatRaw(xmlTextWriter *writer,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int
xmlTextWriterWriteRawLen(xmlTextWriter *writer,
const xmlChar * content, int len);
XMLPUBFUN int
xmlTextWriterWriteRaw(xmlTextWriter *writer,
const xmlChar * content);
XMLPUBFUN int xmlTextWriterWriteFormatString(xmlTextWriter *
writer,
const char
*format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int xmlTextWriterWriteVFormatString(xmlTextWriter *
writer,
const char
*format,
va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int xmlTextWriterWriteString(xmlTextWriter *writer,
const xmlChar *
content);
XMLPUBFUN int xmlTextWriterWriteBase64(xmlTextWriter *writer,
const char *data,
int start, int len);
XMLPUBFUN int xmlTextWriterWriteBinHex(xmlTextWriter *writer,
const char *data,
int start, int len);
/*
* Attributes
*/
XMLPUBFUN int
xmlTextWriterStartAttribute(xmlTextWriter *writer,
const xmlChar * name);
XMLPUBFUN int xmlTextWriterStartAttributeNS(xmlTextWriter *
writer,
const xmlChar *
prefix,
const xmlChar *
name,
const xmlChar *
namespaceURI);
XMLPUBFUN int xmlTextWriterEndAttribute(xmlTextWriter *
writer);
/*
* Attributes conveniency functions
*/
XMLPUBFUN int
xmlTextWriterWriteFormatAttribute(xmlTextWriter *writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int
xmlTextWriterWriteVFormatAttribute(xmlTextWriter *writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int xmlTextWriterWriteAttribute(xmlTextWriter *
writer,
const xmlChar * name,
const xmlChar *
content);
XMLPUBFUN int
xmlTextWriterWriteFormatAttributeNS(xmlTextWriter *writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int
xmlTextWriterWriteVFormatAttributeNS(xmlTextWriter *writer,
const xmlChar * prefix,
const xmlChar * name,
const xmlChar * namespaceURI,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int xmlTextWriterWriteAttributeNS(xmlTextWriter *
writer,
const xmlChar *
prefix,
const xmlChar *
name,
const xmlChar *
namespaceURI,
const xmlChar *
content);
/*
* PI's
*/
XMLPUBFUN int
xmlTextWriterStartPI(xmlTextWriter *writer,
const xmlChar * target);
XMLPUBFUN int xmlTextWriterEndPI(xmlTextWriter *writer);
/*
* PI conveniency functions
*/
XMLPUBFUN int
xmlTextWriterWriteFormatPI(xmlTextWriter *writer,
const xmlChar * target,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int
xmlTextWriterWriteVFormatPI(xmlTextWriter *writer,
const xmlChar * target,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int
xmlTextWriterWritePI(xmlTextWriter *writer,
const xmlChar * target,
const xmlChar * content);
/**
* This macro maps to #xmlTextWriterWritePI
*/
#define xmlTextWriterWriteProcessingInstruction xmlTextWriterWritePI
/*
* CDATA
*/
XMLPUBFUN int xmlTextWriterStartCDATA(xmlTextWriter *writer);
XMLPUBFUN int xmlTextWriterEndCDATA(xmlTextWriter *writer);
/*
* CDATA conveniency functions
*/
XMLPUBFUN int
xmlTextWriterWriteFormatCDATA(xmlTextWriter *writer,
const char *format, ...)
LIBXML_ATTR_FORMAT(2,3);
XMLPUBFUN int
xmlTextWriterWriteVFormatCDATA(xmlTextWriter *writer,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(2,0);
XMLPUBFUN int
xmlTextWriterWriteCDATA(xmlTextWriter *writer,
const xmlChar * content);
/*
* DTD
*/
XMLPUBFUN int
xmlTextWriterStartDTD(xmlTextWriter *writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid);
XMLPUBFUN int xmlTextWriterEndDTD(xmlTextWriter *writer);
/*
* DTD conveniency functions
*/
XMLPUBFUN int
xmlTextWriterWriteFormatDTD(xmlTextWriter *writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char *format, ...)
LIBXML_ATTR_FORMAT(5,6);
XMLPUBFUN int
xmlTextWriterWriteVFormatDTD(xmlTextWriter *writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const char *format, va_list argptr)
LIBXML_ATTR_FORMAT(5,0);
XMLPUBFUN int
xmlTextWriterWriteDTD(xmlTextWriter *writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * subset);
/**
* this macro maps to #xmlTextWriterWriteDTD
*/
#define xmlTextWriterWriteDocType xmlTextWriterWriteDTD
/*
* DTD element definition
*/
XMLPUBFUN int
xmlTextWriterStartDTDElement(xmlTextWriter *writer,
const xmlChar * name);
XMLPUBFUN int xmlTextWriterEndDTDElement(xmlTextWriter *
writer);
/*
* DTD element definition conveniency functions
*/
XMLPUBFUN int
xmlTextWriterWriteFormatDTDElement(xmlTextWriter *writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int
xmlTextWriterWriteVFormatDTDElement(xmlTextWriter *writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int xmlTextWriterWriteDTDElement(xmlTextWriter *
writer,
const xmlChar *
name,
const xmlChar *
content);
/*
* DTD attribute list definition
*/
XMLPUBFUN int
xmlTextWriterStartDTDAttlist(xmlTextWriter *writer,
const xmlChar * name);
XMLPUBFUN int xmlTextWriterEndDTDAttlist(xmlTextWriter *
writer);
/*
* DTD attribute list definition conveniency functions
*/
XMLPUBFUN int
xmlTextWriterWriteFormatDTDAttlist(xmlTextWriter *writer,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(3,4);
XMLPUBFUN int
xmlTextWriterWriteVFormatDTDAttlist(xmlTextWriter *writer,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(3,0);
XMLPUBFUN int xmlTextWriterWriteDTDAttlist(xmlTextWriter *
writer,
const xmlChar *
name,
const xmlChar *
content);
/*
* DTD entity definition
*/
XMLPUBFUN int
xmlTextWriterStartDTDEntity(xmlTextWriter *writer,
int pe, const xmlChar * name);
XMLPUBFUN int xmlTextWriterEndDTDEntity(xmlTextWriter *
writer);
/*
* DTD entity definition conveniency functions
*/
XMLPUBFUN int
xmlTextWriterWriteFormatDTDInternalEntity(xmlTextWriter *writer,
int pe,
const xmlChar * name,
const char *format, ...)
LIBXML_ATTR_FORMAT(4,5);
XMLPUBFUN int
xmlTextWriterWriteVFormatDTDInternalEntity(xmlTextWriter *writer,
int pe,
const xmlChar * name,
const char *format,
va_list argptr)
LIBXML_ATTR_FORMAT(4,0);
XMLPUBFUN int
xmlTextWriterWriteDTDInternalEntity(xmlTextWriter *writer,
int pe,
const xmlChar * name,
const xmlChar * content);
XMLPUBFUN int
xmlTextWriterWriteDTDExternalEntity(xmlTextWriter *writer,
int pe,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar * ndataid);
XMLPUBFUN int
xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriter *
writer,
const xmlChar * pubid,
const xmlChar * sysid,
const xmlChar *
ndataid);
XMLPUBFUN int xmlTextWriterWriteDTDEntity(xmlTextWriter *
writer, int pe,
const xmlChar * name,
const xmlChar *
pubid,
const xmlChar *
sysid,
const xmlChar *
ndataid,
const xmlChar *
content);
/*
* DTD notation definition
*/
XMLPUBFUN int
xmlTextWriterWriteDTDNotation(xmlTextWriter *writer,
const xmlChar * name,
const xmlChar * pubid,
const xmlChar * sysid);
/*
* Indentation
*/
XMLPUBFUN int
xmlTextWriterSetIndent(xmlTextWriter *writer, int indent);
XMLPUBFUN int
xmlTextWriterSetIndentString(xmlTextWriter *writer,
const xmlChar * str);
XMLPUBFUN int
xmlTextWriterSetQuoteChar(xmlTextWriter *writer, xmlChar quotechar);
/*
* misc
*/
XMLPUBFUN int xmlTextWriterFlush(xmlTextWriter *writer);
XMLPUBFUN int xmlTextWriterClose(xmlTextWriter *writer);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_WRITER_ENABLED */
#endif /* __XML_XMLWRITER_H__ */
+572
View File
@@ -0,0 +1,572 @@
/**
* @file
*
* @brief XML Path Language implementation
*
* API for the XML Path Language implementation
*
* XML Path Language implementation
* XPath is a language for addressing parts of an XML document,
* designed to be used by both XSLT and XPointer
* http://www.w3.org/TR/xpath
*
* Implements
* W3C Recommendation 16 November 1999
* http://www.w3.org/TR/1999/REC-xpath-19991116
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_XPATH_H__
#define __XML_XPATH_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_XPATH_ENABLED
#include <libxml/xmlerror.h>
#include <libxml/tree.h>
#include <libxml/hash.h>
#ifdef __cplusplus
extern "C" {
#endif
/** XPath context */
typedef struct _xmlXPathContext xmlXPathContext;
typedef xmlXPathContext *xmlXPathContextPtr;
/** XPath parser and evaluation context */
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,
XPATH_INVALID_CTXT,
XPATH_STACK_ERROR,
XPATH_FORBID_VARIABLE_ERROR,
XPATH_OP_LIMIT_EXCEEDED,
XPATH_RECURSION_LIMIT_EXCEEDED
} xmlXPathError;
/** XPath node set */
typedef struct _xmlNodeSet xmlNodeSet;
typedef xmlNodeSet *xmlNodeSetPtr;
/**
* A node-set (an unordered collection of nodes without duplicates).
*/
struct _xmlNodeSet {
/** number of nodes in the set */
int nodeNr;
/** size of the array as allocated */
int nodeMax;
/** array of nodes in no particular order */
xmlNode **nodeTab;
};
/**
* An expression is evaluated to yield an object, which
* has one of the following four basic types:
*
* - node-set
* - boolean
* - number
* - string
*/
typedef enum {
XPATH_UNDEFINED = 0,
XPATH_NODESET = 1,
XPATH_BOOLEAN = 2,
XPATH_NUMBER = 3,
XPATH_STRING = 4,
XPATH_USERS = 8,
XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */
} xmlXPathObjectType;
/** @cond IGNORE */
#define XPATH_POINT 5
#define XPATH_RANGE 6
#define XPATH_LOCATIONSET 7
/** @endcond */
/** XPath object */
typedef struct _xmlXPathObject xmlXPathObject;
typedef xmlXPathObject *xmlXPathObjectPtr;
/**
* An XPath object
*/
struct _xmlXPathObject {
/** object type */
xmlXPathObjectType type;
/** node set */
xmlNodeSet *nodesetval;
/** boolean */
int boolval;
/** number */
double floatval;
/** string */
xmlChar *stringval;
void *user;
int index;
void *user2;
int index2;
};
/** @cond ignore */
/*
* unused
*/
typedef int (*xmlXPathConvertFunc) (xmlXPathObject *obj, int type);
typedef struct _xmlXPathType xmlXPathType;
typedef xmlXPathType *xmlXPathTypePtr;
struct _xmlXPathType {
const xmlChar *name; /* the type name */
xmlXPathConvertFunc func; /* the conversion function */
};
/*
* unused
*/
typedef struct _xmlXPathVariable xmlXPathVariable;
typedef xmlXPathVariable *xmlXPathVariablePtr;
struct _xmlXPathVariable {
const xmlChar *name; /* the variable name */
xmlXPathObject *value; /* the value */
};
/*
* unused
*/
typedef void (*xmlXPathEvalFunc)(xmlXPathParserContext *ctxt,
int nargs);
typedef struct _xmlXPathFunct xmlXPathFunct;
typedef xmlXPathFunct *xmlXPathFuncPtr;
struct _xmlXPathFunct {
const xmlChar *name; /* the function name */
xmlXPathEvalFunc func; /* the evaluation function */
};
/*
* unused
*/
typedef xmlXPathObject *(*xmlXPathAxisFunc) (xmlXPathParserContext *ctxt,
xmlXPathObject *cur);
typedef struct _xmlXPathAxis xmlXPathAxis;
typedef xmlXPathAxis *xmlXPathAxisPtr;
struct _xmlXPathAxis {
const xmlChar *name; /* the axis name */
xmlXPathAxisFunc func; /* the search function */
};
/** @endcond */
/**
* An XPath function.
* The arguments (if any) are popped out from the context stack
* and the result is pushed on the stack.
*
* @param ctxt the XPath interprestation context
* @param nargs the number of arguments
*/
typedef void (*xmlXPathFunction) (xmlXPathParserContext *ctxt, int nargs);
/*
* Function and Variable Lookup.
*/
/**
* Prototype for callbacks used to plug variable lookup in the XPath
* engine.
*
* @param ctxt an XPath context
* @param name name of the variable
* @param ns_uri the namespace name hosting this variable
* @returns the XPath object value or NULL if not found.
*/
typedef xmlXPathObject *(*xmlXPathVariableLookupFunc) (void *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
/**
* Prototype for callbacks used to plug function lookup in the XPath
* engine.
*
* @param ctxt an XPath context
* @param name name of the function
* @param ns_uri the namespace name hosting this function
* @returns the XPath function or NULL if not found.
*/
typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
/**
* Flags for XPath engine compilation and runtime
*/
/**
* check namespaces at compilation
*/
#define XML_XPATH_CHECKNS (1<<0)
/**
* forbid variables in expression
*/
#define XML_XPATH_NOVAR (1<<1)
/**
* 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.
* The node may be modified when the context is passed to libxml2
* for an XPath evaluation so you may need to initialize it again
* before the next call.
*/
struct _xmlXPathContext {
/** The current document */
xmlDoc *doc;
/** The current node */
xmlNode *node;
/* unused (hash table) */
int nb_variables_unused;
/* unused (hash table) */
int max_variables_unused;
/* Hash table of defined variables */
xmlHashTable *varHash;
/* number of defined types */
int nb_types;
/* max number of types */
int max_types;
/* Array of defined types */
xmlXPathType *types;
/* unused (hash table) */
int nb_funcs_unused;
/* unused (hash table) */
int max_funcs_unused;
/* Hash table of defined funcs */
xmlHashTable *funcHash;
/* number of defined axis */
int nb_axis;
/* max number of axis */
int max_axis;
/* Array of defined axis */
xmlXPathAxis *axis;
/* Array of namespaces */
xmlNs **namespaces;
/* number of namespace in scope */
int nsNr;
/* function to free */
void *user;
/** the context size */
int contextSize;
/** the proximity position */
int proximityPosition;
/* is this an XPointer context? */
int xptr;
/* for here() */
xmlNode *here;
/* for origin() */
xmlNode *origin;
/* The namespaces hash table */
xmlHashTable *nsHash;
/* variable lookup func */
xmlXPathVariableLookupFunc varLookupFunc;
/* variable lookup data */
void *varLookupData;
/* needed for XSLT */
void *extra;
/* The function name when calling a function */
const xmlChar *function;
/* The namespace URI when calling a function */
const xmlChar *functionURI;
/* function lookup func */
xmlXPathFuncLookupFunc funcLookupFunc;
/* function lookup data */
void *funcLookupData;
/* Array of temp namespaces */
xmlNs **tmpNsList;
/* number of namespaces in scope */
int tmpNsNr;
/* user specific data block */
void *userData;
/* the callback in case of errors */
xmlStructuredErrorFunc error;
/* the last error */
xmlError lastError;
/* the source node XSLT */
xmlNode *debugNode;
/* dictionary if any */
xmlDict *dict;
/** flags to control compilation */
int flags;
/* Cache for reusal of XPath objects */
void *cache;
/* Resource limits */
unsigned long opLimit;
unsigned long opCount;
int depth;
};
/** Compiled XPath expression */
typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
/**
* An XPath parser context. It contains pure parsing information,
* an xmlXPathContext, and the stack of objects.
*
* This struct is used for evaluation as well and misnamed.
*/
struct _xmlXPathParserContext {
/* the current char being parsed */
const xmlChar *cur;
/* the full expression */
const xmlChar *base;
/** error code */
int error;
/** the evaluation context */
xmlXPathContext *context;
/** the current value */
xmlXPathObject *value;
/* number of values stacked */
int valueNr;
/* max number of values stacked */
int valueMax;
/* stack of values */
xmlXPathObject **valueTab;
/* the precompiled expression */
xmlXPathCompExpr *comp;
/* it this an XPointer expression */
int xptr;
/* used for walking preceding axis */
xmlNode *ancestor;
/* always zero for compatibility */
int valueFrame;
};
/************************************************************************
* *
* Public API *
* *
************************************************************************/
/**
* Objects and Nodesets handling
*/
/** @cond ignore */
XML_DEPRECATED
XMLPUBVAR double xmlXPathNAN;
XML_DEPRECATED
XMLPUBVAR double xmlXPathPINF;
XML_DEPRECATED
XMLPUBVAR double xmlXPathNINF;
/* These macros may later turn into functions */
/**
* Implement a functionality similar to the DOM NodeList.length.
*
* @param ns a node-set
* @returns the number of nodes in the node-set.
*/
#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0)
/**
* Implements a functionality similar to the DOM NodeList.item().
*
* @param ns a node-set
* @param index index of a node in the set
* @returns the xmlNode 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)
/**
* Checks whether `ns` is empty or not.
*
* @param ns a node-set
* @returns %TRUE if `ns` is an empty node-set.
*/
#define xmlXPathNodeSetIsEmpty(ns) \
(((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
/** @endcond */
XMLPUBFUN void
xmlXPathFreeObject (xmlXPathObject *obj);
XMLPUBFUN xmlNodeSet *
xmlXPathNodeSetCreate (xmlNode *val);
XMLPUBFUN void
xmlXPathFreeNodeSetList (xmlXPathObject *obj);
XMLPUBFUN void
xmlXPathFreeNodeSet (xmlNodeSet *obj);
XMLPUBFUN xmlXPathObject *
xmlXPathObjectCopy (xmlXPathObject *val);
XMLPUBFUN int
xmlXPathCmpNodes (xmlNode *node1,
xmlNode *node2);
/**
* Conversion functions to basic types.
*/
XMLPUBFUN int
xmlXPathCastNumberToBoolean (double val);
XMLPUBFUN int
xmlXPathCastStringToBoolean (const xmlChar * val);
XMLPUBFUN int
xmlXPathCastNodeSetToBoolean(xmlNodeSet *ns);
XMLPUBFUN int
xmlXPathCastToBoolean (xmlXPathObject *val);
XMLPUBFUN double
xmlXPathCastBooleanToNumber (int val);
XMLPUBFUN double
xmlXPathCastStringToNumber (const xmlChar * val);
XMLPUBFUN double
xmlXPathCastNodeToNumber (xmlNode *node);
XMLPUBFUN double
xmlXPathCastNodeSetToNumber (xmlNodeSet *ns);
XMLPUBFUN double
xmlXPathCastToNumber (xmlXPathObject *val);
XMLPUBFUN xmlChar *
xmlXPathCastBooleanToString (int val);
XMLPUBFUN xmlChar *
xmlXPathCastNumberToString (double val);
XMLPUBFUN xmlChar *
xmlXPathCastNodeToString (xmlNode *node);
XMLPUBFUN xmlChar *
xmlXPathCastNodeSetToString (xmlNodeSet *ns);
XMLPUBFUN xmlChar *
xmlXPathCastToString (xmlXPathObject *val);
XMLPUBFUN xmlXPathObject *
xmlXPathConvertBoolean (xmlXPathObject *val);
XMLPUBFUN xmlXPathObject *
xmlXPathConvertNumber (xmlXPathObject *val);
XMLPUBFUN xmlXPathObject *
xmlXPathConvertString (xmlXPathObject *val);
/**
* Context handling.
*/
XMLPUBFUN xmlXPathContext *
xmlXPathNewContext (xmlDoc *doc);
XMLPUBFUN void
xmlXPathFreeContext (xmlXPathContext *ctxt);
XMLPUBFUN void
xmlXPathSetErrorHandler(xmlXPathContext *ctxt,
xmlStructuredErrorFunc handler,
void *context);
XMLPUBFUN int
xmlXPathContextSetCache(xmlXPathContext *ctxt,
int active,
int value,
int options);
/**
* Evaluation functions.
*/
XMLPUBFUN long
xmlXPathOrderDocElems (xmlDoc *doc);
XMLPUBFUN int
xmlXPathSetContextNode (xmlNode *node,
xmlXPathContext *ctx);
XMLPUBFUN xmlXPathObject *
xmlXPathNodeEval (xmlNode *node,
const xmlChar *str,
xmlXPathContext *ctx);
XMLPUBFUN xmlXPathObject *
xmlXPathEval (const xmlChar *str,
xmlXPathContext *ctx);
XMLPUBFUN xmlXPathObject *
xmlXPathEvalExpression (const xmlChar *str,
xmlXPathContext *ctxt);
XMLPUBFUN int
xmlXPathEvalPredicate (xmlXPathContext *ctxt,
xmlXPathObject *res);
/**
* Separate compilation/evaluation entry points.
*/
XMLPUBFUN xmlXPathCompExpr *
xmlXPathCompile (const xmlChar *str);
XMLPUBFUN xmlXPathCompExpr *
xmlXPathCtxtCompile (xmlXPathContext *ctxt,
const xmlChar *str);
XMLPUBFUN xmlXPathObject *
xmlXPathCompiledEval (xmlXPathCompExpr *comp,
xmlXPathContext *ctx);
XMLPUBFUN int
xmlXPathCompiledEvalToBoolean(xmlXPathCompExpr *comp,
xmlXPathContext *ctxt);
XMLPUBFUN void
xmlXPathFreeCompExpr (xmlXPathCompExpr *comp);
XML_DEPRECATED
XMLPUBFUN void
xmlXPathInit (void);
XMLPUBFUN int
xmlXPathIsNaN (double val);
XMLPUBFUN int
xmlXPathIsInf (double val);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPATH_ENABLED */
#endif /* ! __XML_XPATH_H__ */
+609
View File
@@ -0,0 +1,609 @@
/**
* @file
*
* @brief internal interfaces for XML Path Language implementation
*
* internal interfaces for XML Path Language implementation
* used to build new modules on top of XPath like XPointer and
* XSLT
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_XPATH_INTERNALS_H__
#define __XML_XPATH_INTERNALS_H__
#include <stdio.h>
#include <libxml/xmlversion.h>
#include <libxml/xpath.h>
#ifdef LIBXML_XPATH_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* Push a value on the stack
*
* @deprecated Use #xmlXPathValuePush
*/
#define valuePush xmlXPathValuePush
/**
* Pop a value from the stack
*
* @deprecated Use #xmlXPathValuePop
*/
#define valuePop xmlXPathValuePop
/************************************************************************
* *
* Helpers *
* *
************************************************************************/
/*
* Many of these macros may later turn into functions. They
* shouldn't be used in \#ifdef's preprocessor instructions.
*/
/**
* Raises an error.
*
* @param ctxt an XPath parser context
* @param err an xmlXPathError code
*/
#define xmlXPathSetError(ctxt, err) \
{ xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \
if ((ctxt) != NULL) (ctxt)->error = (err); }
/**
* Raises an XPATH_INVALID_ARITY error.
*
* @param ctxt an XPath parser context
*/
#define xmlXPathSetArityError(ctxt) \
xmlXPathSetError((ctxt), XPATH_INVALID_ARITY)
/**
* Raises an XPATH_INVALID_TYPE error.
*
* @param ctxt an XPath parser context
*/
#define xmlXPathSetTypeError(ctxt) \
xmlXPathSetError((ctxt), XPATH_INVALID_TYPE)
/**
* Get the error code of an XPath context.
*
* @param ctxt an XPath parser context
* @returns the context error.
*/
#define xmlXPathGetError(ctxt) ((ctxt)->error)
/**
* Check if an XPath error was raised.
*
* @param ctxt an XPath parser context
* @returns true if an error has been raised, false otherwise.
*/
#define xmlXPathCheckError(ctxt) ((ctxt)->error != XPATH_EXPRESSION_OK)
/**
* Get the document of an XPath context.
*
* @param ctxt an XPath parser context
* @returns the context document.
*/
#define xmlXPathGetDocument(ctxt) ((ctxt)->context->doc)
/**
* Get the context node of an XPath context.
*
* @param ctxt an XPath parser context
* @returns the context node.
*/
#define xmlXPathGetContextNode(ctxt) ((ctxt)->context->node)
XMLPUBFUN int
xmlXPathPopBoolean (xmlXPathParserContext *ctxt);
XMLPUBFUN double
xmlXPathPopNumber (xmlXPathParserContext *ctxt);
XMLPUBFUN xmlChar *
xmlXPathPopString (xmlXPathParserContext *ctxt);
XMLPUBFUN xmlNodeSet *
xmlXPathPopNodeSet (xmlXPathParserContext *ctxt);
XMLPUBFUN void *
xmlXPathPopExternal (xmlXPathParserContext *ctxt);
/**
* Pushes the boolean `val` on the context stack.
*
* @param ctxt an XPath parser context
* @param val a boolean
*/
#define xmlXPathReturnBoolean(ctxt, val) \
valuePush((ctxt), xmlXPathNewBoolean(val))
/**
* Pushes true on the context stack.
*
* @param ctxt an XPath parser context
*/
#define xmlXPathReturnTrue(ctxt) xmlXPathReturnBoolean((ctxt), 1)
/**
* Pushes false on the context stack.
*
* @param ctxt an XPath parser context
*/
#define xmlXPathReturnFalse(ctxt) xmlXPathReturnBoolean((ctxt), 0)
/**
* Pushes the double `val` on the context stack.
*
* @param ctxt an XPath parser context
* @param val a double
*/
#define xmlXPathReturnNumber(ctxt, val) \
valuePush((ctxt), xmlXPathNewFloat(val))
/**
* Pushes the string `str` on the context stack.
*
* @param ctxt an XPath parser context
* @param str a string
*/
#define xmlXPathReturnString(ctxt, str) \
valuePush((ctxt), xmlXPathWrapString(str))
/**
* Pushes an empty string on the stack.
*
* @param ctxt an XPath parser context
*/
#define xmlXPathReturnEmptyString(ctxt) \
valuePush((ctxt), xmlXPathNewCString(""))
/**
* Pushes the node-set `ns` on the context stack.
*
* @param ctxt an XPath parser context
* @param ns a node-set
*/
#define xmlXPathReturnNodeSet(ctxt, ns) \
valuePush((ctxt), xmlXPathWrapNodeSet(ns))
/**
* Pushes an empty node-set on the context stack.
*
* @param ctxt an XPath parser context
*/
#define xmlXPathReturnEmptyNodeSet(ctxt) \
valuePush((ctxt), xmlXPathNewNodeSet(NULL))
/**
* Pushes user data on the context stack.
*
* @param ctxt an XPath parser context
* @param val user data
*/
#define xmlXPathReturnExternal(ctxt, val) \
valuePush((ctxt), xmlXPathWrapExternal(val))
/**
* Check if the current value on the XPath stack is a node set or
* an XSLT value tree.
*
* @param ctxt an XPath parser context
* @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)))
/**
* Checks if the current value on the XPath stack is an external
* object.
*
* @param ctxt an XPath parser context
* @returns true if the current object on the stack is an external
* object.
*/
#define xmlXPathStackIsExternal(ctxt) \
((ctxt->value != NULL) && (ctxt->value->type == XPATH_USERS))
/**
* Empties a node-set.
*
* @param ns a node-set
*/
#define xmlXPathEmptyNodeSet(ns) \
{ while ((ns)->nodeNr > 0) (ns)->nodeTab[--(ns)->nodeNr] = NULL; }
/**
* Macro to return from the function if an XPath error was detected.
*/
#define CHECK_ERROR \
if (ctxt->error != XPATH_EXPRESSION_OK) return
/**
* Macro to return 0 from the function if an XPath error was detected.
*/
#define CHECK_ERROR0 \
if (ctxt->error != XPATH_EXPRESSION_OK) return(0)
/**
* Macro to raise an XPath error and return.
*
* @param X the error code
*/
#define XP_ERROR(X) \
{ xmlXPathErr(ctxt, X); return; }
/**
* Macro to raise an XPath error and return 0.
*
* @param X the error code
*/
#define XP_ERROR0(X) \
{ xmlXPathErr(ctxt, X); return(0); }
/**
* Macro to check that the value on top of the XPath stack is of a given
* type.
*
* @param typeval the XPath type
*/
#define CHECK_TYPE(typeval) \
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
XP_ERROR(XPATH_INVALID_TYPE)
/**
* Macro to check that the value on top of the XPath stack is of a given
* type. Return(0) in case of failure
*
* @param typeval the XPath type
*/
#define CHECK_TYPE0(typeval) \
if ((ctxt->value == NULL) || (ctxt->value->type != typeval)) \
XP_ERROR0(XPATH_INVALID_TYPE)
/**
* Macro to check that the number of args passed to an XPath function matches.
*
* @param x the number of expected args
*/
#define CHECK_ARITY(x) \
if (ctxt == NULL) return; \
if (nargs != (x)) \
XP_ERROR(XPATH_INVALID_ARITY); \
if (ctxt->valueNr < (x)) \
XP_ERROR(XPATH_STACK_ERROR);
/**
* 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);
/**
* 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);
/**
* 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.
*/
XMLPUBFUN void
xmlXPathRegisterVariableLookup (xmlXPathContext *ctxt,
xmlXPathVariableLookupFunc f,
void *data);
/*
* Function Lookup forwarding.
*/
XMLPUBFUN void
xmlXPathRegisterFuncLookup (xmlXPathContext *ctxt,
xmlXPathFuncLookupFunc f,
void *funcCtxt);
/*
* Error reporting.
*/
XMLPUBFUN void
xmlXPatherror (xmlXPathParserContext *ctxt,
const char *file,
int line,
int no);
XMLPUBFUN void
xmlXPathErr (xmlXPathParserContext *ctxt,
int error);
#ifdef LIBXML_DEBUG_ENABLED
XMLPUBFUN void
xmlXPathDebugDumpObject (FILE *output,
xmlXPathObject *cur,
int depth);
XMLPUBFUN void
xmlXPathDebugDumpCompExpr(FILE *output,
xmlXPathCompExpr *comp,
int depth);
#endif
/**
* NodeSet handling.
*/
XMLPUBFUN int
xmlXPathNodeSetContains (xmlNodeSet *cur,
xmlNode *val);
XMLPUBFUN xmlNodeSet *
xmlXPathDifference (xmlNodeSet *nodes1,
xmlNodeSet *nodes2);
XMLPUBFUN xmlNodeSet *
xmlXPathIntersection (xmlNodeSet *nodes1,
xmlNodeSet *nodes2);
XMLPUBFUN xmlNodeSet *
xmlXPathDistinctSorted (xmlNodeSet *nodes);
XMLPUBFUN xmlNodeSet *
xmlXPathDistinct (xmlNodeSet *nodes);
XMLPUBFUN int
xmlXPathHasSameNodes (xmlNodeSet *nodes1,
xmlNodeSet *nodes2);
XMLPUBFUN xmlNodeSet *
xmlXPathNodeLeadingSorted (xmlNodeSet *nodes,
xmlNode *node);
XMLPUBFUN xmlNodeSet *
xmlXPathLeadingSorted (xmlNodeSet *nodes1,
xmlNodeSet *nodes2);
XMLPUBFUN xmlNodeSet *
xmlXPathNodeLeading (xmlNodeSet *nodes,
xmlNode *node);
XMLPUBFUN xmlNodeSet *
xmlXPathLeading (xmlNodeSet *nodes1,
xmlNodeSet *nodes2);
XMLPUBFUN xmlNodeSet *
xmlXPathNodeTrailingSorted (xmlNodeSet *nodes,
xmlNode *node);
XMLPUBFUN xmlNodeSet *
xmlXPathTrailingSorted (xmlNodeSet *nodes1,
xmlNodeSet *nodes2);
XMLPUBFUN xmlNodeSet *
xmlXPathNodeTrailing (xmlNodeSet *nodes,
xmlNode *node);
XMLPUBFUN xmlNodeSet *
xmlXPathTrailing (xmlNodeSet *nodes1,
xmlNodeSet *nodes2);
/**
* Extending a context.
*/
XMLPUBFUN int
xmlXPathRegisterNs (xmlXPathContext *ctxt,
const xmlChar *prefix,
const xmlChar *ns_uri);
XMLPUBFUN const xmlChar *
xmlXPathNsLookup (xmlXPathContext *ctxt,
const xmlChar *prefix);
XMLPUBFUN void
xmlXPathRegisteredNsCleanup (xmlXPathContext *ctxt);
XMLPUBFUN int
xmlXPathRegisterFunc (xmlXPathContext *ctxt,
const xmlChar *name,
xmlXPathFunction f);
XMLPUBFUN int
xmlXPathRegisterFuncNS (xmlXPathContext *ctxt,
const xmlChar *name,
const xmlChar *ns_uri,
xmlXPathFunction f);
XMLPUBFUN int
xmlXPathRegisterVariable (xmlXPathContext *ctxt,
const xmlChar *name,
xmlXPathObject *value);
XMLPUBFUN int
xmlXPathRegisterVariableNS (xmlXPathContext *ctxt,
const xmlChar *name,
const xmlChar *ns_uri,
xmlXPathObject *value);
XMLPUBFUN xmlXPathFunction
xmlXPathFunctionLookup (xmlXPathContext *ctxt,
const xmlChar *name);
XMLPUBFUN xmlXPathFunction
xmlXPathFunctionLookupNS (xmlXPathContext *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
XMLPUBFUN void
xmlXPathRegisteredFuncsCleanup (xmlXPathContext *ctxt);
XMLPUBFUN xmlXPathObject *
xmlXPathVariableLookup (xmlXPathContext *ctxt,
const xmlChar *name);
XMLPUBFUN xmlXPathObject *
xmlXPathVariableLookupNS (xmlXPathContext *ctxt,
const xmlChar *name,
const xmlChar *ns_uri);
XMLPUBFUN void
xmlXPathRegisteredVariablesCleanup(xmlXPathContext *ctxt);
/**
* Utilities to extend XPath.
*/
XMLPUBFUN xmlXPathParserContext *
xmlXPathNewParserContext (const xmlChar *str,
xmlXPathContext *ctxt);
XMLPUBFUN void
xmlXPathFreeParserContext (xmlXPathParserContext *ctxt);
XMLPUBFUN xmlXPathObject *
xmlXPathValuePop (xmlXPathParserContext *ctxt);
XMLPUBFUN int
xmlXPathValuePush (xmlXPathParserContext *ctxt,
xmlXPathObject *value);
XMLPUBFUN xmlXPathObject *
xmlXPathNewString (const xmlChar *val);
XMLPUBFUN xmlXPathObject *
xmlXPathNewCString (const char *val);
XMLPUBFUN xmlXPathObject *
xmlXPathWrapString (xmlChar *val);
XMLPUBFUN xmlXPathObject *
xmlXPathWrapCString (char * val);
XMLPUBFUN xmlXPathObject *
xmlXPathNewFloat (double val);
XMLPUBFUN xmlXPathObject *
xmlXPathNewBoolean (int val);
XMLPUBFUN xmlXPathObject *
xmlXPathNewNodeSet (xmlNode *val);
XMLPUBFUN xmlXPathObject *
xmlXPathNewValueTree (xmlNode *val);
XMLPUBFUN int
xmlXPathNodeSetAdd (xmlNodeSet *cur,
xmlNode *val);
XMLPUBFUN int
xmlXPathNodeSetAddUnique (xmlNodeSet *cur,
xmlNode *val);
XMLPUBFUN int
xmlXPathNodeSetAddNs (xmlNodeSet *cur,
xmlNode *node,
xmlNs *ns);
XMLPUBFUN void
xmlXPathNodeSetSort (xmlNodeSet *set);
XMLPUBFUN void
xmlXPathRoot (xmlXPathParserContext *ctxt);
XML_DEPRECATED
XMLPUBFUN void
xmlXPathEvalExpr (xmlXPathParserContext *ctxt);
XMLPUBFUN xmlChar *
xmlXPathParseName (xmlXPathParserContext *ctxt);
XMLPUBFUN xmlChar *
xmlXPathParseNCName (xmlXPathParserContext *ctxt);
/*
* Existing functions.
*/
XMLPUBFUN double
xmlXPathStringEvalNumber (const xmlChar *str);
XMLPUBFUN int
xmlXPathEvaluatePredicateResult (xmlXPathParserContext *ctxt,
xmlXPathObject *res);
XMLPUBFUN void
xmlXPathRegisterAllFunctions (xmlXPathContext *ctxt);
XMLPUBFUN xmlNodeSet *
xmlXPathNodeSetMerge (xmlNodeSet *val1,
xmlNodeSet *val2);
XMLPUBFUN void
xmlXPathNodeSetDel (xmlNodeSet *cur,
xmlNode *val);
XMLPUBFUN void
xmlXPathNodeSetRemove (xmlNodeSet *cur,
int val);
XMLPUBFUN xmlXPathObject *
xmlXPathNewNodeSetList (xmlNodeSet *val);
XMLPUBFUN xmlXPathObject *
xmlXPathWrapNodeSet (xmlNodeSet *val);
XMLPUBFUN xmlXPathObject *
xmlXPathWrapExternal (void *val);
XMLPUBFUN int xmlXPathEqualValues(xmlXPathParserContext *ctxt);
XMLPUBFUN int xmlXPathNotEqualValues(xmlXPathParserContext *ctxt);
XMLPUBFUN int xmlXPathCompareValues(xmlXPathParserContext *ctxt, int inf, int strict);
XMLPUBFUN void xmlXPathValueFlipSign(xmlXPathParserContext *ctxt);
XMLPUBFUN void xmlXPathAddValues(xmlXPathParserContext *ctxt);
XMLPUBFUN void xmlXPathSubValues(xmlXPathParserContext *ctxt);
XMLPUBFUN void xmlXPathMultValues(xmlXPathParserContext *ctxt);
XMLPUBFUN void xmlXPathDivValues(xmlXPathParserContext *ctxt);
XMLPUBFUN void xmlXPathModValues(xmlXPathParserContext *ctxt);
XMLPUBFUN int xmlXPathIsNodeType(const xmlChar *name);
/*
* Some of the axis navigation routines.
*/
XMLPUBFUN xmlNode *xmlXPathNextSelf(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextChild(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextDescendant(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextDescendantOrSelf(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextParent(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextAncestorOrSelf(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextFollowingSibling(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextFollowing(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextNamespace(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextAttribute(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextPreceding(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextAncestor(xmlXPathParserContext *ctxt,
xmlNode *cur);
XMLPUBFUN xmlNode *xmlXPathNextPrecedingSibling(xmlXPathParserContext *ctxt,
xmlNode *cur);
/*
* The official core of XPath functions.
*/
XMLPUBFUN void xmlXPathLastFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathPositionFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathCountFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathIdFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathLocalNameFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathNamespaceURIFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathStringFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathStringLengthFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathConcatFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathContainsFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathStartsWithFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathSubstringFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathSubstringBeforeFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathSubstringAfterFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathNormalizeFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathTranslateFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathNotFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathTrueFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathFalseFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathLangFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathNumberFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathSumFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathFloorFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathCeilingFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathRoundFunction(xmlXPathParserContext *ctxt, int nargs);
XMLPUBFUN void xmlXPathBooleanFunction(xmlXPathParserContext *ctxt, int nargs);
/**
* Really internal functions
*/
XMLPUBFUN void xmlXPathNodeSetFreeNs(xmlNs *ns);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPATH_ENABLED */
#endif /* ! __XML_XPATH_INTERNALS_H__ */
+52
View File
@@ -0,0 +1,52 @@
/**
* @file
*
* @brief XPointer framework and schemes
*
* API to evaluate XPointer expressions. The following schemes are
* supported:
*
* - element()
* - xmlns()
* - xpath1()
*
* xpointer() is an alias for the xpath1() scheme. The point and
* range extensions are not supported.
*
* @copyright See Copyright for the status of this software.
*
* @author Daniel Veillard
*/
#ifndef __XML_XPTR_H__
#define __XML_XPTR_H__
#include <libxml/xmlversion.h>
#ifdef LIBXML_XPTR_ENABLED
#include <libxml/tree.h>
#include <libxml/xpath.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Functions.
*/
XML_DEPRECATED
XMLPUBFUN xmlXPathContext *
xmlXPtrNewContext (xmlDoc *doc,
xmlNode *here,
xmlNode *origin);
XMLPUBFUN xmlXPathObject *
xmlXPtrEval (const xmlChar *str,
xmlXPathContext *ctx);
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_XPTR_ENABLED */
#endif /* __XML_XPTR_H__ */