mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
(libxml2) Remove LIBXML_SCHEMAS_ENABLED
This commit is contained in:
parent
818a204fbc
commit
aeceadc3e3
@ -39,7 +39,6 @@ LOCAL_LIBXML_SRC_FILES = $(LIBXML_PATH)/c14n.c \
|
||||
$(LIBXML_PATH)/list.c \
|
||||
$(LIBXML_PATH)/parser.c \
|
||||
$(LIBXML_PATH)/parserInternals.c \
|
||||
$(LIBXML_PATH)/relaxng.c \
|
||||
$(LIBXML_PATH)/SAX.c \
|
||||
$(LIBXML_PATH)/SAX2.c \
|
||||
$(LIBXML_PATH)/threads.c \
|
||||
@ -52,8 +51,6 @@ LOCAL_LIBXML_SRC_FILES = $(LIBXML_PATH)/c14n.c \
|
||||
$(LIBXML_PATH)/xmlreader.c \
|
||||
$(LIBXML_PATH)/xmlregexp.c \
|
||||
$(LIBXML_PATH)/xmlsave.c \
|
||||
$(LIBXML_PATH)/xmlschemas.c \
|
||||
$(LIBXML_PATH)/xmlschemastypes.c \
|
||||
$(LIBXML_PATH)/xmlstring.c \
|
||||
$(LIBXML_PATH)/xmlunicode.c \
|
||||
$(LIBXML_PATH)/xmlwriter.c
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -14,200 +14,5 @@
|
||||
#include <libxml/hash.h>
|
||||
#include <libxml/xmlstring.h>
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _xmlRelaxNG xmlRelaxNG;
|
||||
typedef xmlRelaxNG *xmlRelaxNGPtr;
|
||||
|
||||
|
||||
/**
|
||||
* xmlRelaxNGValidityErrorFunc:
|
||||
* @ctx: the validation context
|
||||
* @msg: the message
|
||||
* @...: extra arguments
|
||||
*
|
||||
* Signature of an error callback from a Relax-NG validation
|
||||
*/
|
||||
typedef void (XMLCDECL *xmlRelaxNGValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
||||
|
||||
/**
|
||||
* xmlRelaxNGValidityWarningFunc:
|
||||
* @ctx: the validation context
|
||||
* @msg: the message
|
||||
* @...: extra arguments
|
||||
*
|
||||
* Signature of a warning callback from a Relax-NG validation
|
||||
*/
|
||||
typedef void (XMLCDECL *xmlRelaxNGValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
||||
|
||||
/**
|
||||
* A schemas validation context
|
||||
*/
|
||||
typedef struct _xmlRelaxNGParserCtxt xmlRelaxNGParserCtxt;
|
||||
typedef xmlRelaxNGParserCtxt *xmlRelaxNGParserCtxtPtr;
|
||||
|
||||
typedef struct _xmlRelaxNGValidCtxt xmlRelaxNGValidCtxt;
|
||||
typedef xmlRelaxNGValidCtxt *xmlRelaxNGValidCtxtPtr;
|
||||
|
||||
/*
|
||||
* xmlRelaxNGValidErr:
|
||||
*
|
||||
* 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;
|
||||
|
||||
/*
|
||||
* xmlRelaxNGParserFlags:
|
||||
*
|
||||
* 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 XMLCALL
|
||||
xmlRelaxNGInitTypes (void);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGCleanupTypes (void);
|
||||
|
||||
/*
|
||||
* Interfaces for parsing.
|
||||
*/
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
|
||||
xmlRelaxNGNewParserCtxt (const char *URL);
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
|
||||
xmlRelaxNGNewMemParserCtxt (const char *buffer,
|
||||
int size);
|
||||
XMLPUBFUN xmlRelaxNGParserCtxtPtr XMLCALL
|
||||
xmlRelaxNGNewDocParserCtxt (xmlDocPtr doc);
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxParserSetFlag (xmlRelaxNGParserCtxtPtr ctxt,
|
||||
int flag);
|
||||
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGFreeParserCtxt (xmlRelaxNGParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGSetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
|
||||
xmlRelaxNGValidityErrorFunc err,
|
||||
xmlRelaxNGValidityWarningFunc warn,
|
||||
void *ctx);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGGetParserErrors(xmlRelaxNGParserCtxtPtr ctxt,
|
||||
xmlRelaxNGValidityErrorFunc *err,
|
||||
xmlRelaxNGValidityWarningFunc *warn,
|
||||
void **ctx);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGSetParserStructuredErrors(
|
||||
xmlRelaxNGParserCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror,
|
||||
void *ctx);
|
||||
XMLPUBFUN xmlRelaxNGPtr XMLCALL
|
||||
xmlRelaxNGParse (xmlRelaxNGParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGFree (xmlRelaxNGPtr schema);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGDump (FILE *output,
|
||||
xmlRelaxNGPtr schema);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGDumpTree (FILE * output,
|
||||
xmlRelaxNGPtr schema);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
/*
|
||||
* Interfaces for validating
|
||||
*/
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGSetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlRelaxNGValidityErrorFunc err,
|
||||
xmlRelaxNGValidityWarningFunc warn,
|
||||
void *ctx);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGGetValidErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlRelaxNGValidityErrorFunc *err,
|
||||
xmlRelaxNGValidityWarningFunc *warn,
|
||||
void **ctx);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGSetValidStructuredErrors(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror, void *ctx);
|
||||
XMLPUBFUN xmlRelaxNGValidCtxtPtr XMLCALL
|
||||
xmlRelaxNGNewValidCtxt (xmlRelaxNGPtr schema);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlRelaxNGFreeValidCtxt (xmlRelaxNGValidCtxtPtr ctxt);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc);
|
||||
/*
|
||||
* Interfaces for progressive validation when possible
|
||||
*/
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGValidatePushElement (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGValidatePushCData (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
const xmlChar *data,
|
||||
int len);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGValidatePopElement (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRelaxNGValidateFullElement (xmlRelaxNGValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr elem);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
|
||||
#endif /* __XML_RELAX_NG__ */
|
||||
|
@ -16,943 +16,4 @@
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
||||
#include <libxml/xmlregexp.h>
|
||||
#include <libxml/hash.h>
|
||||
#include <libxml/dict.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
XML_SCHEMAS_UNKNOWN = 0,
|
||||
XML_SCHEMAS_STRING,
|
||||
XML_SCHEMAS_NORMSTRING,
|
||||
XML_SCHEMAS_DECIMAL,
|
||||
XML_SCHEMAS_TIME,
|
||||
XML_SCHEMAS_GDAY,
|
||||
XML_SCHEMAS_GMONTH,
|
||||
XML_SCHEMAS_GMONTHDAY,
|
||||
XML_SCHEMAS_GYEAR,
|
||||
XML_SCHEMAS_GYEARMONTH,
|
||||
XML_SCHEMAS_DATE,
|
||||
XML_SCHEMAS_DATETIME,
|
||||
XML_SCHEMAS_DURATION,
|
||||
XML_SCHEMAS_FLOAT,
|
||||
XML_SCHEMAS_DOUBLE,
|
||||
XML_SCHEMAS_BOOLEAN,
|
||||
XML_SCHEMAS_TOKEN,
|
||||
XML_SCHEMAS_LANGUAGE,
|
||||
XML_SCHEMAS_NMTOKEN,
|
||||
XML_SCHEMAS_NMTOKENS,
|
||||
XML_SCHEMAS_NAME,
|
||||
XML_SCHEMAS_QNAME,
|
||||
XML_SCHEMAS_NCNAME,
|
||||
XML_SCHEMAS_ID,
|
||||
XML_SCHEMAS_IDREF,
|
||||
XML_SCHEMAS_IDREFS,
|
||||
XML_SCHEMAS_ENTITY,
|
||||
XML_SCHEMAS_ENTITIES,
|
||||
XML_SCHEMAS_NOTATION,
|
||||
XML_SCHEMAS_ANYURI,
|
||||
XML_SCHEMAS_INTEGER,
|
||||
XML_SCHEMAS_NPINTEGER,
|
||||
XML_SCHEMAS_NINTEGER,
|
||||
XML_SCHEMAS_NNINTEGER,
|
||||
XML_SCHEMAS_PINTEGER,
|
||||
XML_SCHEMAS_INT,
|
||||
XML_SCHEMAS_UINT,
|
||||
XML_SCHEMAS_LONG,
|
||||
XML_SCHEMAS_ULONG,
|
||||
XML_SCHEMAS_SHORT,
|
||||
XML_SCHEMAS_USHORT,
|
||||
XML_SCHEMAS_BYTE,
|
||||
XML_SCHEMAS_UBYTE,
|
||||
XML_SCHEMAS_HEXBINARY,
|
||||
XML_SCHEMAS_BASE64BINARY,
|
||||
XML_SCHEMAS_ANYTYPE,
|
||||
XML_SCHEMAS_ANYSIMPLETYPE
|
||||
} 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;
|
||||
|
||||
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;
|
||||
|
||||
typedef struct _xmlSchemaVal xmlSchemaVal;
|
||||
typedef xmlSchemaVal *xmlSchemaValPtr;
|
||||
|
||||
typedef struct _xmlSchemaType xmlSchemaType;
|
||||
typedef xmlSchemaType *xmlSchemaTypePtr;
|
||||
|
||||
typedef struct _xmlSchemaFacet xmlSchemaFacet;
|
||||
typedef xmlSchemaFacet *xmlSchemaFacetPtr;
|
||||
|
||||
/**
|
||||
* Annotation
|
||||
*/
|
||||
typedef struct _xmlSchemaAnnot xmlSchemaAnnot;
|
||||
typedef xmlSchemaAnnot *xmlSchemaAnnotPtr;
|
||||
struct _xmlSchemaAnnot {
|
||||
struct _xmlSchemaAnnot *next;
|
||||
xmlNodePtr content; /* the annotation */
|
||||
};
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_ANYATTR_SKIP:
|
||||
*
|
||||
* Skip unknown attribute from validation
|
||||
* Obsolete, not used anymore.
|
||||
*/
|
||||
#define XML_SCHEMAS_ANYATTR_SKIP 1
|
||||
/**
|
||||
* XML_SCHEMAS_ANYATTR_LAX:
|
||||
*
|
||||
* Ignore validation non definition on attributes
|
||||
* Obsolete, not used anymore.
|
||||
*/
|
||||
#define XML_SCHEMAS_ANYATTR_LAX 2
|
||||
/**
|
||||
* XML_SCHEMAS_ANYATTR_STRICT:
|
||||
*
|
||||
* Apply strict validation rules on attributes
|
||||
* Obsolete, not used anymore.
|
||||
*/
|
||||
#define XML_SCHEMAS_ANYATTR_STRICT 3
|
||||
/**
|
||||
* XML_SCHEMAS_ANY_SKIP:
|
||||
*
|
||||
* Skip unknown attribute from validation
|
||||
*/
|
||||
#define XML_SCHEMAS_ANY_SKIP 1
|
||||
/**
|
||||
* XML_SCHEMAS_ANY_LAX:
|
||||
*
|
||||
* Used by wildcards.
|
||||
* Validate if type found, don't worry if not found
|
||||
*/
|
||||
#define XML_SCHEMAS_ANY_LAX 2
|
||||
/**
|
||||
* XML_SCHEMAS_ANY_STRICT:
|
||||
*
|
||||
* Used by wildcards.
|
||||
* Apply strict validation rules
|
||||
*/
|
||||
#define XML_SCHEMAS_ANY_STRICT 3
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_USE_PROHIBITED:
|
||||
*
|
||||
* Used by wildcards.
|
||||
* The attribute is prohibited.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_USE_PROHIBITED 0
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_USE_REQUIRED:
|
||||
*
|
||||
* The attribute is required.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_USE_REQUIRED 1
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_USE_OPTIONAL:
|
||||
*
|
||||
* The attribute is optional.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_USE_OPTIONAL 2
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_GLOBAL:
|
||||
*
|
||||
* allow elements in no namespace
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_GLOBAL 1 << 0
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_NSDEFAULT:
|
||||
*
|
||||
* allow elements in no namespace
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_NSDEFAULT 1 << 7
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_INTERNAL_RESOLVED:
|
||||
*
|
||||
* this is set when the "type" and "ref" references
|
||||
* have been resolved.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_INTERNAL_RESOLVED 1 << 8
|
||||
/**
|
||||
* XML_SCHEMAS_ATTR_FIXED:
|
||||
*
|
||||
* the attribute has a fixed value
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTR_FIXED 1 << 9
|
||||
|
||||
/**
|
||||
* xmlSchemaAttribute:
|
||||
* An attribute definition.
|
||||
*/
|
||||
|
||||
typedef struct _xmlSchemaAttribute xmlSchemaAttribute;
|
||||
typedef xmlSchemaAttribute *xmlSchemaAttributePtr;
|
||||
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 */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
|
||||
xmlSchemaTypePtr base; /* Deprecated; not used */
|
||||
int occurs; /* Deprecated; not used */
|
||||
const xmlChar *defValue; /* The initial value of the value constraint */
|
||||
xmlSchemaTypePtr subtypes; /* the type definition */
|
||||
xmlNodePtr node;
|
||||
const xmlChar *targetNamespace;
|
||||
int flags;
|
||||
const xmlChar *refPrefix; /* Deprecated; not used */
|
||||
xmlSchemaValPtr defVal; /* The compiled value constraint */
|
||||
xmlSchemaAttributePtr refDecl; /* Deprecated; not used */
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlSchemaAttributeLink:
|
||||
* Used to build a list of attribute uses on complexType definitions.
|
||||
* WARNING: Deprecated; not used.
|
||||
*/
|
||||
typedef struct _xmlSchemaAttributeLink xmlSchemaAttributeLink;
|
||||
typedef xmlSchemaAttributeLink *xmlSchemaAttributeLinkPtr;
|
||||
struct _xmlSchemaAttributeLink {
|
||||
struct _xmlSchemaAttributeLink *next;/* the next attribute link ... */
|
||||
struct _xmlSchemaAttribute *attr;/* the linked attribute */
|
||||
};
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_WILDCARD_COMPLETE:
|
||||
*
|
||||
* If the wildcard is complete.
|
||||
*/
|
||||
#define XML_SCHEMAS_WILDCARD_COMPLETE 1 << 0
|
||||
|
||||
/**
|
||||
* xmlSchemaCharValueLink:
|
||||
* Used to build a list of namespaces on wildcards.
|
||||
*/
|
||||
typedef struct _xmlSchemaWildcardNs xmlSchemaWildcardNs;
|
||||
typedef xmlSchemaWildcardNs *xmlSchemaWildcardNsPtr;
|
||||
struct _xmlSchemaWildcardNs {
|
||||
struct _xmlSchemaWildcardNs *next;/* the next constraint link ... */
|
||||
const xmlChar *value;/* the value */
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlSchemaWildcard.
|
||||
* A wildcard.
|
||||
*/
|
||||
typedef struct _xmlSchemaWildcard xmlSchemaWildcard;
|
||||
typedef xmlSchemaWildcard *xmlSchemaWildcardPtr;
|
||||
struct _xmlSchemaWildcard {
|
||||
xmlSchemaTypeType type; /* The kind of type */
|
||||
const xmlChar *id; /* Deprecated; not used */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
xmlNodePtr node;
|
||||
int minOccurs; /* Deprecated; not used */
|
||||
int maxOccurs; /* Deprecated; not used */
|
||||
int processContents;
|
||||
int any; /* Indicates if the ns constraint is of ##any */
|
||||
xmlSchemaWildcardNsPtr nsSet; /* The list of allowed namespaces */
|
||||
xmlSchemaWildcardNsPtr negNsSet; /* The negated namespace */
|
||||
int flags;
|
||||
};
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED:
|
||||
*
|
||||
* The attribute wildcard has been already builded.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTRGROUP_WILDCARD_BUILDED 1 << 0
|
||||
/**
|
||||
* XML_SCHEMAS_ATTRGROUP_GLOBAL:
|
||||
*
|
||||
* The attribute wildcard has been already builded.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTRGROUP_GLOBAL 1 << 1
|
||||
/**
|
||||
* XML_SCHEMAS_ATTRGROUP_MARKED:
|
||||
*
|
||||
* Marks the attr group as marked; used for circular checks.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTRGROUP_MARKED 1 << 2
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_ATTRGROUP_REDEFINED:
|
||||
*
|
||||
* The attr group was redefined.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTRGROUP_REDEFINED 1 << 3
|
||||
/**
|
||||
* XML_SCHEMAS_ATTRGROUP_HAS_REFS:
|
||||
*
|
||||
* Whether this attr. group contains attr. group references.
|
||||
*/
|
||||
#define XML_SCHEMAS_ATTRGROUP_HAS_REFS 1 << 4
|
||||
|
||||
/**
|
||||
* An attribute group definition.
|
||||
*
|
||||
* xmlSchemaAttribute and xmlSchemaAttributeGroup start of structures
|
||||
* must be kept similar
|
||||
*/
|
||||
typedef struct _xmlSchemaAttributeGroup xmlSchemaAttributeGroup;
|
||||
typedef xmlSchemaAttributeGroup *xmlSchemaAttributeGroupPtr;
|
||||
struct _xmlSchemaAttributeGroup {
|
||||
xmlSchemaTypeType type; /* The kind of type */
|
||||
struct _xmlSchemaAttribute *next;/* the next attribute if in a group ... */
|
||||
const xmlChar *name;
|
||||
const xmlChar *id;
|
||||
const xmlChar *ref; /* Deprecated; not used */
|
||||
const xmlChar *refNs; /* Deprecated; not used */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
|
||||
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
|
||||
xmlNodePtr node;
|
||||
int flags;
|
||||
xmlSchemaWildcardPtr attributeWildcard;
|
||||
const xmlChar *refPrefix; /* Deprecated; not used */
|
||||
xmlSchemaAttributeGroupPtr refItem; /* Deprecated; not used */
|
||||
const xmlChar *targetNamespace;
|
||||
void *attrUses;
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlSchemaTypeLink:
|
||||
* Used to build a list of types (e.g. member types of
|
||||
* simpleType with variety "union").
|
||||
*/
|
||||
typedef struct _xmlSchemaTypeLink xmlSchemaTypeLink;
|
||||
typedef xmlSchemaTypeLink *xmlSchemaTypeLinkPtr;
|
||||
struct _xmlSchemaTypeLink {
|
||||
struct _xmlSchemaTypeLink *next;/* the next type link ... */
|
||||
xmlSchemaTypePtr type;/* the linked type */
|
||||
};
|
||||
|
||||
/**
|
||||
* xmlSchemaFacetLink:
|
||||
* Used to build a list of facets.
|
||||
*/
|
||||
typedef struct _xmlSchemaFacetLink xmlSchemaFacetLink;
|
||||
typedef xmlSchemaFacetLink *xmlSchemaFacetLinkPtr;
|
||||
struct _xmlSchemaFacetLink {
|
||||
struct _xmlSchemaFacetLink *next;/* the next facet link ... */
|
||||
xmlSchemaFacetPtr facet;/* the linked facet */
|
||||
};
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_MIXED:
|
||||
*
|
||||
* the element content type is mixed
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_MIXED 1 << 0
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION:
|
||||
*
|
||||
* the simple or complex type has a derivation method of "extension".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_EXTENSION 1 << 1
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION:
|
||||
*
|
||||
* the simple or complex type has a derivation method of "restriction".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_DERIVATION_METHOD_RESTRICTION 1 << 2
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_GLOBAL:
|
||||
*
|
||||
* the type is global
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_GLOBAL 1 << 3
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_OWNED_ATTR_WILDCARD:
|
||||
*
|
||||
* 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. */
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_VARIETY_ABSENT:
|
||||
*
|
||||
* 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
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_VARIETY_LIST:
|
||||
*
|
||||
* the simpleType has a variety of "list".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_VARIETY_LIST 1 << 6
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_VARIETY_UNION:
|
||||
*
|
||||
* the simpleType has a variety of "union".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_VARIETY_UNION 1 << 7
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_VARIETY_ATOMIC:
|
||||
*
|
||||
* the simpleType has a variety of "union".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_VARIETY_ATOMIC 1 << 8
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FINAL_EXTENSION:
|
||||
*
|
||||
* the complexType has a final of "extension".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FINAL_EXTENSION 1 << 9
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FINAL_RESTRICTION:
|
||||
*
|
||||
* the simpleType/complexType has a final of "restriction".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FINAL_RESTRICTION 1 << 10
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FINAL_LIST:
|
||||
*
|
||||
* the simpleType has a final of "list".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FINAL_LIST 1 << 11
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FINAL_UNION:
|
||||
*
|
||||
* the simpleType has a final of "union".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FINAL_UNION 1 << 12
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FINAL_DEFAULT:
|
||||
*
|
||||
* the simpleType has a final of "default".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FINAL_DEFAULT 1 << 13
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE:
|
||||
*
|
||||
* Marks the item as a builtin primitive.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE 1 << 14
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_MARKED:
|
||||
*
|
||||
* Marks the item as marked; used for circular checks.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_MARKED 1 << 16
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_BLOCK_DEFAULT:
|
||||
*
|
||||
* the complexType did not specify 'block' so use the default of the
|
||||
* <schema> item.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_BLOCK_DEFAULT 1 << 17
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_BLOCK_EXTENSION:
|
||||
*
|
||||
* the complexType has a 'block' of "extension".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_BLOCK_EXTENSION 1 << 18
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_BLOCK_RESTRICTION:
|
||||
*
|
||||
* the complexType has a 'block' of "restriction".
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_BLOCK_RESTRICTION 1 << 19
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_ABSTRACT:
|
||||
*
|
||||
* the simple/complexType is abstract.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_ABSTRACT 1 << 20
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FACETSNEEDVALUE:
|
||||
*
|
||||
* indicates if the facets need a computed value
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FACETSNEEDVALUE 1 << 21
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_INTERNAL_RESOLVED:
|
||||
*
|
||||
* indicates that the type was typefixed
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_INTERNAL_RESOLVED 1 << 22
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_INTERNAL_INVALID:
|
||||
*
|
||||
* indicates that the type is invalid
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_INTERNAL_INVALID 1 << 23
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE:
|
||||
*
|
||||
* a whitespace-facet value of "preserve"
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_WHITESPACE_PRESERVE 1 << 24
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_WHITESPACE_REPLACE:
|
||||
*
|
||||
* a whitespace-facet value of "replace"
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_WHITESPACE_REPLACE 1 << 25
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE:
|
||||
*
|
||||
* a whitespace-facet value of "collapse"
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_WHITESPACE_COLLAPSE 1 << 26
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_HAS_FACETS:
|
||||
*
|
||||
* has facets
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_HAS_FACETS 1 << 27
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_NORMVALUENEEDED:
|
||||
*
|
||||
* indicates if the facets (pattern) need a normalized value
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_NORMVALUENEEDED 1 << 28
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_FIXUP_1:
|
||||
*
|
||||
* First stage of fixup was done.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_FIXUP_1 1 << 29
|
||||
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_REDEFINED:
|
||||
*
|
||||
* The type was redefined.
|
||||
*/
|
||||
#define XML_SCHEMAS_TYPE_REDEFINED 1 << 30
|
||||
/**
|
||||
* XML_SCHEMAS_TYPE_REDEFINING:
|
||||
*
|
||||
* The type redefines an other type.
|
||||
*/
|
||||
/* #define XML_SCHEMAS_TYPE_REDEFINING 1 << 31 */
|
||||
|
||||
/**
|
||||
* _xmlSchemaType:
|
||||
*
|
||||
* 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 */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
xmlSchemaTypePtr subtypes;
|
||||
xmlSchemaAttributePtr attributes; /* Deprecated; not used */
|
||||
xmlNodePtr 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 */
|
||||
xmlSchemaTypePtr baseType; /* The base type component */
|
||||
xmlSchemaFacetPtr facets; /* Local facets */
|
||||
struct _xmlSchemaType *redef; /* Deprecated; not used */
|
||||
int recurse; /* Obsolete */
|
||||
xmlSchemaAttributeLinkPtr *attributeUses; /* Deprecated; not used */
|
||||
xmlSchemaWildcardPtr attributeWildcard;
|
||||
int builtInType; /* Type of built-in types. */
|
||||
xmlSchemaTypeLinkPtr memberTypes; /* member-types if a union type. */
|
||||
xmlSchemaFacetLinkPtr facetSet; /* All facets (incl. inherited) */
|
||||
const xmlChar *refPrefix; /* Deprecated; not used */
|
||||
xmlSchemaTypePtr contentTypeDef; /* Used for the simple content of complex types.
|
||||
Could we use @subtypes for this? */
|
||||
xmlRegexpPtr contModel; /* Holds the automaton of the content model */
|
||||
const xmlChar *targetNamespace;
|
||||
void *attrUses;
|
||||
};
|
||||
|
||||
/*
|
||||
* xmlSchemaElement:
|
||||
* An element definition.
|
||||
*
|
||||
* xmlSchemaType, xmlSchemaFacet and xmlSchemaElement start of
|
||||
* structures must be kept similar
|
||||
*/
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_NILLABLE:
|
||||
*
|
||||
* the element is nillable
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_NILLABLE 1 << 0
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_GLOBAL:
|
||||
*
|
||||
* the element is global
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_GLOBAL 1 << 1
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_DEFAULT:
|
||||
*
|
||||
* the element has a default value
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_DEFAULT 1 << 2
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_FIXED:
|
||||
*
|
||||
* the element has a fixed value
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_FIXED 1 << 3
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_ABSTRACT:
|
||||
*
|
||||
* the element is abstract
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_ABSTRACT 1 << 4
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_TOPLEVEL:
|
||||
*
|
||||
* the element is top level
|
||||
* obsolete: use XML_SCHEMAS_ELEM_GLOBAL instead
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_TOPLEVEL 1 << 5
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_REF:
|
||||
*
|
||||
* the element is a reference to a type
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_REF 1 << 6
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_NSDEFAULT:
|
||||
*
|
||||
* allow elements in no namespace
|
||||
* Obsolete, not used anymore.
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_NSDEFAULT 1 << 7
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_INTERNAL_RESOLVED:
|
||||
*
|
||||
* this is set when "type", "ref", "substitutionGroup"
|
||||
* references have been resolved.
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_INTERNAL_RESOLVED 1 << 8
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_CIRCULAR:
|
||||
*
|
||||
* a helper flag for the search of circular references.
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_CIRCULAR 1 << 9
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_BLOCK_ABSENT:
|
||||
*
|
||||
* the "block" attribute is absent
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_BLOCK_ABSENT 1 << 10
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_BLOCK_EXTENSION:
|
||||
*
|
||||
* disallowed substitutions are absent
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_BLOCK_EXTENSION 1 << 11
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_BLOCK_RESTRICTION:
|
||||
*
|
||||
* disallowed substitutions: "restriction"
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_BLOCK_RESTRICTION 1 << 12
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION:
|
||||
*
|
||||
* disallowed substitutions: "substituion"
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_BLOCK_SUBSTITUTION 1 << 13
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_FINAL_ABSENT:
|
||||
*
|
||||
* substitution group exclusions are absent
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_FINAL_ABSENT 1 << 14
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_FINAL_EXTENSION:
|
||||
*
|
||||
* substitution group exclusions: "extension"
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_FINAL_EXTENSION 1 << 15
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_FINAL_RESTRICTION:
|
||||
*
|
||||
* substitution group exclusions: "restriction"
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_FINAL_RESTRICTION 1 << 16
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD:
|
||||
*
|
||||
* the declaration is a substitution group head
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_SUBST_GROUP_HEAD 1 << 17
|
||||
/**
|
||||
* XML_SCHEMAS_ELEM_INTERNAL_CHECKED:
|
||||
*
|
||||
* this is set when the elem decl has been checked against
|
||||
* all constraints
|
||||
*/
|
||||
#define XML_SCHEMAS_ELEM_INTERNAL_CHECKED 1 << 18
|
||||
|
||||
typedef struct _xmlSchemaElement xmlSchemaElement;
|
||||
typedef xmlSchemaElement *xmlSchemaElementPtr;
|
||||
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 */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
xmlSchemaTypePtr subtypes; /* the type definition */
|
||||
xmlSchemaAttributePtr attributes;
|
||||
xmlNodePtr 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 */
|
||||
xmlRegexpPtr contModel; /* Obsolete for WXS, maybe used for RelaxNG */
|
||||
xmlSchemaContentType contentType;
|
||||
const xmlChar *refPrefix; /* Deprecated; not used */
|
||||
xmlSchemaValPtr defVal; /* The compiled value contraint. */
|
||||
void *idcs; /* The identity-constraint defs */
|
||||
};
|
||||
|
||||
/*
|
||||
* XML_SCHEMAS_FACET_UNKNOWN:
|
||||
*
|
||||
* unknown facet handling
|
||||
*/
|
||||
#define XML_SCHEMAS_FACET_UNKNOWN 0
|
||||
/*
|
||||
* XML_SCHEMAS_FACET_PRESERVE:
|
||||
*
|
||||
* preserve the type of the facet
|
||||
*/
|
||||
#define XML_SCHEMAS_FACET_PRESERVE 1
|
||||
/*
|
||||
* XML_SCHEMAS_FACET_REPLACE:
|
||||
*
|
||||
* replace the type of the facet
|
||||
*/
|
||||
#define XML_SCHEMAS_FACET_REPLACE 2
|
||||
/*
|
||||
* XML_SCHEMAS_FACET_COLLAPSE:
|
||||
*
|
||||
* collapse the types of the facet
|
||||
*/
|
||||
#define XML_SCHEMAS_FACET_COLLAPSE 3
|
||||
/**
|
||||
* A facet definition.
|
||||
*/
|
||||
struct _xmlSchemaFacet {
|
||||
xmlSchemaTypeType type; /* The kind of type */
|
||||
struct _xmlSchemaFacet *next;/* the next type if in a sequence ... */
|
||||
const xmlChar *value; /* The original value */
|
||||
const xmlChar *id; /* Obsolete */
|
||||
xmlSchemaAnnotPtr annot;
|
||||
xmlNodePtr node;
|
||||
int fixed; /* XML_SCHEMAS_FACET_PRESERVE, etc. */
|
||||
int whitespace;
|
||||
xmlSchemaValPtr val; /* The compiled value */
|
||||
xmlRegexpPtr regexp; /* The regex for patterns */
|
||||
};
|
||||
|
||||
/**
|
||||
* A notation definition.
|
||||
*/
|
||||
typedef struct _xmlSchemaNotation xmlSchemaNotation;
|
||||
typedef xmlSchemaNotation *xmlSchemaNotationPtr;
|
||||
struct _xmlSchemaNotation {
|
||||
xmlSchemaTypeType type; /* The kind of type */
|
||||
const xmlChar *name;
|
||||
xmlSchemaAnnotPtr 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.
|
||||
*/
|
||||
/**
|
||||
* XML_SCHEMAS_QUALIF_ELEM:
|
||||
*
|
||||
* Reflects elementFormDefault == qualified in
|
||||
* an XML schema document.
|
||||
*/
|
||||
#define XML_SCHEMAS_QUALIF_ELEM 1 << 0
|
||||
/**
|
||||
* XML_SCHEMAS_QUALIF_ATTR:
|
||||
*
|
||||
* Reflects attributeFormDefault == qualified in
|
||||
* an XML schema document.
|
||||
*/
|
||||
#define XML_SCHEMAS_QUALIF_ATTR 1 << 1
|
||||
/**
|
||||
* XML_SCHEMAS_FINAL_DEFAULT_EXTENSION:
|
||||
*
|
||||
* the schema has "extension" in the set of finalDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_FINAL_DEFAULT_EXTENSION 1 << 2
|
||||
/**
|
||||
* XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION:
|
||||
*
|
||||
* the schema has "restriction" in the set of finalDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_FINAL_DEFAULT_RESTRICTION 1 << 3
|
||||
/**
|
||||
* XML_SCHEMAS_FINAL_DEFAULT_LIST:
|
||||
*
|
||||
* the cshema has "list" in the set of finalDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_FINAL_DEFAULT_LIST 1 << 4
|
||||
/**
|
||||
* XML_SCHEMAS_FINAL_DEFAULT_UNION:
|
||||
*
|
||||
* the schema has "union" in the set of finalDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_FINAL_DEFAULT_UNION 1 << 5
|
||||
/**
|
||||
* XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION:
|
||||
*
|
||||
* the schema has "extension" in the set of blockDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_BLOCK_DEFAULT_EXTENSION 1 << 6
|
||||
/**
|
||||
* XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION:
|
||||
*
|
||||
* the schema has "restriction" in the set of blockDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_BLOCK_DEFAULT_RESTRICTION 1 << 7
|
||||
/**
|
||||
* XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION:
|
||||
*
|
||||
* the schema has "substitution" in the set of blockDefault.
|
||||
*/
|
||||
#define XML_SCHEMAS_BLOCK_DEFAULT_SUBSTITUTION 1 << 8
|
||||
/**
|
||||
* XML_SCHEMAS_INCLUDING_CONVERT_NS:
|
||||
*
|
||||
* the schema is currently including an other schema with
|
||||
* no target namespace.
|
||||
*/
|
||||
#define XML_SCHEMAS_INCLUDING_CONVERT_NS 1 << 9
|
||||
/**
|
||||
* _xmlSchema:
|
||||
*
|
||||
* A Schemas definition
|
||||
*/
|
||||
struct _xmlSchema {
|
||||
const xmlChar *name; /* schema name */
|
||||
const xmlChar *targetNamespace; /* the target namespace */
|
||||
const xmlChar *version;
|
||||
const xmlChar *id; /* Obsolete */
|
||||
xmlDocPtr doc;
|
||||
xmlSchemaAnnotPtr annot;
|
||||
int flags;
|
||||
|
||||
xmlHashTablePtr typeDecl;
|
||||
xmlHashTablePtr attrDecl;
|
||||
xmlHashTablePtr attrgrpDecl;
|
||||
xmlHashTablePtr elemDecl;
|
||||
xmlHashTablePtr notaDecl;
|
||||
|
||||
xmlHashTablePtr schemasImports;
|
||||
|
||||
void *_private; /* unused by the library for users or bindings */
|
||||
xmlHashTablePtr groupDecl;
|
||||
xmlDictPtr dict;
|
||||
void *includes; /* the includes, this is opaque for now */
|
||||
int preserve; /* whether to free the document */
|
||||
int counter; /* used to give ononymous components unique names */
|
||||
xmlHashTablePtr idcDef; /* All identity-constraint defs. */
|
||||
void *volatiles; /* Obsolete */
|
||||
};
|
||||
|
||||
XMLPUBFUN void XMLCALL xmlSchemaFreeType (xmlSchemaTypePtr type);
|
||||
XMLPUBFUN void XMLCALL xmlSchemaFreeWildcard(xmlSchemaWildcardPtr wildcard);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* __XML_SCHEMA_INTERNALS_H__ */
|
||||
|
@ -613,13 +613,13 @@ struct _xmlDOMWrapCtxt {
|
||||
/*
|
||||
* Some helper functions
|
||||
*/
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateNCName (const xmlChar *value,
|
||||
int space);
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateQName (const xmlChar *value,
|
||||
int space);
|
||||
@ -736,8 +736,7 @@ XMLPUBFUN xmlAttrPtr XMLCALL
|
||||
xmlNewDocProp (xmlDocPtr doc,
|
||||
const xmlChar *name,
|
||||
const xmlChar *value);
|
||||
#if defined(LIBXML_TREE_ENABLED) || \
|
||||
defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
XMLPUBFUN xmlAttrPtr XMLCALL
|
||||
xmlNewProp (xmlNodePtr node,
|
||||
const xmlChar *name,
|
||||
@ -767,11 +766,11 @@ XMLPUBFUN xmlAttrPtr XMLCALL
|
||||
XMLPUBFUN xmlDtdPtr XMLCALL
|
||||
xmlCopyDtd (xmlDtdPtr dtd);
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
XMLPUBFUN xmlDocPtr XMLCALL
|
||||
xmlCopyDoc (xmlDocPtr doc,
|
||||
int recursive);
|
||||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
|
||||
#endif /* defined(LIBXML_TREE_ENABLED) */
|
||||
/*
|
||||
* Creating new nodes.
|
||||
*/
|
||||
@ -791,7 +790,7 @@ XMLPUBFUN xmlNodePtr XMLCALL
|
||||
XMLPUBFUN xmlNodePtr XMLCALL
|
||||
xmlNewNodeEatName (xmlNsPtr ns,
|
||||
xmlChar *name);
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
XMLPUBFUN xmlNodePtr XMLCALL
|
||||
xmlNewChild (xmlNodePtr parent,
|
||||
xmlNsPtr ns,
|
||||
@ -901,12 +900,11 @@ XMLPUBFUN xmlNodePtr XMLCALL
|
||||
xmlReplaceNode (xmlNodePtr old,
|
||||
xmlNodePtr cur);
|
||||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */
|
||||
#if defined(LIBXML_TREE_ENABLED) || \
|
||||
defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
XMLPUBFUN xmlNodePtr XMLCALL
|
||||
xmlAddPrevSibling (xmlNodePtr cur,
|
||||
xmlNodePtr elem);
|
||||
#endif /* LIBXML_TREE_ENABLED || LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* LIBXML_TREE_ENABLED */
|
||||
XMLPUBFUN xmlNodePtr XMLCALL
|
||||
xmlAddSibling (xmlNodePtr cur,
|
||||
xmlNodePtr elem);
|
||||
@ -943,7 +941,7 @@ XMLPUBFUN xmlNsPtr XMLCALL
|
||||
xmlSearchNsByHref (xmlDocPtr doc,
|
||||
xmlNodePtr node,
|
||||
const xmlChar *href);
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
XMLPUBFUN xmlNsPtr * XMLCALL
|
||||
xmlGetNsList (xmlDocPtr doc,
|
||||
xmlNodePtr node);
|
||||
@ -960,7 +958,7 @@ XMLPUBFUN xmlNsPtr XMLCALL
|
||||
/*
|
||||
* Changing the content.
|
||||
*/
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
XMLPUBFUN xmlAttrPtr XMLCALL
|
||||
xmlSetProp (xmlNodePtr node,
|
||||
const xmlChar *name,
|
||||
@ -970,7 +968,7 @@ XMLPUBFUN xmlAttrPtr XMLCALL
|
||||
xmlNsPtr ns,
|
||||
const xmlChar *name,
|
||||
const xmlChar *value);
|
||||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
|
||||
#endif /* defined(LIBXML_TREE_ENABLED) */
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlGetNoNsProp (xmlNodePtr node,
|
||||
const xmlChar *name);
|
||||
@ -1052,7 +1050,7 @@ XMLPUBFUN void XMLCALL
|
||||
*/
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlRemoveProp (xmlAttrPtr cur);
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlUnsetNsProp (xmlNodePtr node,
|
||||
xmlNsPtr ns,
|
||||
@ -1060,7 +1058,7 @@ XMLPUBFUN int XMLCALL
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlUnsetProp (xmlNodePtr node,
|
||||
const xmlChar *name);
|
||||
#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */
|
||||
#endif /* defined(LIBXML_TREE_ENABLED) */
|
||||
|
||||
/*
|
||||
* Internal, don't use.
|
||||
|
@ -376,12 +376,12 @@ XMLPUBFUN int XMLCALL
|
||||
xmlDocPtr doc);
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlValidateNotationUse (xmlValidCtxtPtr ctxt,
|
||||
xmlDocPtr doc,
|
||||
const xmlChar *notationName);
|
||||
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlIsMixedElement (xmlDocPtr doc,
|
||||
|
@ -13,10 +13,6 @@
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
#include <libxml/xmlschemas.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -274,24 +270,6 @@ XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderNextSibling (xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderIsValid (xmlTextReaderPtr reader);
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader,
|
||||
const char *rng);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader,
|
||||
xmlRelaxNGPtr schema);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderSchemaValidate (xmlTextReaderPtr reader,
|
||||
const char *xsd);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader,
|
||||
xmlSchemaValidCtxtPtr ctxt,
|
||||
int options);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlTextReaderSetSchema (xmlTextReaderPtr reader,
|
||||
xmlSchemaPtr schema);
|
||||
#endif
|
||||
XMLPUBFUN const xmlChar * XMLCALL
|
||||
xmlTextReaderConstXmlVersion(xmlTextReaderPtr reader);
|
||||
XMLPUBFUN int XMLCALL
|
||||
|
@ -14,205 +14,4 @@
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
||||
#include <libxml/tree.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.
|
||||
*/
|
||||
/**
|
||||
* xmlSchemaValidOption:
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* The schemas related types are kept internal
|
||||
*/
|
||||
typedef struct _xmlSchema xmlSchema;
|
||||
typedef xmlSchema *xmlSchemaPtr;
|
||||
|
||||
/**
|
||||
* xmlSchemaValidityErrorFunc:
|
||||
* @ctx: the validation context
|
||||
* @msg: the message
|
||||
* @...: extra arguments
|
||||
*
|
||||
* Signature of an error callback from an XSD validation
|
||||
*/
|
||||
typedef void (XMLCDECL *xmlSchemaValidityErrorFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
||||
|
||||
/**
|
||||
* xmlSchemaValidityWarningFunc:
|
||||
* @ctx: the validation context
|
||||
* @msg: the message
|
||||
* @...: extra arguments
|
||||
*
|
||||
* Signature of a warning callback from an XSD validation
|
||||
*/
|
||||
typedef void (XMLCDECL *xmlSchemaValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
||||
|
||||
/**
|
||||
* A schemas validation context
|
||||
*/
|
||||
typedef struct _xmlSchemaParserCtxt xmlSchemaParserCtxt;
|
||||
typedef xmlSchemaParserCtxt *xmlSchemaParserCtxtPtr;
|
||||
|
||||
typedef struct _xmlSchemaValidCtxt xmlSchemaValidCtxt;
|
||||
typedef xmlSchemaValidCtxt *xmlSchemaValidCtxtPtr;
|
||||
|
||||
/*
|
||||
* Interfaces for parsing.
|
||||
*/
|
||||
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
|
||||
xmlSchemaNewParserCtxt (const char *URL);
|
||||
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
|
||||
xmlSchemaNewMemParserCtxt (const char *buffer,
|
||||
int size);
|
||||
XMLPUBFUN xmlSchemaParserCtxtPtr XMLCALL
|
||||
xmlSchemaNewDocParserCtxt (xmlDocPtr doc);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaFreeParserCtxt (xmlSchemaParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaSetParserErrors (xmlSchemaParserCtxtPtr ctxt,
|
||||
xmlSchemaValidityErrorFunc err,
|
||||
xmlSchemaValidityWarningFunc warn,
|
||||
void *ctx);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror,
|
||||
void *ctx);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaGetParserErrors(xmlSchemaParserCtxtPtr ctxt,
|
||||
xmlSchemaValidityErrorFunc * err,
|
||||
xmlSchemaValidityWarningFunc * warn,
|
||||
void **ctx);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaIsValid (xmlSchemaValidCtxtPtr ctxt);
|
||||
|
||||
XMLPUBFUN xmlSchemaPtr XMLCALL
|
||||
xmlSchemaParse (xmlSchemaParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaFree (xmlSchemaPtr schema);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaDump (FILE *output,
|
||||
xmlSchemaPtr schema);
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
/*
|
||||
* Interfaces for validating
|
||||
*/
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaSetValidErrors (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlSchemaValidityErrorFunc err,
|
||||
xmlSchemaValidityWarningFunc warn,
|
||||
void *ctx);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlStructuredErrorFunc serror,
|
||||
void *ctx);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaGetValidErrors (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlSchemaValidityErrorFunc *err,
|
||||
xmlSchemaValidityWarningFunc *warn,
|
||||
void **ctx);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaSetValidOptions (xmlSchemaValidCtxtPtr ctxt,
|
||||
int options);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValidCtxtGetOptions(xmlSchemaValidCtxtPtr ctxt);
|
||||
|
||||
XMLPUBFUN xmlSchemaValidCtxtPtr XMLCALL
|
||||
xmlSchemaNewValidCtxt (xmlSchemaPtr schema);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaFreeValidCtxt (xmlSchemaValidCtxtPtr ctxt);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValidateDoc (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlDocPtr instance);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValidateOneElement (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlNodePtr elem);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValidateStream (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlParserInputBufferPtr input,
|
||||
xmlCharEncoding enc,
|
||||
xmlSAXHandlerPtr sax,
|
||||
void *user_data);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValidateFile (xmlSchemaValidCtxtPtr ctxt,
|
||||
const char * filename,
|
||||
int options);
|
||||
|
||||
XMLPUBFUN xmlParserCtxtPtr XMLCALL
|
||||
xmlSchemaValidCtxtGetParserCtxt(xmlSchemaValidCtxtPtr ctxt);
|
||||
|
||||
/*
|
||||
* Interface to insert Schemas SAX validation in a SAX stream
|
||||
*/
|
||||
typedef struct _xmlSchemaSAXPlug xmlSchemaSAXPlugStruct;
|
||||
typedef xmlSchemaSAXPlugStruct *xmlSchemaSAXPlugPtr;
|
||||
|
||||
XMLPUBFUN xmlSchemaSAXPlugPtr XMLCALL
|
||||
xmlSchemaSAXPlug (xmlSchemaValidCtxtPtr ctxt,
|
||||
xmlSAXHandlerPtr *sax,
|
||||
void **user_data);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaSAXUnplug (xmlSchemaSAXPlugPtr plug);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* __XML_SCHEMA_H__ */
|
||||
|
@ -14,138 +14,4 @@
|
||||
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
|
||||
#include <libxml/schemasInternals.h>
|
||||
#include <libxml/xmlschemas.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
XML_SCHEMA_WHITESPACE_UNKNOWN = 0,
|
||||
XML_SCHEMA_WHITESPACE_PRESERVE = 1,
|
||||
XML_SCHEMA_WHITESPACE_REPLACE = 2,
|
||||
XML_SCHEMA_WHITESPACE_COLLAPSE = 3
|
||||
} xmlSchemaWhitespaceValueType;
|
||||
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaInitTypes (void);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaCleanupTypes (void);
|
||||
XMLPUBFUN xmlSchemaTypePtr XMLCALL
|
||||
xmlSchemaGetPredefinedType (const xmlChar *name,
|
||||
const xmlChar *ns);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValidatePredefinedType (xmlSchemaTypePtr type,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr *val);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValPredefTypeNode (xmlSchemaTypePtr type,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr *val,
|
||||
xmlNodePtr node);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValidateFacet (xmlSchemaTypePtr base,
|
||||
xmlSchemaFacetPtr facet,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr val);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValidateFacetWhtsp (xmlSchemaFacetPtr facet,
|
||||
xmlSchemaWhitespaceValueType fws,
|
||||
xmlSchemaValType valType,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr val,
|
||||
xmlSchemaWhitespaceValueType ws);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaFreeValue (xmlSchemaValPtr val);
|
||||
XMLPUBFUN xmlSchemaFacetPtr XMLCALL
|
||||
xmlSchemaNewFacet (void);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaCheckFacet (xmlSchemaFacetPtr facet,
|
||||
xmlSchemaTypePtr typeDecl,
|
||||
xmlSchemaParserCtxtPtr ctxt,
|
||||
const xmlChar *name);
|
||||
XMLPUBFUN void XMLCALL
|
||||
xmlSchemaFreeFacet (xmlSchemaFacetPtr facet);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaCompareValues (xmlSchemaValPtr x,
|
||||
xmlSchemaValPtr y);
|
||||
XMLPUBFUN xmlSchemaTypePtr XMLCALL
|
||||
xmlSchemaGetBuiltInListSimpleTypeItemType (xmlSchemaTypePtr type);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValidateListSimpleTypeFacet (xmlSchemaFacetPtr facet,
|
||||
const xmlChar *value,
|
||||
unsigned long actualLen,
|
||||
unsigned long *expectedLen);
|
||||
XMLPUBFUN xmlSchemaTypePtr XMLCALL
|
||||
xmlSchemaGetBuiltInType (xmlSchemaValType type);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaIsBuiltInTypeFacet (xmlSchemaTypePtr type,
|
||||
int facetType);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlSchemaCollapseString (const xmlChar *value);
|
||||
XMLPUBFUN xmlChar * XMLCALL
|
||||
xmlSchemaWhiteSpaceReplace (const xmlChar *value);
|
||||
XMLPUBFUN unsigned long XMLCALL
|
||||
xmlSchemaGetFacetValueAsULong (xmlSchemaFacetPtr facet);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValidateLengthFacet (xmlSchemaTypePtr type,
|
||||
xmlSchemaFacetPtr facet,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr val,
|
||||
unsigned long *length);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr facet,
|
||||
xmlSchemaValType valType,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr val,
|
||||
unsigned long *length,
|
||||
xmlSchemaWhitespaceValueType ws);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValPredefTypeNodeNoNorm(xmlSchemaTypePtr type,
|
||||
const xmlChar *value,
|
||||
xmlSchemaValPtr *val,
|
||||
xmlNodePtr node);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaGetCanonValue (xmlSchemaValPtr val,
|
||||
const xmlChar **retValue);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaGetCanonValueWhtsp (xmlSchemaValPtr val,
|
||||
const xmlChar **retValue,
|
||||
xmlSchemaWhitespaceValueType ws);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValueAppend (xmlSchemaValPtr prev,
|
||||
xmlSchemaValPtr cur);
|
||||
XMLPUBFUN xmlSchemaValPtr XMLCALL
|
||||
xmlSchemaValueGetNext (xmlSchemaValPtr cur);
|
||||
XMLPUBFUN const xmlChar * XMLCALL
|
||||
xmlSchemaValueGetAsString (xmlSchemaValPtr val);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaValueGetAsBoolean (xmlSchemaValPtr val);
|
||||
XMLPUBFUN xmlSchemaValPtr XMLCALL
|
||||
xmlSchemaNewStringValue (xmlSchemaValType type,
|
||||
const xmlChar *value);
|
||||
XMLPUBFUN xmlSchemaValPtr XMLCALL
|
||||
xmlSchemaNewNOTATIONValue (const xmlChar *name,
|
||||
const xmlChar *ns);
|
||||
XMLPUBFUN xmlSchemaValPtr XMLCALL
|
||||
xmlSchemaNewQNameValue (const xmlChar *namespaceName,
|
||||
const xmlChar *localName);
|
||||
XMLPUBFUN int XMLCALL
|
||||
xmlSchemaCompareValuesWhtsp (xmlSchemaValPtr x,
|
||||
xmlSchemaWhitespaceValueType xws,
|
||||
xmlSchemaValPtr y,
|
||||
xmlSchemaWhitespaceValueType yws);
|
||||
XMLPUBFUN xmlSchemaValPtr XMLCALL
|
||||
xmlSchemaCopyValue (xmlSchemaValPtr val);
|
||||
XMLPUBFUN xmlSchemaValType XMLCALL
|
||||
xmlSchemaGetValType (xmlSchemaValPtr val);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* __XML_SCHEMA_TYPES_H__ */
|
||||
|
@ -259,15 +259,6 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
|
||||
#define LIBXML_EXPR_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_SCHEMAS_ENABLED:
|
||||
*
|
||||
* Whether the Schemas validation interfaces are compiled in
|
||||
*/
|
||||
#if 0
|
||||
#define LIBXML_SCHEMAS_ENABLED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* LIBXML_MODULES_ENABLED:
|
||||
*
|
||||
|
@ -54,10 +54,6 @@
|
||||
#include <libxml/encoding.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/uri.h>
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/xmlschemastypes.h>
|
||||
#include <libxml/relaxng.h>
|
||||
#endif
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
@ -882,11 +878,7 @@ xmlHasFeature(xmlFeature feature)
|
||||
return(0);
|
||||
#endif
|
||||
case XML_WITH_SCHEMAS:
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
return(1);
|
||||
#else
|
||||
return(0);
|
||||
#endif
|
||||
case XML_WITH_SCHEMATRON:
|
||||
return(0);
|
||||
case XML_WITH_MODULES:
|
||||
@ -14073,10 +14065,6 @@ xmlCleanupParser(void) {
|
||||
xmlCleanupInputCallbacks();
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
xmlCleanupOutputCallbacks();
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
xmlSchemaCleanupTypes();
|
||||
xmlRelaxNGCleanupTypes();
|
||||
#endif
|
||||
xmlCleanupGlobals();
|
||||
xmlResetLastError();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -343,7 +343,7 @@ xmlSplitQName3(const xmlChar *name, int *len) {
|
||||
|
||||
#define CUR_SCHAR(s, l) xmlStringCurrentChar(NULL, s, &l)
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_WRITER_ENABLED)
|
||||
/**
|
||||
* xmlValidateNCName:
|
||||
* @value: the value to check
|
||||
@ -417,7 +417,7 @@ try_complex:
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
/**
|
||||
* xmlValidateQName:
|
||||
* @value: the value to check
|
||||
@ -1868,8 +1868,7 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
|
||||
return (cur);
|
||||
}
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || \
|
||||
defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
/**
|
||||
* xmlNewProp:
|
||||
* @node: the holding node
|
||||
@ -2786,7 +2785,7 @@ xmlSetListDoc(xmlNodePtr list, xmlDocPtr doc) {
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
/**
|
||||
* xmlNewChild:
|
||||
* @parent: the parent node
|
||||
@ -2991,8 +2990,7 @@ xmlAddNextSibling(xmlNodePtr cur, xmlNodePtr elem) {
|
||||
return(elem);
|
||||
}
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || \
|
||||
defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
/**
|
||||
* xmlAddPrevSibling:
|
||||
* @cur: the child node
|
||||
@ -4416,7 +4414,7 @@ xmlCopyDtd(xmlDtdPtr dtd) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
/**
|
||||
* xmlCopyDoc:
|
||||
* @doc: the document
|
||||
@ -5693,7 +5691,7 @@ xmlTextMerge(xmlNodePtr first, xmlNodePtr second) {
|
||||
return(first);
|
||||
}
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
/**
|
||||
* xmlGetNsList:
|
||||
* @doc: the document
|
||||
@ -6574,7 +6572,7 @@ xmlGetNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
|
||||
return(xmlGetPropNodeValueInternal(prop));
|
||||
}
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
/**
|
||||
* xmlUnsetProp:
|
||||
* @node: the node
|
||||
@ -6618,7 +6616,7 @@ xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_TREE_ENABLED)
|
||||
/**
|
||||
* xmlSetProp:
|
||||
* @node: the node
|
||||
|
@ -125,7 +125,7 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error,
|
||||
"%s", msg);
|
||||
}
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
/**
|
||||
* xmlErrValidNode:
|
||||
* @ctxt: an XML validation parser context
|
||||
@ -166,7 +166,7 @@ xmlErrValidNode(xmlValidCtxtPtr ctxt,
|
||||
(const char *) str1,
|
||||
(const char *) str3, 0, 0, msg, str1, str2, str3);
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
/**
|
||||
@ -3329,7 +3329,7 @@ xmlGetDtdNotationDesc(xmlDtdPtr dtd, const xmlChar *name) {
|
||||
return(xmlHashLookup(table, name));
|
||||
}
|
||||
|
||||
#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
||||
#if defined(LIBXML_VALID_ENABLED)
|
||||
/**
|
||||
* xmlValidateNotationUse:
|
||||
* @ctxt: the validation context
|
||||
@ -3361,7 +3361,7 @@ xmlValidateNotationUse(xmlValidCtxtPtr ctxt, xmlDocPtr doc,
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED or LIBXML_SCHEMAS_ENABLED */
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
|
||||
/**
|
||||
* xmlIsMixedElement:
|
||||
|
@ -79,10 +79,6 @@
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/globals.h>
|
||||
#include <libxml/xmlreader.h>
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
#include <libxml/xmlschemas.h>
|
||||
#endif
|
||||
#ifdef LIBXML_C14N_ENABLED
|
||||
#include <libxml/c14n.h>
|
||||
#endif
|
||||
@ -130,12 +126,6 @@ static int postvalid = 0;
|
||||
static char * dtdvalid = NULL;
|
||||
static char * dtdvalidfpi = NULL;
|
||||
#endif
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
static char * relaxng = NULL;
|
||||
static xmlRelaxNGPtr relaxngschemas = NULL;
|
||||
static char * schema = NULL;
|
||||
static xmlSchemaPtr wxschemas = NULL;
|
||||
#endif
|
||||
static int repeat = 0;
|
||||
static int insert = 0;
|
||||
static int htmlout = 0;
|
||||
@ -1572,34 +1562,6 @@ testSAX(const char *filename) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (wxschemas != NULL) {
|
||||
int ret;
|
||||
xmlSchemaValidCtxtPtr vctxt;
|
||||
|
||||
vctxt = xmlSchemaNewValidCtxt(wxschemas);
|
||||
xmlSchemaSetValidErrors(vctxt,
|
||||
(xmlSchemaValidityErrorFunc) fprintf,
|
||||
(xmlSchemaValidityWarningFunc) fprintf,
|
||||
stderr);
|
||||
|
||||
ret = xmlSchemaValidateStream(vctxt, buf, 0, handler,
|
||||
(void *)user_data);
|
||||
if (repeat == 0) {
|
||||
if (ret == 0) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
} else if (ret > 0) {
|
||||
fprintf(stderr, "%s fails to validate\n", filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
} else {
|
||||
fprintf(stderr, "%s validation generated an internal error\n",
|
||||
filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
}
|
||||
}
|
||||
xmlSchemaFreeValidCtxt(vctxt);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* Create the parser context amd hook the input
|
||||
@ -1703,38 +1665,6 @@ static void streamFile(char *filename) {
|
||||
else
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
xmlTextReaderSetParserProp(reader, XML_PARSER_LOADDTD, 1);
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (relaxng != NULL) {
|
||||
if ((timing) && (!repeat)) {
|
||||
startTimer();
|
||||
}
|
||||
ret = xmlTextReaderRelaxNGValidate(reader, relaxng);
|
||||
if (ret < 0) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Relax-NG schema %s failed to compile\n", relaxng);
|
||||
progresult = XMLLINT_ERR_SCHEMACOMP;
|
||||
relaxng = NULL;
|
||||
}
|
||||
if ((timing) && (!repeat)) {
|
||||
endTimer("Compiling the schemas");
|
||||
}
|
||||
}
|
||||
if (schema != NULL) {
|
||||
if ((timing) && (!repeat)) {
|
||||
startTimer();
|
||||
}
|
||||
ret = xmlTextReaderSchemaValidate(reader, schema);
|
||||
if (ret < 0) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"XSD schema %s failed to compile\n", schema);
|
||||
progresult = XMLLINT_ERR_SCHEMACOMP;
|
||||
schema = NULL;
|
||||
}
|
||||
if ((timing) && (!repeat)) {
|
||||
endTimer("Compiling the schemas");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Process all nodes in sequence
|
||||
@ -1750,11 +1680,6 @@ static void streamFile(char *filename) {
|
||||
ret = xmlTextReaderRead(reader);
|
||||
}
|
||||
if ((timing) && (!repeat)) {
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (relaxng != NULL)
|
||||
endTimer("Parsing and validating");
|
||||
else
|
||||
#endif
|
||||
#ifdef LIBXML_VALID_ENABLED
|
||||
if (valid)
|
||||
endTimer("Parsing and validating");
|
||||
@ -1772,16 +1697,6 @@ static void streamFile(char *filename) {
|
||||
}
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if ((relaxng != NULL) || (schema != NULL)) {
|
||||
if (xmlTextReaderIsValid(reader) != 1) {
|
||||
fprintf(stderr, "%s fails to validate\n", filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
} else {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/*
|
||||
* Done, cleanup and status
|
||||
*/
|
||||
@ -2334,65 +2249,6 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) {
|
||||
xmlFreeValidCtxt(cvp);
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (relaxngschemas != NULL) {
|
||||
xmlRelaxNGValidCtxtPtr ctxt;
|
||||
int ret;
|
||||
|
||||
if ((timing) && (!repeat)) {
|
||||
startTimer();
|
||||
}
|
||||
|
||||
ctxt = xmlRelaxNGNewValidCtxt(relaxngschemas);
|
||||
xmlRelaxNGSetValidErrors(ctxt,
|
||||
(xmlRelaxNGValidityErrorFunc) fprintf,
|
||||
(xmlRelaxNGValidityWarningFunc) fprintf,
|
||||
stderr);
|
||||
ret = xmlRelaxNGValidateDoc(ctxt, doc);
|
||||
if (ret == 0) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
} else if (ret > 0) {
|
||||
fprintf(stderr, "%s fails to validate\n", filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
} else {
|
||||
fprintf(stderr, "%s validation generated an internal error\n",
|
||||
filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
}
|
||||
xmlRelaxNGFreeValidCtxt(ctxt);
|
||||
if ((timing) && (!repeat)) {
|
||||
endTimer("Validating");
|
||||
}
|
||||
} else if (wxschemas != NULL) {
|
||||
xmlSchemaValidCtxtPtr ctxt;
|
||||
int ret;
|
||||
|
||||
if ((timing) && (!repeat)) {
|
||||
startTimer();
|
||||
}
|
||||
|
||||
ctxt = xmlSchemaNewValidCtxt(wxschemas);
|
||||
xmlSchemaSetValidErrors(ctxt,
|
||||
(xmlSchemaValidityErrorFunc) fprintf,
|
||||
(xmlSchemaValidityWarningFunc) fprintf,
|
||||
stderr);
|
||||
ret = xmlSchemaValidateDoc(ctxt, doc);
|
||||
if (ret == 0) {
|
||||
fprintf(stderr, "%s validates\n", filename);
|
||||
} else if (ret > 0) {
|
||||
fprintf(stderr, "%s fails to validate\n", filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
} else {
|
||||
fprintf(stderr, "%s validation generated an internal error\n",
|
||||
filename);
|
||||
progresult = XMLLINT_ERR_VALID;
|
||||
}
|
||||
xmlSchemaFreeValidCtxt(ctxt);
|
||||
if ((timing) && (!repeat)) {
|
||||
endTimer("Validating");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* free it.
|
||||
@ -2525,10 +2381,6 @@ static void usage(const char *name) {
|
||||
printf("\t--walker : create a reader and walk though the resulting doc\n");
|
||||
#endif /* LIBXML_READER_ENABLED */
|
||||
printf("\t--chkregister : verify the node registration code\n");
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
printf("\t--relaxng schema : do RelaxNG validation against the schema\n");
|
||||
printf("\t--schema schema : do validation against the WXS schema\n");
|
||||
#endif
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
printf("\t--sax1: use the old SAX1 interfaces for processing\n");
|
||||
#endif
|
||||
@ -2797,19 +2649,6 @@ main(int argc, char **argv) {
|
||||
else if ((!strcmp(argv[i], "-chkregister")) ||
|
||||
(!strcmp(argv[i], "--chkregister"))) {
|
||||
chkregister++;
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
} else if ((!strcmp(argv[i], "-relaxng")) ||
|
||||
(!strcmp(argv[i], "--relaxng"))) {
|
||||
i++;
|
||||
relaxng = argv[i];
|
||||
noent++;
|
||||
options |= XML_PARSE_NOENT;
|
||||
} else if ((!strcmp(argv[i], "-schema")) ||
|
||||
(!strcmp(argv[i], "--schema"))) {
|
||||
i++;
|
||||
schema = argv[i];
|
||||
noent++;
|
||||
#endif
|
||||
} else if ((!strcmp(argv[i], "-nonet")) ||
|
||||
(!strcmp(argv[i], "--nonet"))) {
|
||||
options |= XML_PARSE_NONET;
|
||||
@ -2879,64 +2718,6 @@ main(int argc, char **argv) {
|
||||
argv[0]);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if ((relaxng != NULL) && (sax == 0)
|
||||
#ifdef LIBXML_READER_ENABLED
|
||||
&& (stream == 0)
|
||||
#endif /* LIBXML_READER_ENABLED */
|
||||
) {
|
||||
xmlRelaxNGParserCtxtPtr ctxt;
|
||||
|
||||
/* forces loading the DTDs */
|
||||
xmlLoadExtDtdDefaultValue |= 1;
|
||||
options |= XML_PARSE_DTDLOAD;
|
||||
if (timing) {
|
||||
startTimer();
|
||||
}
|
||||
ctxt = xmlRelaxNGNewParserCtxt(relaxng);
|
||||
xmlRelaxNGSetParserErrors(ctxt,
|
||||
(xmlRelaxNGValidityErrorFunc) fprintf,
|
||||
(xmlRelaxNGValidityWarningFunc) fprintf,
|
||||
stderr);
|
||||
relaxngschemas = xmlRelaxNGParse(ctxt);
|
||||
if (relaxngschemas == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Relax-NG schema %s failed to compile\n", relaxng);
|
||||
progresult = XMLLINT_ERR_SCHEMACOMP;
|
||||
relaxng = NULL;
|
||||
}
|
||||
xmlRelaxNGFreeParserCtxt(ctxt);
|
||||
if (timing) {
|
||||
endTimer("Compiling the schemas");
|
||||
}
|
||||
} else if ((schema != NULL)
|
||||
#ifdef LIBXML_READER_ENABLED
|
||||
&& (stream == 0)
|
||||
#endif
|
||||
) {
|
||||
xmlSchemaParserCtxtPtr ctxt;
|
||||
|
||||
if (timing) {
|
||||
startTimer();
|
||||
}
|
||||
ctxt = xmlSchemaNewParserCtxt(schema);
|
||||
xmlSchemaSetParserErrors(ctxt,
|
||||
(xmlSchemaValidityErrorFunc) fprintf,
|
||||
(xmlSchemaValidityWarningFunc) fprintf,
|
||||
stderr);
|
||||
wxschemas = xmlSchemaParse(ctxt);
|
||||
if (wxschemas == NULL) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"WXS schema %s failed to compile\n", schema);
|
||||
progresult = XMLLINT_ERR_SCHEMACOMP;
|
||||
schema = NULL;
|
||||
}
|
||||
xmlSchemaFreeParserCtxt(ctxt);
|
||||
if (timing) {
|
||||
endTimer("Compiling the schemas");
|
||||
}
|
||||
}
|
||||
#endif /* LIBXML_SCHEMAS_ENABLED */
|
||||
for (i = 1; i < argc ; i++) {
|
||||
if ((!strcmp(argv[i], "-encode")) ||
|
||||
(!strcmp(argv[i], "--encode"))) {
|
||||
@ -3049,13 +2830,6 @@ main(int argc, char **argv) {
|
||||
if ((files == 0) && (!generate) && (version == 0)) {
|
||||
usage(argv[0]);
|
||||
}
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (relaxngschemas != NULL)
|
||||
xmlRelaxNGFree(relaxngschemas);
|
||||
if (wxschemas != NULL)
|
||||
xmlSchemaFree(wxschemas);
|
||||
xmlRelaxNGCleanupTypes();
|
||||
#endif
|
||||
xmlCleanupParser();
|
||||
xmlMemoryDump();
|
||||
|
||||
|
@ -32,10 +32,6 @@
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/xmlreader.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
#include <libxml/relaxng.h>
|
||||
#include <libxml/xmlschemas.h>
|
||||
#endif
|
||||
#include <libxml/uri.h>
|
||||
|
||||
#define MAX_ERR_MSG_SIZE 64000
|
||||
@ -142,19 +138,6 @@ struct _xmlTextReader {
|
||||
xmlTextReaderErrorFunc errorFunc; /* callback function */
|
||||
void *errorFuncArg; /* callback function user argument */
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
/* Handling of RelaxNG validation */
|
||||
xmlRelaxNGPtr rngSchemas; /* The Relax NG schemas */
|
||||
xmlRelaxNGValidCtxtPtr rngValidCtxt;/* The Relax NG validation context */
|
||||
int rngValidErrors;/* The number of errors detected */
|
||||
xmlNodePtr rngFullNode; /* the node if RNG not progressive */
|
||||
/* Handling of Schemas validation */
|
||||
xmlSchemaPtr xsdSchemas; /* The Schemas schemas */
|
||||
xmlSchemaValidCtxtPtr xsdValidCtxt;/* The Schemas validation context */
|
||||
int xsdPreserveCtxt; /* 1 if the context was provided by the user */
|
||||
int xsdValidErrors;/* The number of errors detected */
|
||||
xmlSchemaSAXPlugPtr xsdPlug; /* the schemas plug in SAX pipeline */
|
||||
#endif
|
||||
int preserves; /* level of preserves */
|
||||
int parserFlags; /* the set of options set */
|
||||
/* Structured error handling */
|
||||
@ -912,34 +895,6 @@ xmlTextReaderValidatePush(xmlTextReaderPtr reader ATTRIBUTE_UNUSED) {
|
||||
}
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
|
||||
(reader->rngValidCtxt != NULL)) {
|
||||
int ret;
|
||||
|
||||
if (reader->rngFullNode != NULL) return;
|
||||
ret = xmlRelaxNGValidatePushElement(reader->rngValidCtxt,
|
||||
reader->ctxt->myDoc,
|
||||
node);
|
||||
if (ret == 0) {
|
||||
/*
|
||||
* this element requires a full tree
|
||||
*/
|
||||
node = xmlTextReaderExpand(reader);
|
||||
if (node == NULL) {
|
||||
printf("Expand failed !\n");
|
||||
ret = -1;
|
||||
} else {
|
||||
ret = xmlRelaxNGValidateFullElement(reader->rngValidCtxt,
|
||||
reader->ctxt->myDoc,
|
||||
node);
|
||||
reader->rngFullNode = node;
|
||||
}
|
||||
}
|
||||
if (ret != 1)
|
||||
reader->rngValidErrors++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -960,17 +915,6 @@ xmlTextReaderValidateCData(xmlTextReaderPtr reader,
|
||||
data, len);
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
|
||||
(reader->rngValidCtxt != NULL)) {
|
||||
int ret;
|
||||
|
||||
if (reader->rngFullNode != NULL) return;
|
||||
ret = xmlRelaxNGValidatePushCData(reader->rngValidCtxt, data, len);
|
||||
if (ret != 1)
|
||||
reader->rngValidErrors++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1003,23 +947,6 @@ xmlTextReaderValidatePop(xmlTextReaderPtr reader) {
|
||||
}
|
||||
}
|
||||
#endif /* LIBXML_VALID_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if ((reader->validate == XML_TEXTREADER_VALIDATE_RNG) &&
|
||||
(reader->rngValidCtxt != NULL)) {
|
||||
int ret;
|
||||
|
||||
if (reader->rngFullNode != NULL) {
|
||||
if (node == reader->rngFullNode)
|
||||
reader->rngFullNode = NULL;
|
||||
return;
|
||||
}
|
||||
ret = xmlRelaxNGValidatePopElement(reader->rngValidCtxt,
|
||||
reader->ctxt->myDoc,
|
||||
node);
|
||||
if (ret != 1)
|
||||
reader->rngValidErrors++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1492,13 +1419,6 @@ node_found:
|
||||
}
|
||||
}
|
||||
#endif /* LIBXML_REGEXP_ENABLED */
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if ((reader->validate == XML_TEXTREADER_VALIDATE_XSD) &&
|
||||
(reader->xsdValidErrors == 0) &&
|
||||
(reader->xsdValidCtxt != NULL)) {
|
||||
reader->xsdValidErrors = !xmlSchemaIsValid(reader->xsdValidCtxt);
|
||||
}
|
||||
#endif /* LIBXML_PATTERN_ENABLED */
|
||||
return(1);
|
||||
node_end:
|
||||
reader->state = XML_TEXTREADER_DONE;
|
||||
@ -2095,29 +2015,6 @@ void
|
||||
xmlFreeTextReader(xmlTextReaderPtr reader) {
|
||||
if (reader == NULL)
|
||||
return;
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->rngSchemas != NULL) {
|
||||
xmlRelaxNGFree(reader->rngSchemas);
|
||||
reader->rngSchemas = NULL;
|
||||
}
|
||||
if (reader->rngValidCtxt != NULL) {
|
||||
xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
|
||||
reader->rngValidCtxt = NULL;
|
||||
}
|
||||
if (reader->xsdPlug != NULL) {
|
||||
xmlSchemaSAXUnplug(reader->xsdPlug);
|
||||
reader->xsdPlug = NULL;
|
||||
}
|
||||
if (reader->xsdValidCtxt != NULL) {
|
||||
if (! reader->xsdPreserveCtxt)
|
||||
xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
|
||||
reader->xsdValidCtxt = NULL;
|
||||
}
|
||||
if (reader->xsdSchemas != NULL) {
|
||||
xmlSchemaFree(reader->xsdSchemas);
|
||||
reader->xsdSchemas = NULL;
|
||||
}
|
||||
#endif
|
||||
if (reader->faketext != NULL) {
|
||||
xmlFreeNode(reader->faketext);
|
||||
}
|
||||
@ -3836,453 +3733,6 @@ xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) {
|
||||
return(reader->ctxt->myDoc);
|
||||
}
|
||||
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
static char *xmlTextReaderBuildMessage(const char *msg, va_list ap);
|
||||
|
||||
static void XMLCDECL
|
||||
xmlTextReaderValidityError(void *ctxt, const char *msg, ...);
|
||||
|
||||
static void XMLCDECL
|
||||
xmlTextReaderValidityWarning(void *ctxt, const char *msg, ...);
|
||||
|
||||
static void XMLCDECL
|
||||
xmlTextReaderValidityErrorRelay(void *ctx, const char *msg, ...)
|
||||
{
|
||||
xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx;
|
||||
|
||||
char *str;
|
||||
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, msg);
|
||||
str = xmlTextReaderBuildMessage(msg, ap);
|
||||
if (!reader->errorFunc) {
|
||||
xmlTextReaderValidityError(ctx, "%s", str);
|
||||
} else {
|
||||
reader->errorFunc(reader->errorFuncArg, str,
|
||||
XML_PARSER_SEVERITY_VALIDITY_ERROR,
|
||||
NULL /* locator */ );
|
||||
}
|
||||
if (str != NULL)
|
||||
xmlFree(str);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void XMLCDECL
|
||||
xmlTextReaderValidityWarningRelay(void *ctx, const char *msg, ...)
|
||||
{
|
||||
xmlTextReaderPtr reader = (xmlTextReaderPtr) ctx;
|
||||
|
||||
char *str;
|
||||
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, msg);
|
||||
str = xmlTextReaderBuildMessage(msg, ap);
|
||||
if (!reader->errorFunc) {
|
||||
xmlTextReaderValidityWarning(ctx, "%s", str);
|
||||
} else {
|
||||
reader->errorFunc(reader->errorFuncArg, str,
|
||||
XML_PARSER_SEVERITY_VALIDITY_WARNING,
|
||||
NULL /* locator */ );
|
||||
}
|
||||
if (str != NULL)
|
||||
xmlFree(str);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
static void
|
||||
xmlTextReaderStructuredError(void *ctxt, xmlErrorPtr error);
|
||||
|
||||
static void
|
||||
xmlTextReaderValidityStructuredRelay(void *userData, xmlErrorPtr error)
|
||||
{
|
||||
xmlTextReaderPtr reader = (xmlTextReaderPtr) userData;
|
||||
|
||||
if (reader->sErrorFunc) {
|
||||
reader->sErrorFunc(reader->errorFuncArg, error);
|
||||
} else {
|
||||
xmlTextReaderStructuredError(reader, error);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* xmlTextReaderRelaxNGSetSchema:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
* @schema: a precompiled RelaxNG schema
|
||||
*
|
||||
* Use RelaxNG to validate the document as it is processed.
|
||||
* Activation is only possible before the first Read().
|
||||
* if @schema is NULL, then RelaxNG validation is desactivated.
|
||||
@ The @schema should not be freed until the reader is deallocated
|
||||
* or its use has been deactivated.
|
||||
*
|
||||
* Returns 0 in case the RelaxNG validation could be (des)activated and
|
||||
* -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema) {
|
||||
if (reader == NULL)
|
||||
return(-1);
|
||||
if (schema == NULL) {
|
||||
if (reader->rngSchemas != NULL) {
|
||||
xmlRelaxNGFree(reader->rngSchemas);
|
||||
reader->rngSchemas = NULL;
|
||||
}
|
||||
if (reader->rngValidCtxt != NULL) {
|
||||
xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
|
||||
reader->rngValidCtxt = NULL;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
if (reader->mode != XML_TEXTREADER_MODE_INITIAL)
|
||||
return(-1);
|
||||
if (reader->rngSchemas != NULL) {
|
||||
xmlRelaxNGFree(reader->rngSchemas);
|
||||
reader->rngSchemas = NULL;
|
||||
}
|
||||
if (reader->rngValidCtxt != NULL) {
|
||||
xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
|
||||
reader->rngValidCtxt = NULL;
|
||||
}
|
||||
reader->rngValidCtxt = xmlRelaxNGNewValidCtxt(schema);
|
||||
if (reader->rngValidCtxt == NULL)
|
||||
return(-1);
|
||||
if (reader->errorFunc != NULL) {
|
||||
xmlRelaxNGSetValidErrors(reader->rngValidCtxt,
|
||||
xmlTextReaderValidityErrorRelay,
|
||||
xmlTextReaderValidityWarningRelay,
|
||||
reader);
|
||||
}
|
||||
if (reader->sErrorFunc != NULL) {
|
||||
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt,
|
||||
xmlTextReaderValidityStructuredRelay,
|
||||
reader);
|
||||
}
|
||||
reader->rngValidErrors = 0;
|
||||
reader->rngFullNode = NULL;
|
||||
reader->validate = XML_TEXTREADER_VALIDATE_RNG;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderSetSchema:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
* @schema: a precompiled Schema schema
|
||||
*
|
||||
* Use XSD Schema to validate the document as it is processed.
|
||||
* Activation is only possible before the first Read().
|
||||
* if @schema is NULL, then Schema validation is desactivated.
|
||||
@ The @schema should not be freed until the reader is deallocated
|
||||
* or its use has been deactivated.
|
||||
*
|
||||
* Returns 0 in case the Schema validation could be (des)activated and
|
||||
* -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xmlTextReaderSetSchema(xmlTextReaderPtr reader, xmlSchemaPtr schema) {
|
||||
if (reader == NULL)
|
||||
return(-1);
|
||||
if (schema == NULL) {
|
||||
if (reader->xsdPlug != NULL) {
|
||||
xmlSchemaSAXUnplug(reader->xsdPlug);
|
||||
reader->xsdPlug = NULL;
|
||||
}
|
||||
if (reader->xsdValidCtxt != NULL) {
|
||||
if (! reader->xsdPreserveCtxt)
|
||||
xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
|
||||
reader->xsdValidCtxt = NULL;
|
||||
}
|
||||
reader->xsdPreserveCtxt = 0;
|
||||
if (reader->xsdSchemas != NULL) {
|
||||
xmlSchemaFree(reader->xsdSchemas);
|
||||
reader->xsdSchemas = NULL;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
if (reader->mode != XML_TEXTREADER_MODE_INITIAL)
|
||||
return(-1);
|
||||
if (reader->xsdPlug != NULL) {
|
||||
xmlSchemaSAXUnplug(reader->xsdPlug);
|
||||
reader->xsdPlug = NULL;
|
||||
}
|
||||
if (reader->xsdValidCtxt != NULL) {
|
||||
if (! reader->xsdPreserveCtxt)
|
||||
xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
|
||||
reader->xsdValidCtxt = NULL;
|
||||
}
|
||||
reader->xsdPreserveCtxt = 0;
|
||||
if (reader->xsdSchemas != NULL) {
|
||||
xmlSchemaFree(reader->xsdSchemas);
|
||||
reader->xsdSchemas = NULL;
|
||||
}
|
||||
reader->xsdValidCtxt = xmlSchemaNewValidCtxt(schema);
|
||||
if (reader->xsdValidCtxt == NULL) {
|
||||
xmlSchemaFree(reader->xsdSchemas);
|
||||
reader->xsdSchemas = NULL;
|
||||
return(-1);
|
||||
}
|
||||
reader->xsdPlug = xmlSchemaSAXPlug(reader->xsdValidCtxt,
|
||||
&(reader->ctxt->sax),
|
||||
&(reader->ctxt->userData));
|
||||
if (reader->xsdPlug == NULL) {
|
||||
xmlSchemaFree(reader->xsdSchemas);
|
||||
reader->xsdSchemas = NULL;
|
||||
xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
|
||||
reader->xsdValidCtxt = NULL;
|
||||
return(-1);
|
||||
}
|
||||
if (reader->errorFunc != NULL) {
|
||||
xmlSchemaSetValidErrors(reader->xsdValidCtxt,
|
||||
xmlTextReaderValidityErrorRelay,
|
||||
xmlTextReaderValidityWarningRelay,
|
||||
reader);
|
||||
}
|
||||
if (reader->sErrorFunc != NULL) {
|
||||
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt,
|
||||
xmlTextReaderValidityStructuredRelay,
|
||||
reader);
|
||||
}
|
||||
reader->xsdValidErrors = 0;
|
||||
reader->validate = XML_TEXTREADER_VALIDATE_XSD;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderRelaxNGValidate:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
* @rng: the path to a RelaxNG schema or NULL
|
||||
*
|
||||
* Use RelaxNG to validate the document as it is processed.
|
||||
* Activation is only possible before the first Read().
|
||||
* if @rng is NULL, then RelaxNG validation is deactivated.
|
||||
*
|
||||
* Returns 0 in case the RelaxNG validation could be (de)activated and
|
||||
* -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xmlTextReaderRelaxNGValidate(xmlTextReaderPtr reader, const char *rng) {
|
||||
xmlRelaxNGParserCtxtPtr ctxt;
|
||||
|
||||
if (reader == NULL)
|
||||
return(-1);
|
||||
|
||||
if (rng == NULL) {
|
||||
if (reader->rngValidCtxt != NULL) {
|
||||
xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
|
||||
reader->rngValidCtxt = NULL;
|
||||
}
|
||||
if (reader->rngSchemas != NULL) {
|
||||
xmlRelaxNGFree(reader->rngSchemas);
|
||||
reader->rngSchemas = NULL;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
if (reader->mode != XML_TEXTREADER_MODE_INITIAL)
|
||||
return(-1);
|
||||
if (reader->rngSchemas != NULL) {
|
||||
xmlRelaxNGFree(reader->rngSchemas);
|
||||
reader->rngSchemas = NULL;
|
||||
}
|
||||
if (reader->rngValidCtxt != NULL) {
|
||||
xmlRelaxNGFreeValidCtxt(reader->rngValidCtxt);
|
||||
reader->rngValidCtxt = NULL;
|
||||
}
|
||||
ctxt = xmlRelaxNGNewParserCtxt(rng);
|
||||
if (reader->errorFunc != NULL) {
|
||||
xmlRelaxNGSetParserErrors(ctxt,
|
||||
xmlTextReaderValidityErrorRelay,
|
||||
xmlTextReaderValidityWarningRelay,
|
||||
reader);
|
||||
}
|
||||
if (reader->sErrorFunc != NULL) {
|
||||
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt,
|
||||
xmlTextReaderValidityStructuredRelay,
|
||||
reader);
|
||||
}
|
||||
reader->rngSchemas = xmlRelaxNGParse(ctxt);
|
||||
xmlRelaxNGFreeParserCtxt(ctxt);
|
||||
if (reader->rngSchemas == NULL)
|
||||
return(-1);
|
||||
reader->rngValidCtxt = xmlRelaxNGNewValidCtxt(reader->rngSchemas);
|
||||
if (reader->rngValidCtxt == NULL) {
|
||||
xmlRelaxNGFree(reader->rngSchemas);
|
||||
reader->rngSchemas = NULL;
|
||||
return(-1);
|
||||
}
|
||||
if (reader->errorFunc != NULL) {
|
||||
xmlRelaxNGSetValidErrors(reader->rngValidCtxt,
|
||||
xmlTextReaderValidityErrorRelay,
|
||||
xmlTextReaderValidityWarningRelay,
|
||||
reader);
|
||||
}
|
||||
if (reader->sErrorFunc != NULL) {
|
||||
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt,
|
||||
xmlTextReaderValidityStructuredRelay,
|
||||
reader);
|
||||
}
|
||||
reader->rngValidErrors = 0;
|
||||
reader->rngFullNode = NULL;
|
||||
reader->validate = XML_TEXTREADER_VALIDATE_RNG;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderSchemaValidateInternal:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
* @xsd: the path to a W3C XSD schema or NULL
|
||||
* @ctxt: the XML Schema validation context or NULL
|
||||
* @options: options (not used yet)
|
||||
*
|
||||
* Validate the document as it is processed using XML Schema.
|
||||
* Activation is only possible before the first Read().
|
||||
* If both @xsd and @ctxt are NULL then XML Schema validation is deactivated.
|
||||
*
|
||||
* Returns 0 in case the schemas validation could be (de)activated and
|
||||
* -1 in case of error.
|
||||
*/
|
||||
static int
|
||||
xmlTextReaderSchemaValidateInternal(xmlTextReaderPtr reader,
|
||||
const char *xsd,
|
||||
xmlSchemaValidCtxtPtr ctxt,
|
||||
int options ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (reader == NULL)
|
||||
return(-1);
|
||||
|
||||
if ((xsd != NULL) && (ctxt != NULL))
|
||||
return(-1);
|
||||
|
||||
if (((xsd != NULL) || (ctxt != NULL)) &&
|
||||
((reader->mode != XML_TEXTREADER_MODE_INITIAL) ||
|
||||
(reader->ctxt == NULL)))
|
||||
return(-1);
|
||||
|
||||
/* Cleanup previous validation stuff. */
|
||||
if (reader->xsdPlug != NULL) {
|
||||
xmlSchemaSAXUnplug(reader->xsdPlug);
|
||||
reader->xsdPlug = NULL;
|
||||
}
|
||||
if (reader->xsdValidCtxt != NULL) {
|
||||
if (! reader->xsdPreserveCtxt)
|
||||
xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
|
||||
reader->xsdValidCtxt = NULL;
|
||||
}
|
||||
reader->xsdPreserveCtxt = 0;
|
||||
if (reader->xsdSchemas != NULL) {
|
||||
xmlSchemaFree(reader->xsdSchemas);
|
||||
reader->xsdSchemas = NULL;
|
||||
}
|
||||
|
||||
if ((xsd == NULL) && (ctxt == NULL)) {
|
||||
/* We just want to deactivate the validation, so get out. */
|
||||
return(0);
|
||||
}
|
||||
|
||||
if (xsd != NULL) {
|
||||
xmlSchemaParserCtxtPtr pctxt;
|
||||
/* Parse the schema and create validation environment. */
|
||||
pctxt = xmlSchemaNewParserCtxt(xsd);
|
||||
if (reader->errorFunc != NULL) {
|
||||
xmlSchemaSetParserErrors(pctxt,
|
||||
xmlTextReaderValidityErrorRelay,
|
||||
xmlTextReaderValidityWarningRelay,
|
||||
reader);
|
||||
}
|
||||
reader->xsdSchemas = xmlSchemaParse(pctxt);
|
||||
xmlSchemaFreeParserCtxt(pctxt);
|
||||
if (reader->xsdSchemas == NULL)
|
||||
return(-1);
|
||||
reader->xsdValidCtxt = xmlSchemaNewValidCtxt(reader->xsdSchemas);
|
||||
if (reader->xsdValidCtxt == NULL) {
|
||||
xmlSchemaFree(reader->xsdSchemas);
|
||||
reader->xsdSchemas = NULL;
|
||||
return(-1);
|
||||
}
|
||||
reader->xsdPlug = xmlSchemaSAXPlug(reader->xsdValidCtxt,
|
||||
&(reader->ctxt->sax),
|
||||
&(reader->ctxt->userData));
|
||||
if (reader->xsdPlug == NULL) {
|
||||
xmlSchemaFree(reader->xsdSchemas);
|
||||
reader->xsdSchemas = NULL;
|
||||
xmlSchemaFreeValidCtxt(reader->xsdValidCtxt);
|
||||
reader->xsdValidCtxt = NULL;
|
||||
return(-1);
|
||||
}
|
||||
} else {
|
||||
/* Use the given validation context. */
|
||||
reader->xsdValidCtxt = ctxt;
|
||||
reader->xsdPreserveCtxt = 1;
|
||||
reader->xsdPlug = xmlSchemaSAXPlug(reader->xsdValidCtxt,
|
||||
&(reader->ctxt->sax),
|
||||
&(reader->ctxt->userData));
|
||||
if (reader->xsdPlug == NULL) {
|
||||
reader->xsdValidCtxt = NULL;
|
||||
reader->xsdPreserveCtxt = 0;
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Redirect the validation context's error channels to use
|
||||
* the reader channels.
|
||||
* TODO: In case the user provides the validation context we
|
||||
* could make this redirection optional.
|
||||
*/
|
||||
if (reader->errorFunc != NULL) {
|
||||
xmlSchemaSetValidErrors(reader->xsdValidCtxt,
|
||||
xmlTextReaderValidityErrorRelay,
|
||||
xmlTextReaderValidityWarningRelay,
|
||||
reader);
|
||||
}
|
||||
if (reader->sErrorFunc != NULL) {
|
||||
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt,
|
||||
xmlTextReaderValidityStructuredRelay,
|
||||
reader);
|
||||
}
|
||||
reader->xsdValidErrors = 0;
|
||||
reader->validate = XML_TEXTREADER_VALIDATE_XSD;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderSchemaValidateCtxt:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
* @ctxt: the XML Schema validation context or NULL
|
||||
* @options: options (not used yet)
|
||||
*
|
||||
* Use W3C XSD schema context to validate the document as it is processed.
|
||||
* Activation is only possible before the first Read().
|
||||
* If @ctxt is NULL, then XML Schema validation is deactivated.
|
||||
*
|
||||
* Returns 0 in case the schemas validation could be (de)activated and
|
||||
* -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xmlTextReaderSchemaValidateCtxt(xmlTextReaderPtr reader,
|
||||
xmlSchemaValidCtxtPtr ctxt,
|
||||
int options)
|
||||
{
|
||||
return(xmlTextReaderSchemaValidateInternal(reader, NULL, ctxt, options));
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextReaderSchemaValidate:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
* @xsd: the path to a W3C XSD schema or NULL
|
||||
*
|
||||
* Use W3C XSD schema to validate the document as it is processed.
|
||||
* Activation is only possible before the first Read().
|
||||
* If @xsd is NULL, then XML Schema validation is deactivated.
|
||||
*
|
||||
* Returns 0 in case the schemas validation could be (de)activated and
|
||||
* -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xmlTextReaderSchemaValidate(xmlTextReaderPtr reader, const char *xsd)
|
||||
{
|
||||
return(xmlTextReaderSchemaValidateInternal(reader, xsd, NULL, 0));
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* xmlTextReaderIsNamespaceDecl:
|
||||
* @reader: the xmlTextReaderPtr used
|
||||
@ -4596,24 +4046,6 @@ xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
|
||||
reader->errorFunc = f;
|
||||
reader->sErrorFunc = NULL;
|
||||
reader->errorFuncArg = arg;
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->rngValidCtxt) {
|
||||
xmlRelaxNGSetValidErrors(reader->rngValidCtxt,
|
||||
xmlTextReaderValidityErrorRelay,
|
||||
xmlTextReaderValidityWarningRelay,
|
||||
reader);
|
||||
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL,
|
||||
reader);
|
||||
}
|
||||
if (reader->xsdValidCtxt) {
|
||||
xmlSchemaSetValidErrors(reader->xsdValidCtxt,
|
||||
xmlTextReaderValidityErrorRelay,
|
||||
xmlTextReaderValidityWarningRelay,
|
||||
reader);
|
||||
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL,
|
||||
reader);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
/* restore defaults */
|
||||
reader->ctxt->sax->error = xmlParserError;
|
||||
@ -4623,20 +4055,6 @@ xmlTextReaderSetErrorHandler(xmlTextReaderPtr reader,
|
||||
reader->errorFunc = NULL;
|
||||
reader->sErrorFunc = NULL;
|
||||
reader->errorFuncArg = NULL;
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->rngValidCtxt) {
|
||||
xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL,
|
||||
reader);
|
||||
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL,
|
||||
reader);
|
||||
}
|
||||
if (reader->xsdValidCtxt) {
|
||||
xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL,
|
||||
reader);
|
||||
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL,
|
||||
reader);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -4663,22 +4081,6 @@ xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
|
||||
reader->sErrorFunc = f;
|
||||
reader->errorFunc = NULL;
|
||||
reader->errorFuncArg = arg;
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->rngValidCtxt) {
|
||||
xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL,
|
||||
reader);
|
||||
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt,
|
||||
xmlTextReaderValidityStructuredRelay,
|
||||
reader);
|
||||
}
|
||||
if (reader->xsdValidCtxt) {
|
||||
xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL,
|
||||
reader);
|
||||
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt,
|
||||
xmlTextReaderValidityStructuredRelay,
|
||||
reader);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
/* restore defaults */
|
||||
reader->ctxt->sax->error = xmlParserError;
|
||||
@ -4689,20 +4091,6 @@ xmlTextReaderSetStructuredErrorHandler(xmlTextReaderPtr reader,
|
||||
reader->errorFunc = NULL;
|
||||
reader->sErrorFunc = NULL;
|
||||
reader->errorFuncArg = NULL;
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->rngValidCtxt) {
|
||||
xmlRelaxNGSetValidErrors(reader->rngValidCtxt, NULL, NULL,
|
||||
reader);
|
||||
xmlRelaxNGSetValidStructuredErrors(reader->rngValidCtxt, NULL,
|
||||
reader);
|
||||
}
|
||||
if (reader->xsdValidCtxt) {
|
||||
xmlSchemaSetValidErrors(reader->xsdValidCtxt, NULL, NULL,
|
||||
reader);
|
||||
xmlSchemaSetValidStructuredErrors(reader->xsdValidCtxt, NULL,
|
||||
reader);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -4719,12 +4107,6 @@ xmlTextReaderIsValid(xmlTextReaderPtr reader)
|
||||
{
|
||||
if (reader == NULL)
|
||||
return (-1);
|
||||
#ifdef LIBXML_SCHEMAS_ENABLED
|
||||
if (reader->validate == XML_TEXTREADER_VALIDATE_RNG)
|
||||
return (reader->rngValidErrors == 0);
|
||||
if (reader->validate == XML_TEXTREADER_VALIDATE_XSD)
|
||||
return (reader->xsdValidErrors == 0);
|
||||
#endif
|
||||
if ((reader->ctxt != NULL) && (reader->ctxt->validate == 1))
|
||||
return (reader->ctxt->valid);
|
||||
return (0);
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user