mirror of
https://github.com/GNOME/libxml2.git
synced 2025-03-31 19:10:28 +08:00
try to fix # 105049 a couple of changes and extensions updated a function
* HTMLparser.c: try to fix # 105049 * relaxng.c xmlschemastypes.c: a couple of changes and extensions * tree.c: updated a function comment Daniel
This commit is contained in:
parent
419a7688d0
commit
e5b110b384
@ -1,3 +1,9 @@
|
||||
Tue Feb 4 15:40:54 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* HTMLparser.c: try to fix # 105049
|
||||
* relaxng.c xmlschemastypes.c: a couple of changes and extensions
|
||||
* tree.c: updated a function comment
|
||||
|
||||
Tue Feb 4 00:20:58 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||
|
||||
* relaxng: more work on grammars and refs/defs
|
||||
|
40
HTMLparser.c
40
HTMLparser.c
@ -3927,11 +3927,49 @@ htmlCreateMemoryParserCtxt(const char *buffer, int size) {
|
||||
static htmlParserCtxtPtr
|
||||
htmlCreateDocParserCtxt(xmlChar *cur, const char *encoding ATTRIBUTE_UNUSED) {
|
||||
int len;
|
||||
htmlParserCtxtPtr ctxt;
|
||||
|
||||
if (cur == NULL)
|
||||
return(NULL);
|
||||
len = xmlStrlen(cur);
|
||||
return(htmlCreateMemoryParserCtxt((char *)cur, len));
|
||||
ctxt = htmlCreateMemoryParserCtxt((char *)cur, len);
|
||||
|
||||
if (encoding != NULL) {
|
||||
xmlCharEncoding enc;
|
||||
xmlCharEncodingHandlerPtr handler;
|
||||
|
||||
if (ctxt->input->encoding != NULL)
|
||||
xmlFree((xmlChar *) ctxt->input->encoding);
|
||||
ctxt->input->encoding = (const xmlChar *) encoding;
|
||||
|
||||
enc = xmlParseCharEncoding(encoding);
|
||||
/*
|
||||
* registered set of known encodings
|
||||
*/
|
||||
if (enc != XML_CHAR_ENCODING_ERROR) {
|
||||
xmlSwitchEncoding(ctxt, enc);
|
||||
if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||
ctxt->sax->error(ctxt->userData,
|
||||
"Unsupported encoding %s\n", encoding);
|
||||
ctxt->input->encoding = NULL;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* fallback for unknown encodings
|
||||
*/
|
||||
handler = xmlFindCharEncodingHandler((const char *) encoding);
|
||||
if (handler != NULL) {
|
||||
xmlSwitchToEncoding(ctxt, handler);
|
||||
} else {
|
||||
ctxt->errNo = XML_ERR_UNSUPPORTED_ENCODING;
|
||||
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
|
||||
ctxt->sax->error(ctxt->userData,
|
||||
"Unsupported encoding %s\n", encoding);
|
||||
}
|
||||
}
|
||||
}
|
||||
return(ctxt);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
31
relaxng.c
31
relaxng.c
@ -51,7 +51,7 @@ static const xmlChar *xmlRelaxNGNs = (const xmlChar *)
|
||||
#define DEBUG_CONTENT 1
|
||||
#define DEBUG_TYPE 1
|
||||
#define DEBUG_VALID 1
|
||||
#define DEBUG_INTERLEAVE 1 */
|
||||
/* #define DEBUG_INTERLEAVE 1 */
|
||||
|
||||
#define UNBOUNDED (1 << 30)
|
||||
#define TODO \
|
||||
@ -641,6 +641,8 @@ xmlRelaxNGNewValidState(xmlRelaxNGValidCtxtPtr ctxt, xmlNodePtr node)
|
||||
ctxt->error(ctxt->userData, "Out of memory\n");
|
||||
return (NULL);
|
||||
}
|
||||
ret->value = NULL;
|
||||
ret->endvalue = NULL;
|
||||
if (node == NULL) {
|
||||
ret->node = (xmlNodePtr) ctxt->doc;
|
||||
ret->seq = root;
|
||||
@ -1619,16 +1621,14 @@ xmlRelaxNGGetDataTypeLibrary(xmlRelaxNGParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||
}
|
||||
node = node->parent;
|
||||
while ((node != NULL) && (node->type == XML_ELEMENT_NODE)) {
|
||||
if (IS_RELAXNG(node, "element")) {
|
||||
ret = xmlGetProp(node, BAD_CAST "datatypeLibrary");
|
||||
if (ret != NULL) {
|
||||
escape = xmlURIEscapeStr(ret, BAD_CAST ":/#?");
|
||||
if (escape == NULL) {
|
||||
return(ret);
|
||||
}
|
||||
xmlFree(ret);
|
||||
return(escape);
|
||||
ret = xmlGetProp(node, BAD_CAST "datatypeLibrary");
|
||||
if (ret != NULL) {
|
||||
escape = xmlURIEscapeStr(ret, BAD_CAST ":/#?");
|
||||
if (escape == NULL) {
|
||||
return(ret);
|
||||
}
|
||||
xmlFree(ret);
|
||||
return(escape);
|
||||
}
|
||||
node = node->parent;
|
||||
}
|
||||
@ -4190,6 +4190,7 @@ xmlRelaxNGNextValue(xmlRelaxNGValidCtxtPtr ctxt) {
|
||||
cur = ctxt->state->value;
|
||||
if ((cur == NULL) || (ctxt->state->endvalue == NULL)) {
|
||||
ctxt->state->value = NULL;
|
||||
ctxt->state->endvalue = NULL;
|
||||
return(0);
|
||||
}
|
||||
while (*cur != 0) cur++;
|
||||
@ -4993,6 +4994,12 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
VALID_ERROR("Expecting an element\n");
|
||||
return(-1);
|
||||
}
|
||||
/*
|
||||
* This node was already validated successfully against
|
||||
* this definition.
|
||||
*/
|
||||
if (node->_private == define)
|
||||
break;
|
||||
if (define->name != NULL) {
|
||||
if (!xmlStrEqual(node->name, define->name)) {
|
||||
VALID_CTXT();
|
||||
@ -5060,7 +5067,9 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
||||
ctxt->state = oldstate;
|
||||
xmlRelaxNGFreeValidState(state);
|
||||
if (oldstate != NULL)
|
||||
oldstate->seq = node->next;
|
||||
oldstate->seq = xmlRelaxNGSkipIgnored(ctxt, node->next);
|
||||
if (ret == 0)
|
||||
node->_private = define;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
|
2
tree.c
2
tree.c
@ -2508,8 +2508,6 @@ xmlAddChildList(xmlNodePtr parent, xmlNodePtr cur) {
|
||||
*
|
||||
* Add a new node to @parent, at the end of the child (or property) list
|
||||
* merging adjacent TEXT nodes (in which case @cur is freed)
|
||||
* If the new node was already inserted in a document it is
|
||||
* first unlinked from its existing context.
|
||||
* If the new node is ATTRIBUTE, it is added into properties instead of children.
|
||||
* If there is an attribute with equal name, it is first destroyed.
|
||||
*
|
||||
|
@ -129,6 +129,8 @@ static xmlSchemaTypePtr xmlSchemaTypeDurationDef = NULL;
|
||||
static xmlSchemaTypePtr xmlSchemaTypeNmtoken = NULL;
|
||||
static xmlSchemaTypePtr xmlSchemaTypeFloatDef = NULL;
|
||||
static xmlSchemaTypePtr xmlSchemaTypeDoubleDef = NULL;
|
||||
static xmlSchemaTypePtr xmlSchemaTypeQNameDef = NULL;
|
||||
static xmlSchemaTypePtr xmlSchemaTypeAnyURIDef = NULL;
|
||||
|
||||
/*
|
||||
* Derived types
|
||||
@ -146,6 +148,7 @@ static xmlSchemaTypePtr xmlSchemaTypeUnsignedLongDef = NULL;
|
||||
static xmlSchemaTypePtr xmlSchemaTypeUnsignedIntDef = NULL;
|
||||
static xmlSchemaTypePtr xmlSchemaTypeUnsignedShortDef = NULL;
|
||||
static xmlSchemaTypePtr xmlSchemaTypeUnsignedByteDef = NULL;
|
||||
static xmlSchemaTypePtr xmlSchemaTypeNCNameDef = NULL;
|
||||
|
||||
/*
|
||||
* xmlSchemaInitBasicType:
|
||||
@ -202,6 +205,8 @@ xmlSchemaInitTypes(void) {
|
||||
xmlSchemaTypeNmtoken = xmlSchemaInitBasicType("NMTOKEN");
|
||||
xmlSchemaTypeFloatDef = xmlSchemaInitBasicType("float");
|
||||
xmlSchemaTypeDoubleDef = xmlSchemaInitBasicType("double");
|
||||
xmlSchemaTypeQNameDef = xmlSchemaInitBasicType("QName");
|
||||
xmlSchemaTypeAnyURIDef = xmlSchemaInitBasicType("anyURI");
|
||||
|
||||
/*
|
||||
* derived datatypes
|
||||
@ -219,6 +224,7 @@ xmlSchemaInitTypes(void) {
|
||||
xmlSchemaTypeUnsignedShortDef = xmlSchemaInitBasicType("insignedShort");;
|
||||
xmlSchemaTypeUnsignedByteDef = xmlSchemaInitBasicType("unsignedByte");;
|
||||
xmlSchemaTypePositiveIntegerDef = xmlSchemaInitBasicType("positiveInteger");
|
||||
xmlSchemaTypeNCNameDef = xmlSchemaInitBasicType("NCName");
|
||||
|
||||
xmlSchemaTypesInitialized = 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user