version 1.1.1.2, 2013/07/22 01:22:18
|
version 1.1.1.3, 2014/06/15 19:53:31
|
Line 107
|
Line 107
|
#endif |
#endif |
|
|
#define UNBOUNDED (1 << 30) |
#define UNBOUNDED (1 << 30) |
#define TODO \ | #define TODO \ |
xmlGenericError(xmlGenericErrorContext, \ |
xmlGenericError(xmlGenericErrorContext, \ |
"Unimplemented block at %s:%d\n", \ |
"Unimplemented block at %s:%d\n", \ |
__FILE__, __LINE__); |
__FILE__, __LINE__); |
Line 975 struct _xmlSchemaValidCtxt {
|
Line 975 struct _xmlSchemaValidCtxt {
|
xmlSAXHandlerPtr sax; |
xmlSAXHandlerPtr sax; |
xmlParserCtxtPtr parserCtxt; |
xmlParserCtxtPtr parserCtxt; |
void *user_data; /* TODO: What is this for? */ |
void *user_data; /* TODO: What is this for? */ |
|
char *filename; |
|
|
int err; |
int err; |
int nberrors; |
int nberrors; |
Line 1028 struct _xmlSchemaValidCtxt {
|
Line 1029 struct _xmlSchemaValidCtxt {
|
int hasKeyrefs; |
int hasKeyrefs; |
int createIDCNodeTables; |
int createIDCNodeTables; |
int psviExposeIDCNodeTables; |
int psviExposeIDCNodeTables; |
|
|
|
/* Locator for error reporting in streaming mode */ |
|
xmlSchemaValidityLocatorFunc locFunc; |
|
void *locCtxt; |
}; |
}; |
|
|
/** |
/** |
Line 1043 struct _xmlSchemaSubstGroup {
|
Line 1048 struct _xmlSchemaSubstGroup {
|
}; |
}; |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Some predeclarations * | * Some predeclarations * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
static int xmlSchemaParseInclude(xmlSchemaParserCtxtPtr ctxt, |
static int xmlSchemaParseInclude(xmlSchemaParserCtxtPtr ctxt, |
Line 1098 xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr
|
Line 1103 xmlSchemaParseAttributeGroupRef(xmlSchemaParserCtxtPtr
|
|
|
/************************************************************************ |
/************************************************************************ |
* * |
* * |
* Helper functions * | * Helper functions * |
* * |
* * |
************************************************************************/ |
************************************************************************/ |
|
|
Line 1836 xmlSchemaFormatFacetEnumSet(xmlSchemaAbstractCtxtPtr a
|
Line 1841 xmlSchemaFormatFacetEnumSet(xmlSchemaAbstractCtxtPtr a
|
|
|
/************************************************************************ |
/************************************************************************ |
* * |
* * |
* Error functions * | * Error functions * |
* * |
* * |
************************************************************************/ |
************************************************************************/ |
|
|
Line 1974 xmlSchemaPErrExt(xmlSchemaParserCtxtPtr ctxt, xmlNodeP
|
Line 1979 xmlSchemaPErrExt(xmlSchemaParserCtxtPtr ctxt, xmlNodeP
|
|
|
/************************************************************************ |
/************************************************************************ |
* * |
* * |
* Allround error functions * | * Allround error functions * |
* * |
* * |
************************************************************************/ |
************************************************************************/ |
|
|
Line 2078 xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt,
|
Line 2083 xmlSchemaErr4Line(xmlSchemaAbstractCtxtPtr ctxt,
|
(vctxt->parserCtxt->input != NULL)) |
(vctxt->parserCtxt->input != NULL)) |
file = vctxt->parserCtxt->input->filename; |
file = vctxt->parserCtxt->input->filename; |
} |
} |
|
if (vctxt->locFunc != NULL) { |
|
if ((file == NULL) || (line == 0)) { |
|
unsigned long l; |
|
const char *f; |
|
vctxt->locFunc(vctxt->locCtxt, &f, &l); |
|
if (file == NULL) |
|
file = f; |
|
if (line == 0) |
|
line = (int) l; |
|
} |
|
} |
|
if ((file == NULL) && (vctxt->filename != NULL)) |
|
file = vctxt->filename; |
|
|
__xmlRaiseError(schannel, channel, data, ctxt, |
__xmlRaiseError(schannel, channel, data, ctxt, |
node, XML_FROM_SCHEMASV, |
node, XML_FROM_SCHEMASV, |
error, errorLevel, file, line, |
error, errorLevel, file, line, |
Line 3199 xmlSchemaPContentErr(xmlSchemaParserCtxtPtr ctxt,
|
Line 3218 xmlSchemaPContentErr(xmlSchemaParserCtxtPtr ctxt,
|
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Streamable error functions * | * Streamable error functions * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
|
|
|
|
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Validation helper functions * | * Validation helper functions * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Allocation functions * | * Allocation functions * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
/** |
/** |
Line 4135 xmlSchemaFree(xmlSchemaPtr schema)
|
Line 4154 xmlSchemaFree(xmlSchemaPtr schema)
|
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Debug functions * | * Debug functions * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
#ifdef LIBXML_OUTPUT_ENABLED |
#ifdef LIBXML_OUTPUT_ENABLED |
Line 4587 xmlSchemaDebugDumpIDCTable(FILE * output,
|
Line 4606 xmlSchemaDebugDumpIDCTable(FILE * output,
|
|
|
/************************************************************************ |
/************************************************************************ |
* * |
* * |
* Utilities * | * Utilities * |
* * |
* * |
************************************************************************/ |
************************************************************************/ |
|
|
Line 4692 xmlSchemaGetProp(xmlSchemaParserCtxtPtr ctxt, xmlNodeP
|
Line 4711 xmlSchemaGetProp(xmlSchemaParserCtxtPtr ctxt, xmlNodeP
|
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Parsing functions * | * Parsing functions * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
#define WXS_FIND_GLOBAL_ITEM(slot) \ |
#define WXS_FIND_GLOBAL_ITEM(slot) \ |
Line 4966 xmlSchemaGetNamedComponent(xmlSchemaPtr schema,
|
Line 4985 xmlSchemaGetNamedComponent(xmlSchemaPtr schema,
|
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Parsing functions * | * Parsing functions * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
#define IS_BLANK_NODE(n) \ |
#define IS_BLANK_NODE(n) \ |
Line 5743 xmlSchemaAddElementSubstitutionMember(xmlSchemaParserC
|
Line 5762 xmlSchemaAddElementSubstitutionMember(xmlSchemaParserC
|
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Utilities for parsing * |
* Utilities for parsing * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
/** |
/** |
Line 5939 xmlSchemaPValAttrNodeID(xmlSchemaParserCtxtPtr ctxt, x
|
Line 5958 xmlSchemaPValAttrNodeID(xmlSchemaParserCtxtPtr ctxt, x
|
xmlFree((xmlChar *) value); |
xmlFree((xmlChar *) value); |
value = strip; |
value = strip; |
} |
} |
res = xmlAddID(NULL, attr->doc, value, attr); | res = xmlAddID(NULL, attr->doc, value, attr); |
if (res == NULL) { |
if (res == NULL) { |
ret = XML_SCHEMAP_S4S_ATTR_INVALID_VALUE; |
ret = XML_SCHEMAP_S4S_ATTR_INVALID_VALUE; |
xmlSchemaPSimpleTypeErr(ctxt, |
xmlSchemaPSimpleTypeErr(ctxt, |
Line 6191 xmlGetBooleanProp(xmlSchemaParserCtxtPtr ctxt,
|
Line 6210 xmlGetBooleanProp(xmlSchemaParserCtxtPtr ctxt,
|
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Shema extraction from an Infoset * |
* Shema extraction from an Infoset * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
static xmlSchemaTypePtr xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr |
static xmlSchemaTypePtr xmlSchemaParseSimpleType(xmlSchemaParserCtxtPtr |
ctxt, xmlSchemaPtr schema, |
ctxt, xmlSchemaPtr schema, |
Line 8227 xmlSchemaParseIDCSelectorAndField(xmlSchemaParserCtxtP
|
Line 8246 xmlSchemaParseIDCSelectorAndField(xmlSchemaParserCtxtP
|
*/ |
*/ |
attr = xmlSchemaGetPropNode(node, "xpath"); |
attr = xmlSchemaGetPropNode(node, "xpath"); |
if (attr == NULL) { |
if (attr == NULL) { |
xmlSchemaPMissingAttrErr(ctxt, | xmlSchemaPMissingAttrErr(ctxt, |
XML_SCHEMAP_S4S_ATTR_MISSING, |
XML_SCHEMAP_S4S_ATTR_MISSING, |
NULL, node, |
NULL, node, |
"name", NULL); |
"name", NULL); |
Line 12353 xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt,
|
Line 12372 xmlSchemaParseComplexType(xmlSchemaParserCtxtPtr ctxt,
|
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Validating using Schemas * | * Validating using Schemas * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Reading/Writing Schemas * | * Reading/Writing Schemas * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
#if 0 /* Will be enabled if it is clear what options are needed. */ |
#if 0 /* Will be enabled if it is clear what options are needed. */ |
Line 12938 xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pct
|
Line 12957 xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr pct
|
if (tmp2 != 1) ret = 0; |
if (tmp2 != 1) ret = 0; |
sub = sub->next; |
sub = sub->next; |
} |
} |
|
|
|
/* |
|
* epsilon needed to block previous trans from |
|
* being allowed to enter back from another |
|
* construct |
|
*/ |
|
pctxt->state = xmlAutomataNewEpsilon(pctxt->am, |
|
pctxt->state, NULL); |
|
|
if (particle->minOccurs == 0) { |
if (particle->minOccurs == 0) { |
xmlAutomataNewEpsilon(pctxt->am, oldstate, |
xmlAutomataNewEpsilon(pctxt->am, oldstate, |
pctxt->state); |
pctxt->state); |
Line 20153 xmlSchemaResolveAttrUseReferences(xmlSchemaAttributeUs
|
Line 20181 xmlSchemaResolveAttrUseReferences(xmlSchemaAttributeUs
|
ref->name, ref->targetNamespace); |
ref->name, ref->targetNamespace); |
if (ause->attrDecl == NULL) { |
if (ause->attrDecl == NULL) { |
xmlSchemaPResCompAttrErr(ctxt, |
xmlSchemaPResCompAttrErr(ctxt, |
XML_SCHEMAP_SRC_RESOLVE, | XML_SCHEMAP_SRC_RESOLVE, |
WXS_BASIC_CAST ause, ause->node, |
WXS_BASIC_CAST ause, ause->node, |
"ref", ref->name, ref->targetNamespace, |
"ref", ref->name, ref->targetNamespace, |
XML_SCHEMA_TYPE_ATTRIBUTE, NULL); |
XML_SCHEMA_TYPE_ATTRIBUTE, NULL); |
Line 21533 xmlSchemaGetWhiteSpaceFacetValue(xmlSchemaTypePtr type
|
Line 21561 xmlSchemaGetWhiteSpaceFacetValue(xmlSchemaTypePtr type
|
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Simple type validation * | * Simple type validation * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* DOM Validation code * | * DOM Validation code * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
/** |
/** |
Line 21936 xmlSchemaVAddNodeQName(xmlSchemaValidCtxtPtr vctxt,
|
Line 21964 xmlSchemaVAddNodeQName(xmlSchemaValidCtxtPtr vctxt,
|
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Validation of identity-constraints (IDC) * |
* Validation of identity-constraints (IDC) * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
/** |
/** |
Line 23866 xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt
|
Line 23894 xmlSchemaCheckCVCIDCKeyRef(xmlSchemaValidCtxtPtr vctxt
|
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* XML Reader validation code * | * XML Reader validation code * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
static xmlSchemaAttrInfoPtr |
static xmlSchemaAttrInfoPtr |
Line 24988 xmlSchemaValidateElemDecl(xmlSchemaValidCtxtPtr vctxt)
|
Line 25016 xmlSchemaValidateElemDecl(xmlSchemaValidCtxtPtr vctxt)
|
return (vctxt->err); |
return (vctxt->err); |
} |
} |
if (actualType == NULL) { |
if (actualType == NULL) { |
VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL, | VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL, |
"The type definition is absent"); | "The type definition is absent"); |
return (XML_SCHEMAV_CVC_TYPE_1); | return (XML_SCHEMAV_CVC_TYPE_1); |
} |
} |
if (vctxt->nbAttrInfos != 0) { |
if (vctxt->nbAttrInfos != 0) { |
int ret; |
int ret; |
Line 25080 xmlSchemaValidateElemDecl(xmlSchemaValidCtxtPtr vctxt)
|
Line 25108 xmlSchemaValidateElemDecl(xmlSchemaValidCtxtPtr vctxt)
|
* No actual type definition. |
* No actual type definition. |
*/ |
*/ |
if (actualType == NULL) { |
if (actualType == NULL) { |
VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL, | VERROR(XML_SCHEMAV_CVC_TYPE_1, NULL, |
"The type definition is absent"); | "The type definition is absent"); |
return (XML_SCHEMAV_CVC_TYPE_1); | return (XML_SCHEMAV_CVC_TYPE_1); |
} |
} |
/* |
/* |
* Remember the actual type definition. |
* Remember the actual type definition. |
Line 26035 xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
|
Line 26063 xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
|
"AUTOMATON create on '%s'\n", inode->localName); |
"AUTOMATON create on '%s'\n", inode->localName); |
#endif |
#endif |
} |
} |
|
|
/* |
/* |
|
* Do not check further content if the node has been nilled |
|
*/ |
|
if (INODE_NILLED(inode)) { |
|
ret = 0; |
|
#ifdef DEBUG_AUTOMATA |
|
xmlGenericError(xmlGenericErrorContext, |
|
"AUTOMATON succeeded on nilled '%s'\n", |
|
inode->localName); |
|
#endif |
|
goto skip_nilled; |
|
} |
|
|
|
/* |
* Get hold of the still expected content, since a further |
* Get hold of the still expected content, since a further |
* call to xmlRegExecPushString() will loose this information. |
* call to xmlRegExecPushString() will loose this information. |
*/ |
*/ |
Line 26072 xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
|
Line 26114 xmlSchemaValidatorPopElem(xmlSchemaValidCtxtPtr vctxt)
|
|
|
} |
} |
} |
} |
|
|
|
skip_nilled: |
|
|
if (inode->typeDef->contentType == XML_SCHEMA_CONTENT_ELEMENTS) |
if (inode->typeDef->contentType == XML_SCHEMA_CONTENT_ELEMENTS) |
goto end_elem; |
goto end_elem; |
|
|
Line 26910 type_validation:
|
Line 26955 type_validation:
|
if (vctxt->inode->typeDef == NULL) { |
if (vctxt->inode->typeDef == NULL) { |
vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE; |
vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE; |
ret = XML_SCHEMAV_CVC_TYPE_1; |
ret = XML_SCHEMAV_CVC_TYPE_1; |
VERROR(ret, NULL, | VERROR(ret, NULL, |
"The type definition is absent"); | "The type definition is absent"); |
goto exit; |
goto exit; |
} |
} |
if (vctxt->inode->typeDef->flags & XML_SCHEMAS_TYPE_ABSTRACT) { |
if (vctxt->inode->typeDef->flags & XML_SCHEMAS_TYPE_ABSTRACT) { |
vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE; |
vctxt->inode->flags |= XML_SCHEMA_NODE_INFO_ERR_BAD_TYPE; |
ret = XML_SCHEMAV_CVC_TYPE_2; |
ret = XML_SCHEMAV_CVC_TYPE_2; |
VERROR(ret, NULL, | VERROR(ret, NULL, |
"The type definition is abstract"); | "The type definition is abstract"); |
goto exit; |
goto exit; |
} |
} |
/* |
/* |
Line 27165 internal_error:
|
Line 27210 internal_error:
|
#endif |
#endif |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* SAX validation handlers * | * SAX validation handlers * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
/* |
/* |
Line 27418 internal_error:
|
Line 27463 internal_error:
|
} |
} |
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Validation interfaces * | * Validation interfaces * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
|
|
/** |
/** |
Line 27450 xmlSchemaNewValidCtxt(xmlSchemaPtr schema)
|
Line 27495 xmlSchemaNewValidCtxt(xmlSchemaPtr schema)
|
} |
} |
|
|
/** |
/** |
|
* xmlSchemaValidateSetFilename: |
|
* @vctxt: the schema validation context |
|
* @filename: the file name |
|
* |
|
* Workaround to provide file error reporting information when this is |
|
* not provided by current APIs |
|
*/ |
|
void |
|
xmlSchemaValidateSetFilename(xmlSchemaValidCtxtPtr vctxt, const char *filename) { |
|
if (vctxt == NULL) |
|
return; |
|
if (vctxt->filename != NULL) |
|
xmlFree(vctxt->filename); |
|
if (filename != NULL) |
|
vctxt->filename = (char *) xmlStrdup((const xmlChar *) filename); |
|
else |
|
vctxt->filename = NULL; |
|
} |
|
|
|
/** |
* xmlSchemaClearValidCtxt: |
* xmlSchemaClearValidCtxt: |
* @ctxt: the schema validation context | * @vctxt: the schema validation context |
* |
* |
* Free the resources associated to the schema validation context; |
* Free the resources associated to the schema validation context; |
* leaves some fields alive intended for reuse of the context. |
* leaves some fields alive intended for reuse of the context. |
Line 27552 xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt)
|
Line 27617 xmlSchemaClearValidCtxt(xmlSchemaValidCtxtPtr vctxt)
|
* where the user provides the dict? |
* where the user provides the dict? |
*/ |
*/ |
vctxt->dict = xmlDictCreate(); |
vctxt->dict = xmlDictCreate(); |
|
|
|
if (vctxt->filename != NULL) { |
|
xmlFree(vctxt->filename); |
|
vctxt->filename = NULL; |
|
} |
} |
} |
|
|
/** |
/** |
Line 27637 xmlSchemaFreeValidCtxt(xmlSchemaValidCtxtPtr ctxt)
|
Line 27707 xmlSchemaFreeValidCtxt(xmlSchemaValidCtxtPtr ctxt)
|
xmlSchemaItemListFree(ctxt->nodeQNames); |
xmlSchemaItemListFree(ctxt->nodeQNames); |
if (ctxt->dict != NULL) |
if (ctxt->dict != NULL) |
xmlDictFree(ctxt->dict); |
xmlDictFree(ctxt->dict); |
|
if (ctxt->filename != NULL) |
|
xmlFree(ctxt->filename); |
xmlFree(ctxt); |
xmlFree(ctxt); |
} |
} |
|
|
Line 27791 xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt)
|
Line 27863 xmlSchemaVDocWalk(xmlSchemaValidCtxtPtr vctxt)
|
const xmlChar *nsName; |
const xmlChar *nsName; |
|
|
/* DOC VAL TODO: Move this to the start function. */ |
/* DOC VAL TODO: Move this to the start function. */ |
valRoot = xmlDocGetRootElement(vctxt->doc); | if (vctxt->validationRoot != NULL) |
| valRoot = vctxt->validationRoot; |
| else |
| valRoot = xmlDocGetRootElement(vctxt->doc); |
if (valRoot == NULL) { |
if (valRoot == NULL) { |
/* VAL TODO: Error code? */ |
/* VAL TODO: Error code? */ |
VERROR(1, NULL, "The document has no document element"); |
VERROR(1, NULL, "The document has no document element"); |
Line 28112 xmlSchemaValidateDoc(xmlSchemaValidCtxtPtr ctxt, xmlDo
|
Line 28187 xmlSchemaValidateDoc(xmlSchemaValidCtxtPtr ctxt, xmlDo
|
|
|
|
|
/************************************************************************ |
/************************************************************************ |
* * | * * |
* Function and data for SAX streaming API * | * Function and data for SAX streaming API * |
* * | * * |
************************************************************************/ |
************************************************************************/ |
typedef struct _xmlSchemaSplitSAXData xmlSchemaSplitSAXData; |
typedef struct _xmlSchemaSplitSAXData xmlSchemaSplitSAXData; |
typedef xmlSchemaSplitSAXData *xmlSchemaSplitSAXDataPtr; |
typedef xmlSchemaSplitSAXData *xmlSchemaSplitSAXDataPtr; |
Line 28631 xmlSchemaSAXUnplug(xmlSchemaSAXPlugPtr plug)
|
Line 28706 xmlSchemaSAXUnplug(xmlSchemaSAXPlugPtr plug)
|
} |
} |
|
|
/** |
/** |
|
* xmlSchemaValidateSetLocator: |
|
* @vctxt: a schema validation context |
|
* @f: the locator function pointer |
|
* @ctxt: the locator context |
|
* |
|
* Allows to set a locator function to the validation context, |
|
* which will be used to provide file and line information since |
|
* those are not provided as part of the SAX validation flow |
|
* Setting @f to NULL disable the locator. |
|
*/ |
|
|
|
void |
|
xmlSchemaValidateSetLocator(xmlSchemaValidCtxtPtr vctxt, |
|
xmlSchemaValidityLocatorFunc f, |
|
void *ctxt) |
|
{ |
|
if (vctxt == NULL) return; |
|
vctxt->locFunc = f; |
|
vctxt->locCtxt = ctxt; |
|
} |
|
|
|
/** |
|
* xmlSchemaValidateStreamLocator: |
|
* @ctx: the xmlTextReaderPtr used |
|
* @file: returned file information |
|
* @line: returned line information |
|
* |
|
* Internal locator function for the readers |
|
* |
|
* Returns 0 in case the Schema validation could be (des)activated and |
|
* -1 in case of error. |
|
*/ |
|
static int |
|
xmlSchemaValidateStreamLocator(void *ctx, const char **file, |
|
unsigned long *line) { |
|
xmlParserCtxtPtr ctxt; |
|
|
|
if ((ctx == NULL) || ((file == NULL) && (line == NULL))) |
|
return(-1); |
|
|
|
if (file != NULL) |
|
*file = NULL; |
|
if (line != NULL) |
|
*line = 0; |
|
|
|
ctxt = (xmlParserCtxtPtr) ctx; |
|
if (ctxt->input != NULL) { |
|
if (file != NULL) |
|
*file = ctxt->input->filename; |
|
if (line != NULL) |
|
*line = ctxt->input->line; |
|
return(0); |
|
} |
|
return(-1); |
|
} |
|
|
|
/** |
* xmlSchemaValidateStream: |
* xmlSchemaValidateStream: |
* @ctxt: a schema validation context |
* @ctxt: a schema validation context |
* @input: the input to use for reading the data |
* @input: the input to use for reading the data |
Line 28673 xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
|
Line 28805 xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
|
xmlCtxtUseOptions(pctxt, options); |
xmlCtxtUseOptions(pctxt, options); |
#endif |
#endif |
pctxt->linenumbers = 1; |
pctxt->linenumbers = 1; |
|
xmlSchemaValidateSetLocator(ctxt, xmlSchemaValidateStreamLocator, pctxt); |
|
|
inputStream = xmlNewIOInputStream(pctxt, input, enc);; |
inputStream = xmlNewIOInputStream(pctxt, input, enc);; |
if (inputStream == NULL) { |
if (inputStream == NULL) { |