aboutsummaryrefslogtreecommitdiffstats
path: root/valid.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2003-02-05 11:01:50 +0000
committerDaniel Veillard <veillard@src.gnome.org>2003-02-05 11:01:50 +0000
commitec498e1b33ffef0246296491642facb95b77a743 (patch)
tree34b2d392372bc89399b61362ab25098021188183 /valid.c
parentde590ca1805a4691fe217242dd783b9a6b0d19eb (diff)
downloadandroid_external_libxml2-ec498e1b33ffef0246296491642facb95b77a743.tar.gz
android_external_libxml2-ec498e1b33ffef0246296491642facb95b77a743.tar.bz2
android_external_libxml2-ec498e1b33ffef0246296491642facb95b77a743.zip
do not run content model validation if the content is not determinist
* valid.c: do not run content model validation if the content is not determinist Daniel
Diffstat (limited to 'valid.c')
-rw-r--r--valid.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/valid.c b/valid.c
index 0f0fd231..7ed0e8a4 100644
--- a/valid.c
+++ b/valid.c
@@ -657,8 +657,13 @@ xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
if (elem->etype != XML_ELEMENT_TYPE_ELEMENT)
return(1);
/* TODO: should we rebuild in this case ? */
- if (elem->contModel != NULL)
+ if (elem->contModel != NULL) {
+ if (!xmlRegexpIsDeterminist(elem->contModel)) {
+ ctxt->valid = 0;
+ return(0);
+ }
return(1);
+ }
ctxt->am = xmlNewAutomata();
if (ctxt->am == NULL) {
@@ -680,6 +685,10 @@ xmlValidBuildContentModel(xmlValidCtxtPtr ctxt, xmlElementPtr elem) {
xmlRegexpPrint(stderr, elem->contModel);
#endif
ctxt->valid = 0;
+ ctxt->state = NULL;
+ xmlFreeAutomata(ctxt->am);
+ ctxt->am = NULL;
+ return(0);
}
ctxt->state = NULL;
xmlFreeAutomata(ctxt->am);
@@ -4717,6 +4726,9 @@ xmlValidateElementContent(xmlValidCtxtPtr ctxt, xmlNodePtr child,
} else {
xmlRegExecCtxtPtr exec;
+ if (!xmlRegexpIsDeterminist(elemDecl->contModel)) {
+ return(-1);
+ }
ctxt->nodeMax = 0;
ctxt->nodeNr = 0;
ctxt->nodeTab = NULL;