(libxml2) LIBXML_REGEXP_ENABLED removed

This commit is contained in:
twinaphex 2012-11-18 00:15:12 +01:00
parent 99e08b76fa
commit 3a230c0aab
11 changed files with 0 additions and 8925 deletions

View File

@ -45,7 +45,6 @@ LOCAL_LIBXML_SRC_FILES = $(LIBXML_PATH)/chvalid.c \
$(LIBXML_PATH)/xmlIO.c \
$(LIBXML_PATH)/xmlmemory.c \
$(LIBXML_PATH)/xmlreader.c \
$(LIBXML_PATH)/xmlregexp.c \
$(LIBXML_PATH)/xmlsave.c \
$(LIBXML_PATH)/xmlstring.c
LOCAL_SRC_FILES = $(RARCH_PATH)/console/griffin/griffin.c $(LOCAL_LIBXML_SRC_FILES)

View File

@ -1439,234 +1439,6 @@ extern __typeof (xmlErrMemory) xmlErrMemory__internal_alias __attribute((visibil
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpCtxtNbCons
extern __typeof (xmlExpCtxtNbCons) xmlExpCtxtNbCons __attribute((alias("xmlExpCtxtNbCons__internal_alias")));
#else
#ifndef xmlExpCtxtNbCons
extern __typeof (xmlExpCtxtNbCons) xmlExpCtxtNbCons__internal_alias __attribute((visibility("hidden")));
#define xmlExpCtxtNbCons xmlExpCtxtNbCons__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpCtxtNbNodes
extern __typeof (xmlExpCtxtNbNodes) xmlExpCtxtNbNodes __attribute((alias("xmlExpCtxtNbNodes__internal_alias")));
#else
#ifndef xmlExpCtxtNbNodes
extern __typeof (xmlExpCtxtNbNodes) xmlExpCtxtNbNodes__internal_alias __attribute((visibility("hidden")));
#define xmlExpCtxtNbNodes xmlExpCtxtNbNodes__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpDump
extern __typeof (xmlExpDump) xmlExpDump __attribute((alias("xmlExpDump__internal_alias")));
#else
#ifndef xmlExpDump
extern __typeof (xmlExpDump) xmlExpDump__internal_alias __attribute((visibility("hidden")));
#define xmlExpDump xmlExpDump__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpExpDerive
extern __typeof (xmlExpExpDerive) xmlExpExpDerive __attribute((alias("xmlExpExpDerive__internal_alias")));
#else
#ifndef xmlExpExpDerive
extern __typeof (xmlExpExpDerive) xmlExpExpDerive__internal_alias __attribute((visibility("hidden")));
#define xmlExpExpDerive xmlExpExpDerive__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpFree
extern __typeof (xmlExpFree) xmlExpFree __attribute((alias("xmlExpFree__internal_alias")));
#else
#ifndef xmlExpFree
extern __typeof (xmlExpFree) xmlExpFree__internal_alias __attribute((visibility("hidden")));
#define xmlExpFree xmlExpFree__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpFreeCtxt
extern __typeof (xmlExpFreeCtxt) xmlExpFreeCtxt __attribute((alias("xmlExpFreeCtxt__internal_alias")));
#else
#ifndef xmlExpFreeCtxt
extern __typeof (xmlExpFreeCtxt) xmlExpFreeCtxt__internal_alias __attribute((visibility("hidden")));
#define xmlExpFreeCtxt xmlExpFreeCtxt__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpGetLanguage
extern __typeof (xmlExpGetLanguage) xmlExpGetLanguage __attribute((alias("xmlExpGetLanguage__internal_alias")));
#else
#ifndef xmlExpGetLanguage
extern __typeof (xmlExpGetLanguage) xmlExpGetLanguage__internal_alias __attribute((visibility("hidden")));
#define xmlExpGetLanguage xmlExpGetLanguage__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpGetStart
extern __typeof (xmlExpGetStart) xmlExpGetStart __attribute((alias("xmlExpGetStart__internal_alias")));
#else
#ifndef xmlExpGetStart
extern __typeof (xmlExpGetStart) xmlExpGetStart__internal_alias __attribute((visibility("hidden")));
#define xmlExpGetStart xmlExpGetStart__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpIsNillable
extern __typeof (xmlExpIsNillable) xmlExpIsNillable __attribute((alias("xmlExpIsNillable__internal_alias")));
#else
#ifndef xmlExpIsNillable
extern __typeof (xmlExpIsNillable) xmlExpIsNillable__internal_alias __attribute((visibility("hidden")));
#define xmlExpIsNillable xmlExpIsNillable__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpMaxToken
extern __typeof (xmlExpMaxToken) xmlExpMaxToken __attribute((alias("xmlExpMaxToken__internal_alias")));
#else
#ifndef xmlExpMaxToken
extern __typeof (xmlExpMaxToken) xmlExpMaxToken__internal_alias __attribute((visibility("hidden")));
#define xmlExpMaxToken xmlExpMaxToken__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpNewAtom
extern __typeof (xmlExpNewAtom) xmlExpNewAtom __attribute((alias("xmlExpNewAtom__internal_alias")));
#else
#ifndef xmlExpNewAtom
extern __typeof (xmlExpNewAtom) xmlExpNewAtom__internal_alias __attribute((visibility("hidden")));
#define xmlExpNewAtom xmlExpNewAtom__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpNewCtxt
extern __typeof (xmlExpNewCtxt) xmlExpNewCtxt __attribute((alias("xmlExpNewCtxt__internal_alias")));
#else
#ifndef xmlExpNewCtxt
extern __typeof (xmlExpNewCtxt) xmlExpNewCtxt__internal_alias __attribute((visibility("hidden")));
#define xmlExpNewCtxt xmlExpNewCtxt__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpNewOr
extern __typeof (xmlExpNewOr) xmlExpNewOr __attribute((alias("xmlExpNewOr__internal_alias")));
#else
#ifndef xmlExpNewOr
extern __typeof (xmlExpNewOr) xmlExpNewOr__internal_alias __attribute((visibility("hidden")));
#define xmlExpNewOr xmlExpNewOr__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpNewRange
extern __typeof (xmlExpNewRange) xmlExpNewRange __attribute((alias("xmlExpNewRange__internal_alias")));
#else
#ifndef xmlExpNewRange
extern __typeof (xmlExpNewRange) xmlExpNewRange__internal_alias __attribute((visibility("hidden")));
#define xmlExpNewRange xmlExpNewRange__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpNewSeq
extern __typeof (xmlExpNewSeq) xmlExpNewSeq __attribute((alias("xmlExpNewSeq__internal_alias")));
#else
#ifndef xmlExpNewSeq
extern __typeof (xmlExpNewSeq) xmlExpNewSeq__internal_alias __attribute((visibility("hidden")));
#define xmlExpNewSeq xmlExpNewSeq__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpParse
extern __typeof (xmlExpParse) xmlExpParse __attribute((alias("xmlExpParse__internal_alias")));
#else
#ifndef xmlExpParse
extern __typeof (xmlExpParse) xmlExpParse__internal_alias __attribute((visibility("hidden")));
#define xmlExpParse xmlExpParse__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpRef
extern __typeof (xmlExpRef) xmlExpRef __attribute((alias("xmlExpRef__internal_alias")));
#else
#ifndef xmlExpRef
extern __typeof (xmlExpRef) xmlExpRef__internal_alias __attribute((visibility("hidden")));
#define xmlExpRef xmlExpRef__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpStringDerive
extern __typeof (xmlExpStringDerive) xmlExpStringDerive __attribute((alias("xmlExpStringDerive__internal_alias")));
#else
#ifndef xmlExpStringDerive
extern __typeof (xmlExpStringDerive) xmlExpStringDerive__internal_alias __attribute((visibility("hidden")));
#define xmlExpStringDerive xmlExpStringDerive__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_EXPR_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlExpSubsume
extern __typeof (xmlExpSubsume) xmlExpSubsume __attribute((alias("xmlExpSubsume__internal_alias")));
#else
#ifndef xmlExpSubsume
extern __typeof (xmlExpSubsume) xmlExpSubsume__internal_alias __attribute((visibility("hidden")));
#define xmlExpSubsume xmlExpSubsume__internal_alias
#endif
#endif
#endif
#ifdef bottom_xmlIO
#undef xmlFileClose
extern __typeof (xmlFileClose) xmlFileClose __attribute((alias("xmlFileClose__internal_alias")));
@ -5025,138 +4797,6 @@ extern __typeof (xmlReconciliateNs) xmlReconciliateNs__internal_alias __attribut
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlRegExecErrInfo
extern __typeof (xmlRegExecErrInfo) xmlRegExecErrInfo __attribute((alias("xmlRegExecErrInfo__internal_alias")));
#else
#ifndef xmlRegExecErrInfo
extern __typeof (xmlRegExecErrInfo) xmlRegExecErrInfo__internal_alias __attribute((visibility("hidden")));
#define xmlRegExecErrInfo xmlRegExecErrInfo__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlRegExecNextValues
extern __typeof (xmlRegExecNextValues) xmlRegExecNextValues __attribute((alias("xmlRegExecNextValues__internal_alias")));
#else
#ifndef xmlRegExecNextValues
extern __typeof (xmlRegExecNextValues) xmlRegExecNextValues__internal_alias __attribute((visibility("hidden")));
#define xmlRegExecNextValues xmlRegExecNextValues__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlRegExecPushString
extern __typeof (xmlRegExecPushString) xmlRegExecPushString __attribute((alias("xmlRegExecPushString__internal_alias")));
#else
#ifndef xmlRegExecPushString
extern __typeof (xmlRegExecPushString) xmlRegExecPushString__internal_alias __attribute((visibility("hidden")));
#define xmlRegExecPushString xmlRegExecPushString__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlRegExecPushString2
extern __typeof (xmlRegExecPushString2) xmlRegExecPushString2 __attribute((alias("xmlRegExecPushString2__internal_alias")));
#else
#ifndef xmlRegExecPushString2
extern __typeof (xmlRegExecPushString2) xmlRegExecPushString2__internal_alias __attribute((visibility("hidden")));
#define xmlRegExecPushString2 xmlRegExecPushString2__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlRegFreeExecCtxt
extern __typeof (xmlRegFreeExecCtxt) xmlRegFreeExecCtxt __attribute((alias("xmlRegFreeExecCtxt__internal_alias")));
#else
#ifndef xmlRegFreeExecCtxt
extern __typeof (xmlRegFreeExecCtxt) xmlRegFreeExecCtxt__internal_alias __attribute((visibility("hidden")));
#define xmlRegFreeExecCtxt xmlRegFreeExecCtxt__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlRegFreeRegexp
extern __typeof (xmlRegFreeRegexp) xmlRegFreeRegexp __attribute((alias("xmlRegFreeRegexp__internal_alias")));
#else
#ifndef xmlRegFreeRegexp
extern __typeof (xmlRegFreeRegexp) xmlRegFreeRegexp__internal_alias __attribute((visibility("hidden")));
#define xmlRegFreeRegexp xmlRegFreeRegexp__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlRegNewExecCtxt
extern __typeof (xmlRegNewExecCtxt) xmlRegNewExecCtxt __attribute((alias("xmlRegNewExecCtxt__internal_alias")));
#else
#ifndef xmlRegNewExecCtxt
extern __typeof (xmlRegNewExecCtxt) xmlRegNewExecCtxt__internal_alias __attribute((visibility("hidden")));
#define xmlRegNewExecCtxt xmlRegNewExecCtxt__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlRegexpCompile
extern __typeof (xmlRegexpCompile) xmlRegexpCompile __attribute((alias("xmlRegexpCompile__internal_alias")));
#else
#ifndef xmlRegexpCompile
extern __typeof (xmlRegexpCompile) xmlRegexpCompile__internal_alias __attribute((visibility("hidden")));
#define xmlRegexpCompile xmlRegexpCompile__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlRegexpExec
extern __typeof (xmlRegexpExec) xmlRegexpExec __attribute((alias("xmlRegexpExec__internal_alias")));
#else
#ifndef xmlRegexpExec
extern __typeof (xmlRegexpExec) xmlRegexpExec__internal_alias __attribute((visibility("hidden")));
#define xmlRegexpExec xmlRegexpExec__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlRegexpIsDeterminist
extern __typeof (xmlRegexpIsDeterminist) xmlRegexpIsDeterminist __attribute((alias("xmlRegexpIsDeterminist__internal_alias")));
#else
#ifndef xmlRegexpIsDeterminist
extern __typeof (xmlRegexpIsDeterminist) xmlRegexpIsDeterminist__internal_alias __attribute((visibility("hidden")));
#define xmlRegexpIsDeterminist xmlRegexpIsDeterminist__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_xmlregexp
#undef xmlRegexpPrint
extern __typeof (xmlRegexpPrint) xmlRegexpPrint __attribute((alias("xmlRegexpPrint__internal_alias")));
#else
#ifndef xmlRegexpPrint
extern __typeof (xmlRegexpPrint) xmlRegexpPrint__internal_alias __attribute((visibility("hidden")));
#define xmlRegexpPrint xmlRegexpPrint__internal_alias
#endif
#endif
#endif
#ifdef bottom_encoding
#undef xmlRegisterCharEncodingHandler
extern __typeof (xmlRegisterCharEncodingHandler) xmlRegisterCharEncodingHandler __attribute((alias("xmlRegisterCharEncodingHandler__internal_alias")));
@ -7154,18 +6794,6 @@ extern __typeof (xmlUnsetProp) xmlUnsetProp__internal_alias __attribute((visibil
#endif
#endif
#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_valid
#undef xmlValidBuildContentModel
extern __typeof (xmlValidBuildContentModel) xmlValidBuildContentModel __attribute((alias("xmlValidBuildContentModel__internal_alias")));
#else
#ifndef xmlValidBuildContentModel
extern __typeof (xmlValidBuildContentModel) xmlValidBuildContentModel__internal_alias __attribute((visibility("hidden")));
#define xmlValidBuildContentModel xmlValidBuildContentModel__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_VALID_ENABLED)
#ifdef bottom_valid
#undef xmlValidCtxtNormalizeAttributeValue
@ -7454,42 +7082,6 @@ extern __typeof (xmlValidateOneNamespace) xmlValidateOneNamespace__internal_alia
#endif
#endif
#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_valid
#undef xmlValidatePopElement
extern __typeof (xmlValidatePopElement) xmlValidatePopElement __attribute((alias("xmlValidatePopElement__internal_alias")));
#else
#ifndef xmlValidatePopElement
extern __typeof (xmlValidatePopElement) xmlValidatePopElement__internal_alias __attribute((visibility("hidden")));
#define xmlValidatePopElement xmlValidatePopElement__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_valid
#undef xmlValidatePushCData
extern __typeof (xmlValidatePushCData) xmlValidatePushCData __attribute((alias("xmlValidatePushCData__internal_alias")));
#else
#ifndef xmlValidatePushCData
extern __typeof (xmlValidatePushCData) xmlValidatePushCData__internal_alias __attribute((visibility("hidden")));
#define xmlValidatePushCData xmlValidatePushCData__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
#ifdef bottom_valid
#undef xmlValidatePushElement
extern __typeof (xmlValidatePushElement) xmlValidatePushElement __attribute((alias("xmlValidatePushElement__internal_alias")));
#else
#ifndef xmlValidatePushElement
extern __typeof (xmlValidatePushElement) xmlValidatePushElement__internal_alias __attribute((visibility("hidden")));
#define xmlValidatePushElement xmlValidatePushElement__internal_alias
#endif
#endif
#endif
#if defined(LIBXML_TREE_ENABLED)
#ifdef bottom_tree
#undef xmlValidateQName

View File

@ -316,11 +316,7 @@ struct _xmlElement {
xmlElementContentPtr content; /* the allowed element content */
xmlAttributePtr attributes; /* List of the declared attributes */
const xmlChar *prefix; /* the namespace prefix if any */
#ifdef LIBXML_REGEXP_ENABLED
xmlRegexpPtr contModel; /* the validating regexp */
#else
void *contModel;
#endif
};

View File

@ -100,13 +100,8 @@ struct _xmlValidCtxt {
int vstateMax; /* Max depth of the validation stack */
xmlValidState *vstateTab; /* array of validation states */
#ifdef LIBXML_REGEXP_ENABLED
xmlAutomataPtr am; /* the automata */
xmlAutomataStatePtr state; /* used to build the automata */
#else
void *am;
void *state;
#endif
};
/*
@ -397,29 +392,6 @@ XMLPUBFUN int XMLCALL
XMLPUBFUN int XMLCALL
xmlValidateNmtokensValue(const xmlChar *value);
#ifdef LIBXML_REGEXP_ENABLED
/*
* Validation based on the regexp support
*/
XMLPUBFUN int XMLCALL
xmlValidBuildContentModel(xmlValidCtxtPtr ctxt,
xmlElementPtr elem);
XMLPUBFUN int XMLCALL
xmlValidatePushElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *qname);
XMLPUBFUN int XMLCALL
xmlValidatePushCData (xmlValidCtxtPtr ctxt,
const xmlChar *data,
int len);
XMLPUBFUN int XMLCALL
xmlValidatePopElement (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
xmlNodePtr elem,
const xmlChar *qname);
#endif /* LIBXML_REGEXP_ENABLED */
#endif /* LIBXML_VALID_ENABLED */
#ifdef __cplusplus
}

View File

@ -13,7 +13,4 @@
#include <libxml/xmlversion.h>
#include <libxml/tree.h>
#ifdef LIBXML_REGEXP_ENABLED
#endif /* LIBXML_REGEXP_ENABLED */
#endif /* __XML_AUTOMATA_H__ */

View File

@ -13,210 +13,5 @@
#include <libxml/xmlversion.h>
#ifdef LIBXML_REGEXP_ENABLED
#ifdef __cplusplus
extern "C" {
#endif
/**
* xmlRegexpPtr:
*
* A libxml regular expression, they can actually be far more complex
* thank the POSIX regex expressions.
*/
typedef struct _xmlRegexp xmlRegexp;
typedef xmlRegexp *xmlRegexpPtr;
/**
* xmlRegExecCtxtPtr:
*
* A libxml progressive regular expression evaluation context
*/
typedef struct _xmlRegExecCtxt xmlRegExecCtxt;
typedef xmlRegExecCtxt *xmlRegExecCtxtPtr;
#ifdef __cplusplus
}
#endif
#include <libxml/tree.h>
#include <libxml/dict.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* The POSIX like API
*/
XMLPUBFUN xmlRegexpPtr XMLCALL
xmlRegexpCompile (const xmlChar *regexp);
XMLPUBFUN void XMLCALL xmlRegFreeRegexp(xmlRegexpPtr regexp);
XMLPUBFUN int XMLCALL
xmlRegexpExec (xmlRegexpPtr comp,
const xmlChar *value);
XMLPUBFUN void XMLCALL
xmlRegexpPrint (FILE *output,
xmlRegexpPtr regexp);
XMLPUBFUN int XMLCALL
xmlRegexpIsDeterminist(xmlRegexpPtr comp);
/**
* xmlRegExecCallbacks:
* @exec: the regular expression context
* @token: the current token string
* @transdata: transition data
* @inputdata: input data
*
* Callback function when doing a transition in the automata
*/
typedef void (*xmlRegExecCallbacks) (xmlRegExecCtxtPtr exec,
const xmlChar *token,
void *transdata,
void *inputdata);
/*
* The progressive API
*/
XMLPUBFUN xmlRegExecCtxtPtr XMLCALL
xmlRegNewExecCtxt (xmlRegexpPtr comp,
xmlRegExecCallbacks callback,
void *data);
XMLPUBFUN void XMLCALL
xmlRegFreeExecCtxt (xmlRegExecCtxtPtr exec);
XMLPUBFUN int XMLCALL
xmlRegExecPushString(xmlRegExecCtxtPtr exec,
const xmlChar *value,
void *data);
XMLPUBFUN int XMLCALL
xmlRegExecPushString2(xmlRegExecCtxtPtr exec,
const xmlChar *value,
const xmlChar *value2,
void *data);
XMLPUBFUN int XMLCALL
xmlRegExecNextValues(xmlRegExecCtxtPtr exec,
int *nbval,
int *nbneg,
xmlChar **values,
int *terminal);
XMLPUBFUN int XMLCALL
xmlRegExecErrInfo (xmlRegExecCtxtPtr exec,
const xmlChar **string,
int *nbval,
int *nbneg,
xmlChar **values,
int *terminal);
#ifdef LIBXML_EXPR_ENABLED
/*
* Formal regular expression handling
* Its goal is to do some formal work on content models
*/
/* expressions are used within a context */
typedef struct _xmlExpCtxt xmlExpCtxt;
typedef xmlExpCtxt *xmlExpCtxtPtr;
XMLPUBFUN void XMLCALL
xmlExpFreeCtxt (xmlExpCtxtPtr ctxt);
XMLPUBFUN xmlExpCtxtPtr XMLCALL
xmlExpNewCtxt (int maxNodes,
xmlDictPtr dict);
XMLPUBFUN int XMLCALL
xmlExpCtxtNbNodes(xmlExpCtxtPtr ctxt);
XMLPUBFUN int XMLCALL
xmlExpCtxtNbCons(xmlExpCtxtPtr ctxt);
/* Expressions are trees but the tree is opaque */
typedef struct _xmlExpNode xmlExpNode;
typedef xmlExpNode *xmlExpNodePtr;
typedef enum {
XML_EXP_EMPTY = 0,
XML_EXP_FORBID = 1,
XML_EXP_ATOM = 2,
XML_EXP_SEQ = 3,
XML_EXP_OR = 4,
XML_EXP_COUNT = 5
} xmlExpNodeType;
/*
* 2 core expressions shared by all for the empty language set
* and for the set with just the empty token
*/
XMLPUBVAR xmlExpNodePtr forbiddenExp;
XMLPUBVAR xmlExpNodePtr emptyExp;
/*
* Expressions are reference counted internally
*/
XMLPUBFUN void XMLCALL
xmlExpFree (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr);
XMLPUBFUN void XMLCALL
xmlExpRef (xmlExpNodePtr expr);
/*
* constructors can be either manual or from a string
*/
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpParse (xmlExpCtxtPtr ctxt,
const char *expr);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewAtom (xmlExpCtxtPtr ctxt,
const xmlChar *name,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewOr (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left,
xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewSeq (xmlExpCtxtPtr ctxt,
xmlExpNodePtr left,
xmlExpNodePtr right);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpNewRange (xmlExpCtxtPtr ctxt,
xmlExpNodePtr subset,
int min,
int max);
/*
* The really interesting APIs
*/
XMLPUBFUN int XMLCALL
xmlExpIsNillable(xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL
xmlExpMaxToken (xmlExpNodePtr expr);
XMLPUBFUN int XMLCALL
xmlExpGetLanguage(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar**langList,
int len);
XMLPUBFUN int XMLCALL
xmlExpGetStart (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar**tokList,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpStringDerive(xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
const xmlChar *str,
int len);
XMLPUBFUN xmlExpNodePtr XMLCALL
xmlExpExpDerive (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
xmlExpNodePtr sub);
XMLPUBFUN int XMLCALL
xmlExpSubsume (xmlExpCtxtPtr ctxt,
xmlExpNodePtr expr,
xmlExpNodePtr sub);
XMLPUBFUN void XMLCALL
xmlExpDump (xmlBufferPtr buf,
xmlExpNodePtr expr);
#endif /* LIBXML_EXPR_ENABLED */
#ifdef __cplusplus
}
#endif
#endif /* LIBXML_REGEXP_ENABLED */
#endif /*__XML_REGEXP_H__ */

View File

@ -157,15 +157,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
#define LIBXML_DEBUG_RUNTIME
#endif
/**
* LIBXML_REGEXP_ENABLED:
*
* Whether the regular expressions interfaces are compiled in
*/
#if 0
#define LIBXML_REGEXP_ENABLED
#endif
/**
* LIBXML_EXPR_ENABLED:
*

View File

@ -827,11 +827,7 @@ xmlHasFeature(xmlFeature feature)
case XML_WITH_UNICODE:
return(0);
case XML_WITH_REGEXP:
#ifdef LIBXML_REGEXP_ENABLED
return(1);
#else
return(0);
#endif
case XML_WITH_AUTOMATA:
return(0);
case XML_WITH_EXPR:

View File

@ -252,89 +252,6 @@ xmlErrValidWarning(xmlValidCtxtPtr ctxt,
}
#ifdef LIBXML_REGEXP_ENABLED
/*
* If regexp are enabled we can do continuous validation without the
* need of a tree to validate the content model. this is done in each
* callbacks.
* Each xmlValidState represent the validation state associated to the
* set of nodes currently open from the document root to the current element.
*/
typedef struct _xmlValidState {
xmlElementPtr elemDecl; /* pointer to the content model */
xmlNodePtr node; /* pointer to the current node */
xmlRegExecCtxtPtr exec; /* regexp runtime */
} _xmlValidState;
static int
vstateVPush(xmlValidCtxtPtr ctxt, xmlElementPtr elemDecl, xmlNodePtr node) {
if ((ctxt->vstateMax == 0) || (ctxt->vstateTab == NULL)) {
ctxt->vstateMax = 10;
ctxt->vstateTab = (xmlValidState *) xmlMalloc(ctxt->vstateMax *
sizeof(ctxt->vstateTab[0]));
if (ctxt->vstateTab == NULL) {
xmlVErrMemory(ctxt, "malloc failed");
return(-1);
}
}
if (ctxt->vstateNr >= ctxt->vstateMax) {
xmlValidState *tmp;
tmp = (xmlValidState *) xmlRealloc(ctxt->vstateTab,
2 * ctxt->vstateMax * sizeof(ctxt->vstateTab[0]));
if (tmp == NULL) {
xmlVErrMemory(ctxt, "realloc failed");
return(-1);
}
ctxt->vstateMax *= 2;
ctxt->vstateTab = tmp;
}
ctxt->vstate = &ctxt->vstateTab[ctxt->vstateNr];
ctxt->vstateTab[ctxt->vstateNr].elemDecl = elemDecl;
ctxt->vstateTab[ctxt->vstateNr].node = node;
if ((elemDecl != NULL) && (elemDecl->etype == XML_ELEMENT_TYPE_ELEMENT)) {
if (elemDecl->contModel == NULL)
xmlValidBuildContentModel(ctxt, elemDecl);
if (elemDecl->contModel != NULL) {
ctxt->vstateTab[ctxt->vstateNr].exec =
xmlRegNewExecCtxt(elemDecl->contModel, NULL, NULL);
} else {
ctxt->vstateTab[ctxt->vstateNr].exec = NULL;
xmlErrValidNode(ctxt, (xmlNodePtr) elemDecl,
XML_ERR_INTERNAL_ERROR,
"Failed to build content model regexp for %s\n",
node->name, NULL, NULL);
}
}
return(ctxt->vstateNr++);
}
static int
vstateVPop(xmlValidCtxtPtr ctxt) {
xmlElementPtr elemDecl;
if (ctxt->vstateNr < 1) return(-1);
ctxt->vstateNr--;
elemDecl = ctxt->vstateTab[ctxt->vstateNr].elemDecl;
ctxt->vstateTab[ctxt->vstateNr].elemDecl = NULL;
ctxt->vstateTab[ctxt->vstateNr].node = NULL;
if ((elemDecl != NULL) && (elemDecl->etype == XML_ELEMENT_TYPE_ELEMENT)) {
xmlRegFreeExecCtxt(ctxt->vstateTab[ctxt->vstateNr].exec);
}
ctxt->vstateTab[ctxt->vstateNr].exec = NULL;
if (ctxt->vstateNr >= 1)
ctxt->vstate = &ctxt->vstateTab[ctxt->vstateNr - 1];
else
ctxt->vstate = NULL;
return(ctxt->vstateNr);
}
#else /* not LIBXML_REGEXP_ENABLED */
/*
* If regexp are not enabled, it uses a home made algorithm less
* complex and easier to
@ -431,8 +348,6 @@ vstateVPop(xmlValidCtxtPtr ctxt) {
return(ctxt->vstateNr);
}
#endif /* LIBXML_REGEXP_ENABLED */
static int
nodeVPush(xmlValidCtxtPtr ctxt, xmlNodePtr value)
{
@ -632,233 +547,6 @@ xmlValidStateDebug(xmlValidCtxtPtr ctxt) {
else if ((doc->intSubset == NULL) && \
(doc->extSubset == NULL)) return(0)
#ifdef LIBXML_REGEXP_ENABLED
/************************************************************************
* *
* Content model validation based on the regexps *
* *
************************************************************************/
/**
* xmlValidBuildAContentModel:
* @content: the content model
* @ctxt: the schema parser context
* @name: the element name whose content is being built
*
* Generate the automata sequence needed for that type
*
* Returns 1 if successful or 0 in case of error.
*/
static int
xmlValidBuildAContentModel(xmlElementContentPtr content,
xmlValidCtxtPtr ctxt,
const xmlChar *name) {
if (content == NULL) {
xmlErrValidNode(ctxt, NULL, XML_ERR_INTERNAL_ERROR,
"Found NULL content in content model of %s\n",
name, NULL, NULL);
return(0);
}
switch (content->type) {
case XML_ELEMENT_CONTENT_PCDATA:
xmlErrValidNode(ctxt, NULL, XML_ERR_INTERNAL_ERROR,
"Found PCDATA in content model of %s\n",
name, NULL, NULL);
return(0);
break;
case XML_ELEMENT_CONTENT_ELEMENT: {
xmlAutomataStatePtr oldstate = ctxt->state;
xmlChar fn[50];
xmlChar *fullname;
fullname = xmlBuildQName(content->name, content->prefix, fn, 50);
if (fullname == NULL) {
xmlVErrMemory(ctxt, "Building content model");
return(0);
}
switch (content->ocur) {
case XML_ELEMENT_CONTENT_ONCE:
ctxt->state = xmlAutomataNewTransition(ctxt->am,
ctxt->state, NULL, fullname, NULL);
break;
case XML_ELEMENT_CONTENT_OPT:
ctxt->state = xmlAutomataNewTransition(ctxt->am,
ctxt->state, NULL, fullname, NULL);
xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
break;
case XML_ELEMENT_CONTENT_PLUS:
ctxt->state = xmlAutomataNewTransition(ctxt->am,
ctxt->state, NULL, fullname, NULL);
xmlAutomataNewTransition(ctxt->am, ctxt->state,
ctxt->state, fullname, NULL);
break;
case XML_ELEMENT_CONTENT_MULT:
ctxt->state = xmlAutomataNewEpsilon(ctxt->am,
ctxt->state, NULL);
xmlAutomataNewTransition(ctxt->am,
ctxt->state, ctxt->state, fullname, NULL);
break;
}
if ((fullname != fn) && (fullname != content->name))
xmlFree(fullname);
break;
}
case XML_ELEMENT_CONTENT_SEQ: {
xmlAutomataStatePtr oldstate, oldend;
xmlElementContentOccur ocur;
/*
* Simply iterate over the content
*/
oldstate = ctxt->state;
ocur = content->ocur;
if (ocur != XML_ELEMENT_CONTENT_ONCE) {
ctxt->state = xmlAutomataNewEpsilon(ctxt->am, oldstate, NULL);
oldstate = ctxt->state;
}
do {
xmlValidBuildAContentModel(content->c1, ctxt, name);
content = content->c2;
} while ((content->type == XML_ELEMENT_CONTENT_SEQ) &&
(content->ocur == XML_ELEMENT_CONTENT_ONCE));
xmlValidBuildAContentModel(content, ctxt, name);
oldend = ctxt->state;
ctxt->state = xmlAutomataNewEpsilon(ctxt->am, oldend, NULL);
switch (ocur) {
case XML_ELEMENT_CONTENT_ONCE:
break;
case XML_ELEMENT_CONTENT_OPT:
xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
break;
case XML_ELEMENT_CONTENT_MULT:
xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
xmlAutomataNewEpsilon(ctxt->am, oldend, oldstate);
break;
case XML_ELEMENT_CONTENT_PLUS:
xmlAutomataNewEpsilon(ctxt->am, oldend, oldstate);
break;
}
break;
}
case XML_ELEMENT_CONTENT_OR: {
xmlAutomataStatePtr oldstate, oldend;
xmlElementContentOccur ocur;
ocur = content->ocur;
if ((ocur == XML_ELEMENT_CONTENT_PLUS) ||
(ocur == XML_ELEMENT_CONTENT_MULT)) {
ctxt->state = xmlAutomataNewEpsilon(ctxt->am,
ctxt->state, NULL);
}
oldstate = ctxt->state;
oldend = xmlAutomataNewState(ctxt->am);
/*
* iterate over the subtypes and remerge the end with an
* epsilon transition
*/
do {
ctxt->state = oldstate;
xmlValidBuildAContentModel(content->c1, ctxt, name);
xmlAutomataNewEpsilon(ctxt->am, ctxt->state, oldend);
content = content->c2;
} while ((content->type == XML_ELEMENT_CONTENT_OR) &&
(content->ocur == XML_ELEMENT_CONTENT_ONCE));
ctxt->state = oldstate;
xmlValidBuildAContentModel(content, ctxt, name);
xmlAutomataNewEpsilon(ctxt->am, ctxt->state, oldend);
ctxt->state = xmlAutomataNewEpsilon(ctxt->am, oldend, NULL);
switch (ocur) {
case XML_ELEMENT_CONTENT_ONCE:
break;
case XML_ELEMENT_CONTENT_OPT:
xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
break;
case XML_ELEMENT_CONTENT_MULT:
xmlAutomataNewEpsilon(ctxt->am, oldstate, ctxt->state);
xmlAutomataNewEpsilon(ctxt->am, oldend, oldstate);
break;
case XML_ELEMENT_CONTENT_PLUS:
xmlAutomataNewEpsilon(ctxt->am, oldend, oldstate);
break;
}
break;
}
default:
xmlErrValid(ctxt, XML_ERR_INTERNAL_ERROR,
"ContentModel broken for element %s\n",
(const char *) name);
return(0);
}
return(1);
}
/**
* xmlValidBuildContentModel:
* @ctxt: a validation context
* @elem: an element declaration node
*
* (Re)Build the automata associated to the content model of this
* element
*
* Returns 1 in case of success, 0 in case of error
*/
int
xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
if ((ctxt == NULL) || (elem == NULL))
return(0);
if (elem->type != XML_ELEMENT_DECL)
return(0);
if (elem->etype != XML_ELEMENT_TYPE_ELEMENT)
return(1);
/* TODO: should we rebuild in this case ? */
if (elem->contModel != NULL) {
if (!xmlRegexpIsDeterminist(elem->contModel)) {
ctxt->valid = 0;
return(0);
}
return(1);
}
ctxt->am = xmlNewAutomata();
if (ctxt->am == NULL) {
xmlErrValidNode(ctxt, (xmlNodePtr) elem,
XML_ERR_INTERNAL_ERROR,
"Cannot create automata for element %s\n",
elem->name, NULL, NULL);
return(0);
}
ctxt->state = xmlAutomataGetInitState(ctxt->am);
xmlValidBuildAContentModel(elem->content, ctxt, elem->name);
xmlAutomataSetFinalState(ctxt->am, ctxt->state);
elem->contModel = xmlAutomataCompile(ctxt->am);
if (xmlRegexpIsDeterminist(elem->contModel) != 1) {
char expr[5000];
expr[0] = 0;
xmlSnprintfElementContent(expr, 5000, elem->content, 1);
xmlErrValidNode(ctxt, (xmlNodePtr) elem,
XML_DTD_CONTENT_NOT_DETERMINIST,
"Content model of %s is not determinist: %s\n",
elem->name, BAD_CAST expr, NULL);
#ifdef DEBUG_REGEXP_ALGO
xmlRegexpPrint(stderr, elem->contModel);
#endif
ctxt->valid = 0;
ctxt->state = NULL;
xmlFreeAutomata(ctxt->am);
ctxt->am = NULL;
return(0);
}
ctxt->state = NULL;
xmlFreeAutomata(ctxt->am);
ctxt->am = NULL;
return(1);
}
#endif /* LIBXML_REGEXP_ENABLED */
/****************************************************************
* *
* Util functions for data allocation/deallocation *
@ -1262,10 +950,6 @@ xmlFreeElement(xmlElementPtr elem) {
xmlFree((xmlChar *) elem->name);
if (elem->prefix != NULL)
xmlFree((xmlChar *) elem->prefix);
#ifdef LIBXML_REGEXP_ENABLED
if (elem->contModel != NULL)
xmlRegFreeRegexp(elem->contModel);
#endif
xmlFree(elem);
}
@ -3861,13 +3545,6 @@ xmlValidateElementDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
if (elem == NULL) return(1);
#if 0
#ifdef LIBXML_REGEXP_ENABLED
/* Build the regexp associated to the content model */
ret = xmlValidBuildContentModel(ctxt, elem);
#endif
#endif
/* No Duplicate Types */
if (elem->etype == XML_ELEMENT_TYPE_MIXED) {
xmlElementContentPtr cur, next;
@ -4350,7 +4027,6 @@ xmlNodePtr elem, const xmlChar *prefix, xmlNsPtr ns, const xmlChar *value) {
return(ret);
}
#ifndef LIBXML_REGEXP_ENABLED
/**
* xmlValidateSkipIgnorable:
* @ctxt: the validation context
@ -4754,7 +4430,6 @@ analyze:
}
return(determinist);
}
#endif
/**
* xmlSnprintfElements:
@ -4854,9 +4529,7 @@ static int
xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child,
xmlElementPtr elemDecl, int warn, xmlNodePtr parent) {
int ret = 1;
#ifndef LIBXML_REGEXP_ENABLED
xmlNodePtr repl = NULL, last = NULL, tmp;
#endif
xmlNodePtr cur;
xmlElementContentPtr cont;
const xmlChar *name;
@ -4866,85 +4539,6 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child,
cont = elemDecl->content;
name = elemDecl->name;
#ifdef LIBXML_REGEXP_ENABLED
/* Build the regexp associated to the content model */
if (elemDecl->contModel == NULL)
ret = xmlValidBuildContentModel(ctxt, elemDecl);
if (elemDecl->contModel == NULL) {
return(-1);
} else {
xmlRegExecCtxtPtr exec;
if (!xmlRegexpIsDeterminist(elemDecl->contModel)) {
return(-1);
}
ctxt->nodeMax = 0;
ctxt->nodeNr = 0;
ctxt->nodeTab = NULL;
exec = xmlRegNewExecCtxt(elemDecl->contModel, NULL, NULL);
if (exec != NULL) {
cur = child;
while (cur != NULL) {
switch (cur->type) {
case XML_ENTITY_REF_NODE:
/*
* Push the current node to be able to roll back
* and process within the entity
*/
if ((cur->children != NULL) &&
(cur->children->children != NULL)) {
nodeVPush(ctxt, cur);
cur = cur->children->children;
continue;
}
break;
case XML_TEXT_NODE:
if (xmlIsBlankNode(cur))
break;
ret = 0;
goto fail;
case XML_CDATA_SECTION_NODE:
/* TODO */
ret = 0;
goto fail;
case XML_ELEMENT_NODE:
if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) {
xmlChar fn[50];
xmlChar *fullname;
fullname = xmlBuildQName(cur->name,
cur->ns->prefix, fn, 50);
if (fullname == NULL) {
ret = -1;
goto fail;
}
ret = xmlRegExecPushString(exec, fullname, NULL);
if ((fullname != fn) && (fullname != cur->name))
xmlFree(fullname);
} else {
ret = xmlRegExecPushString(exec, cur->name, NULL);
}
break;
default:
break;
}
/*
* Switch to next element
*/
cur = cur->next;
while (cur == NULL) {
cur = nodeVPop(ctxt);
if (cur == NULL)
break;
cur = cur->next;
}
}
ret = xmlRegExecPushString(exec, NULL, NULL);
fail:
xmlRegFreeExecCtxt(exec);
}
}
#else /* LIBXML_REGEXP_ENABLED */
/*
* Allocate the stack
*/
@ -5059,7 +4653,6 @@ fail:
STATE = 0;
ret = xmlValidateElementType(ctxt);
}
#endif /* LIBXML_REGEXP_ENABLED */
if ((warn) && ((ret != 1) && (ret != -3))) {
if (ctxt != NULL) {
char expr[5000];
@ -5068,11 +4661,9 @@ fail:
expr[0] = 0;
xmlSnprintfElementContent(&expr[0], 5000, cont, 1);
list[0] = 0;
#ifndef LIBXML_REGEXP_ENABLED
if (repl != NULL)
xmlSnprintfElements(&list[0], 5000, repl, 1);
else
#endif /* LIBXML_REGEXP_ENABLED */
xmlSnprintfElements(&list[0], 5000, child, 1);
if (name != NULL) {
@ -5100,7 +4691,6 @@ fail:
if (ret == -3)
ret = 1;
#ifndef LIBXML_REGEXP_ENABLED
done:
/*
* Deallocate the copy if done, and free up the validation stack
@ -5115,7 +4705,6 @@ done:
xmlFree(ctxt->vstateTab);
ctxt->vstateTab = NULL;
}
#endif
ctxt->nodeMax = 0;
ctxt->nodeNr = 0;
if (ctxt->nodeTab != NULL) {
@ -5321,228 +4910,6 @@ xmlValidGetElemDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
return(elemDecl);
}
#ifdef LIBXML_REGEXP_ENABLED
/**
* xmlValidatePushElement:
* @ctxt: the validation context
* @doc: a document instance
* @elem: an element instance
* @qname: the qualified name as appearing in the serialization
*
* Push a new element start on the validation stack.
*
* returns 1 if no validation problem was found or 0 otherwise
*/
int
xmlValidatePushElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
xmlNodePtr elem, const xmlChar *qname) {
int ret = 1;
xmlElementPtr eDecl;
int extsubset = 0;
if (ctxt == NULL)
return(0);
/* printf("PushElem %s\n", qname); */
if ((ctxt->vstateNr > 0) && (ctxt->vstate != NULL)) {
xmlValidStatePtr state = ctxt->vstate;
xmlElementPtr elemDecl;
/*
* Check the new element agaisnt the content model of the new elem.
*/
if (state->elemDecl != NULL) {
elemDecl = state->elemDecl;
switch(elemDecl->etype) {
case XML_ELEMENT_TYPE_UNDEFINED:
ret = 0;
break;
case XML_ELEMENT_TYPE_EMPTY:
xmlErrValidNode(ctxt, state->node,
XML_DTD_NOT_EMPTY,
"Element %s was declared EMPTY this one has content\n",
state->node->name, NULL, NULL);
ret = 0;
break;
case XML_ELEMENT_TYPE_ANY:
/* I don't think anything is required then */
break;
case XML_ELEMENT_TYPE_MIXED:
/* simple case of declared as #PCDATA */
if ((elemDecl->content != NULL) &&
(elemDecl->content->type ==
XML_ELEMENT_CONTENT_PCDATA)) {
xmlErrValidNode(ctxt, state->node,
XML_DTD_NOT_PCDATA,
"Element %s was declared #PCDATA but contains non text nodes\n",
state->node->name, NULL, NULL);
ret = 0;
} else {
ret = xmlValidateCheckMixed(ctxt, elemDecl->content,
qname);
if (ret != 1) {
xmlErrValidNode(ctxt, state->node,
XML_DTD_INVALID_CHILD,
"Element %s is not declared in %s list of possible children\n",
qname, state->node->name, NULL);
}
}
break;
case XML_ELEMENT_TYPE_ELEMENT:
/*
* TODO:
* VC: Standalone Document Declaration
* - element types with element content, if white space
* occurs directly within any instance of those types.
*/
if (state->exec != NULL) {
ret = xmlRegExecPushString(state->exec, qname, NULL);
if (ret < 0) {
xmlErrValidNode(ctxt, state->node,
XML_DTD_CONTENT_MODEL,
"Element %s content does not follow the DTD, Misplaced %s\n",
state->node->name, qname, NULL);
ret = 0;
} else {
ret = 1;
}
}
break;
}
}
}
eDecl = xmlValidGetElemDecl(ctxt, doc, elem, &extsubset);
vstateVPush(ctxt, eDecl, elem);
return(ret);
}
/**
* xmlValidatePushCData:
* @ctxt: the validation context
* @data: some character data read
* @len: the lenght of the data
*
* check the CData parsed for validation in the current stack
*
* returns 1 if no validation problem was found or 0 otherwise
*/
int
xmlValidatePushCData(xmlValidCtxtPtr ctxt, const xmlChar *data, int len) {
int ret = 1;
/* printf("CDATA %s %d\n", data, len); */
if (ctxt == NULL)
return(0);
if (len <= 0)
return(ret);
if ((ctxt->vstateNr > 0) && (ctxt->vstate != NULL)) {
xmlValidStatePtr state = ctxt->vstate;
xmlElementPtr elemDecl;
/*
* Check the new element agaisnt the content model of the new elem.
*/
if (state->elemDecl != NULL) {
elemDecl = state->elemDecl;
switch(elemDecl->etype) {
case XML_ELEMENT_TYPE_UNDEFINED:
ret = 0;
break;
case XML_ELEMENT_TYPE_EMPTY:
xmlErrValidNode(ctxt, state->node,
XML_DTD_NOT_EMPTY,
"Element %s was declared EMPTY this one has content\n",
state->node->name, NULL, NULL);
ret = 0;
break;
case XML_ELEMENT_TYPE_ANY:
break;
case XML_ELEMENT_TYPE_MIXED:
break;
case XML_ELEMENT_TYPE_ELEMENT:
if (len > 0) {
int i;
for (i = 0;i < len;i++) {
if (!IS_BLANK_CH(data[i])) {
xmlErrValidNode(ctxt, state->node,
XML_DTD_CONTENT_MODEL,
"Element %s content does not follow the DTD, Text not allowed\n",
state->node->name, NULL, NULL);
ret = 0;
goto done;
}
}
/*
* TODO:
* VC: Standalone Document Declaration
* element types with element content, if white space
* occurs directly within any instance of those types.
*/
}
break;
}
}
}
done:
return(ret);
}
/**
* xmlValidatePopElement:
* @ctxt: the validation context
* @doc: a document instance
* @elem: an element instance
* @qname: the qualified name as appearing in the serialization
*
* Pop the element end from the validation stack.
*
* returns 1 if no validation problem was found or 0 otherwise
*/
int
xmlValidatePopElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc ATTRIBUTE_UNUSED,
xmlNodePtr elem ATTRIBUTE_UNUSED,
const xmlChar *qname ATTRIBUTE_UNUSED) {
int ret = 1;
if (ctxt == NULL)
return(0);
/* printf("PopElem %s\n", qname); */
if ((ctxt->vstateNr > 0) && (ctxt->vstate != NULL)) {
xmlValidStatePtr state = ctxt->vstate;
xmlElementPtr elemDecl;
/*
* Check the new element agaisnt the content model of the new elem.
*/
if (state->elemDecl != NULL) {
elemDecl = state->elemDecl;
if (elemDecl->etype == XML_ELEMENT_TYPE_ELEMENT) {
if (state->exec != NULL) {
ret = xmlRegExecPushString(state->exec, NULL, NULL);
if (ret == 0) {
xmlErrValidNode(ctxt, state->node,
XML_DTD_CONTENT_MODEL,
"Element %s content does not follow the DTD, Expecting more child\n",
state->node->name, NULL,NULL);
} else {
/*
* previous validation errors should not generate
* a new one here
*/
ret = 1;
}
}
}
}
vstateVPop(ctxt);
}
return(ret);
}
#endif /* LIBXML_REGEXP_ENABLED */
/**
* xmlValidateOneElement:
* @ctxt: the validation context

View File

@ -864,188 +864,6 @@ xmlTextReaderPushData(xmlTextReaderPtr reader) {
return(0);
}
#ifdef LIBXML_REGEXP_ENABLED
/**
* xmlTextReaderValidatePush:
* @reader: the xmlTextReaderPtr used
*
* Push the current node for validation
*/
static void
xmlTextReaderValidatePush(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) {
xmlNodePtr node = reader->node;
#ifdef LIBXML_VALID_ENABLED
if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
(reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
if ((node->ns == NULL) || (node->ns->prefix == NULL)) {
reader->ctxt->valid &= xmlValidatePushElement(&reader->ctxt->vctxt,
reader->ctxt->myDoc, node, node->name);
} else {
/* TODO use the BuildQName interface */
xmlChar *qname;
qname = xmlStrdup(node->ns->prefix);
qname = xmlStrcat(qname, BAD_CAST ":");
qname = xmlStrcat(qname, node->name);
reader->ctxt->valid &= xmlValidatePushElement(&reader->ctxt->vctxt,
reader->ctxt->myDoc, node, qname);
if (qname != NULL)
xmlFree(qname);
}
}
#endif /* LIBXML_VALID_ENABLED */
}
/**
* xmlTextReaderValidateCData:
* @reader: the xmlTextReaderPtr used
* @data: pointer to the CData
* @len: lenght of the CData block in bytes.
*
* Push some CData for validation
*/
static void
xmlTextReaderValidateCData(xmlTextReaderPtr reader,
const xmlChar *data, int len) {
#ifdef LIBXML_VALID_ENABLED
if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
(reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
reader->ctxt->valid &= xmlValidatePushCData(&reader->ctxt->vctxt,
data, len);
}
#endif /* LIBXML_VALID_ENABLED */
}
/**
* xmlTextReaderValidatePop:
* @reader: the xmlTextReaderPtr used
*
* Pop the current node from validation
*/
static void
xmlTextReaderValidatePop(xmlTextReaderPtr reader) {
xmlNodePtr node = reader->node;
#ifdef LIBXML_VALID_ENABLED
if ((reader->validate == XML_TEXTREADER_VALIDATE_DTD) &&
(reader->ctxt != NULL) && (reader->ctxt->validate == 1)) {
if ((node->ns == NULL) || (node->ns->prefix == NULL)) {
reader->ctxt->valid &= xmlValidatePopElement(&reader->ctxt->vctxt,
reader->ctxt->myDoc, node, node->name);
} else {
/* TODO use the BuildQName interface */
xmlChar *qname;
qname = xmlStrdup(node->ns->prefix);
qname = xmlStrcat(qname, BAD_CAST ":");
qname = xmlStrcat(qname, node->name);
reader->ctxt->valid &= xmlValidatePopElement(&reader->ctxt->vctxt,
reader->ctxt->myDoc, node, qname);
if (qname != NULL)
xmlFree(qname);
}
}
#endif /* LIBXML_VALID_ENABLED */
}
/**
* xmlTextReaderValidateEntity:
* @reader: the xmlTextReaderPtr used
*
* Handle the validation when an entity reference is encountered and
* entity substitution is not activated. As a result the parser interface
* must walk through the entity and do the validation calls
*/
static void
xmlTextReaderValidateEntity(xmlTextReaderPtr reader) {
xmlNodePtr oldnode = reader->node;
xmlNodePtr node = reader->node;
xmlParserCtxtPtr ctxt = reader->ctxt;
do {
if (node->type == XML_ENTITY_REF_NODE) {
/*
* Case where the underlying tree is not availble, lookup the entity
* and walk it.
*/
if ((node->children == NULL) && (ctxt->sax != NULL) &&
(ctxt->sax->getEntity != NULL)) {
node->children = (xmlNodePtr)
ctxt->sax->getEntity(ctxt, node->name);
}
if ((node->children != NULL) &&
(node->children->type == XML_ENTITY_DECL) &&
(node->children->children != NULL)) {
xmlTextReaderEntPush(reader, node);
node = node->children->children;
continue;
} else {
/*
* The error has probably be raised already.
*/
if (node == oldnode)
break;
node = node->next;
}
#ifdef LIBXML_REGEXP_ENABLED
} else if (node->type == XML_ELEMENT_NODE) {
reader->node = node;
xmlTextReaderValidatePush(reader);
} else if ((node->type == XML_TEXT_NODE) ||
(node->type == XML_CDATA_SECTION_NODE)) {
xmlTextReaderValidateCData(reader, node->content,
xmlStrlen(node->content));
#endif
}
/*
* go to next node
*/
if (node->children != NULL) {
node = node->children;
continue;
} else if (node->type == XML_ELEMENT_NODE) {
xmlTextReaderValidatePop(reader);
}
if (node->next != NULL) {
node = node->next;
continue;
}
do {
node = node->parent;
if (node->type == XML_ELEMENT_NODE) {
xmlNodePtr tmp;
if (reader->entNr == 0) {
while ((tmp = node->last) != NULL) {
if ((tmp->extra & NODE_IS_PRESERVED) == 0) {
xmlUnlinkNode(tmp);
xmlTextReaderFreeNode(reader, tmp);
} else
break;
}
}
reader->node = node;
xmlTextReaderValidatePop(reader);
}
if ((node->type == XML_ENTITY_DECL) &&
(reader->ent != NULL) && (reader->ent->children == node)) {
node = xmlTextReaderEntPop(reader);
}
if (node == oldnode)
break;
if (node->next != NULL) {
node = node->next;
break;
}
} while ((node != NULL) && (node != oldnode));
} while ((node != NULL) && (node != oldnode));
reader->node = oldnode;
}
#endif /* LIBXML_REGEXP_ENABLED */
/**
* xmlTextReaderGetSuccessor:
* @cur: the current node
@ -1274,11 +1092,6 @@ get_next_node:
reader->state = XML_TEXTREADER_END;
goto node_found;
}
#ifdef LIBXML_REGEXP_ENABLED
if ((reader->validate) &&
(reader->node->type == XML_ELEMENT_NODE))
xmlTextReaderValidatePop(reader);
#endif /* LIBXML_REGEXP_ENABLED */
if ((reader->preserves > 0) &&
(reader->node->extra & NODE_IS_SPRESERVED))
reader->preserves--;
@ -1309,10 +1122,6 @@ get_next_node:
reader->state = XML_TEXTREADER_END;
goto node_found;
}
#ifdef LIBXML_REGEXP_ENABLED
if ((reader->validate) && (reader->node->type == XML_ELEMENT_NODE))
xmlTextReaderValidatePop(reader);
#endif /* LIBXML_REGEXP_ENABLED */
if ((reader->preserves > 0) &&
(reader->node->extra & NODE_IS_SPRESERVED))
reader->preserves--;
@ -1390,12 +1199,6 @@ node_found:
xmlTextReaderEntPush(reader, reader->node);
reader->node = reader->node->children->children;
}
#ifdef LIBXML_REGEXP_ENABLED
} else if ((reader->node != NULL) &&
(reader->node->type == XML_ENTITY_REF_NODE) &&
(reader->ctxt != NULL) && (reader->validate)) {
xmlTextReaderValidateEntity(reader);
#endif /* LIBXML_REGEXP_ENABLED */
}
if ((reader->node != NULL) &&
(reader->node->type == XML_ENTITY_DECL) &&
@ -1404,21 +1207,6 @@ node_found:
reader->depth++;
goto get_next_node;
}
#ifdef LIBXML_REGEXP_ENABLED
if ((reader->validate) && (reader->node != NULL)) {
xmlNodePtr node = reader->node;
if ((node->type == XML_ELEMENT_NODE) &&
((reader->state != XML_TEXTREADER_END) &&
(reader->state != XML_TEXTREADER_BACKTRACK))) {
xmlTextReaderValidatePush(reader);
} else if ((node->type == XML_TEXT_NODE) ||
(node->type == XML_CDATA_SECTION_NODE)) {
xmlTextReaderValidateCData(reader, node->content,
xmlStrlen(node->content));
}
}
#endif /* LIBXML_REGEXP_ENABLED */
return(1);
node_end:
reader->state = XML_TEXTREADER_DONE;

File diff suppressed because it is too large Load Diff