diff options
Diffstat (limited to 'relaxng.c')
-rw-r--r-- | relaxng.c | 37 |
1 files changed, 33 insertions, 4 deletions
@@ -1561,8 +1561,8 @@ xmlRelaxNGRemoveRedefine(xmlRelaxNGParserCtxtPtr ctxt, href = xmlGetProp(tmp, BAD_CAST "href"); #endif if (xmlRelaxNGRemoveRedefine(ctxt, href, - inc->doc->children-> - children, name) == 1) { + xmlDocGetRootElement(inc->doc)->children, + name) == 1) { found = 1; } #ifdef DEBUG_INCLUDE @@ -3059,8 +3059,8 @@ xmlRelaxNGCompile(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGDefinePtr def) list = list->next; } xmlAutomataSetFinalState(ctxt->am, ctxt->state); - def->contModel = xmlAutomataCompile(ctxt->am); - xmlRegexpIsDeterminist(def->contModel); + if (xmlAutomataIsDeterminist(ctxt->am)) + def->contModel = xmlAutomataCompile(ctxt->am); xmlFreeAutomata(ctxt->am); ctxt->state = oldstate; @@ -8884,6 +8884,11 @@ xmlRelaxNGValidateValue(xmlRelaxNGValidCtxtPtr ctxt, case XML_RELAXNG_ZEROORMORE:{ xmlChar *cur, *temp; + if ((ctxt->state->value == NULL) || + (*ctxt->state->value == 0)) { + ret = 0; + break; + } oldflags = ctxt->flags; ctxt->flags |= FLAGS_IGNORABLE; cur = ctxt->state->value; @@ -8905,6 +8910,30 @@ xmlRelaxNGValidateValue(xmlRelaxNGValidCtxtPtr ctxt, xmlRelaxNGPopErrors(ctxt, 0); break; } + case XML_RELAXNG_OPTIONAL:{ + xmlChar *temp; + + if ((ctxt->state->value == NULL) || + (*ctxt->state->value == 0)) { + ret = 0; + break; + } + oldflags = ctxt->flags; + ctxt->flags |= FLAGS_IGNORABLE; + temp = ctxt->state->value; + ret = xmlRelaxNGValidateValue(ctxt, define->content); + ctxt->flags = oldflags; + if (ret != 0) { + ctxt->state->value = temp; + if (ctxt->errNr > 0) + xmlRelaxNGPopErrors(ctxt, 0); + ret = 0; + break; + } + if (ctxt->errNr > 0) + xmlRelaxNGPopErrors(ctxt, 0); + break; + } case XML_RELAXNG_EXCEPT:{ xmlRelaxNGDefinePtr list; |