summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2005-07-19 14:33:55 +0000
committerDaniel Veillard <veillard@src.gnome.org>2005-07-19 14:33:55 +0000
commit9efc476bb6fe9d7d84ee0fe1190888801d9374cc (patch)
treefb521a9d24788a92d6da45ef228b4cecb3df5299
parent365c806eb59f9babf5b19bfa2e6eb003c28ff3d9 (diff)
downloadlibxml2-9efc476bb6fe9d7d84ee0fe1190888801d9374cc.tar.gz
fixing bug #172215 about foreign namespaces by adding support for negated
* xmlregexp.c xmlschemas.c include/libxml/xmlautomata.h: fixing bug #172215 about foreign namespaces by adding support for negated string transitions. Error messages still need to be improved. * test/schemas/any5* result/schemas/any5*: adding regression tests for this. Daniel
-rw-r--r--ChangeLog11
-rw-r--r--include/libxml/xmlautomata.h8
-rw-r--r--result/schemas/any5_0_01
-rw-r--r--result/schemas/any5_0_0.err1
-rw-r--r--result/schemas/any5_0_11
-rw-r--r--result/schemas/any5_0_1.err1
-rw-r--r--result/schemas/any5_0_21
-rw-r--r--result/schemas/any5_0_2.err1
-rw-r--r--result/schemas/any5_0_31
-rw-r--r--result/schemas/any5_0_3.err0
-rw-r--r--result/schemas/any5_0_41
-rw-r--r--result/schemas/any5_0_4.err1
-rw-r--r--result/schemas/any5_0_51
-rw-r--r--result/schemas/any5_0_5.err1
-rw-r--r--result/schemas/any5_0_61
-rw-r--r--result/schemas/any5_0_6.err1
-rw-r--r--result/schemas/any5_1_01
-rw-r--r--result/schemas/any5_1_0.err1
-rw-r--r--result/schemas/any5_1_11
-rw-r--r--result/schemas/any5_1_1.err1
-rw-r--r--result/schemas/any5_1_21
-rw-r--r--result/schemas/any5_1_2.err0
-rw-r--r--result/schemas/any5_1_31
-rw-r--r--result/schemas/any5_1_3.err1
-rw-r--r--result/schemas/any5_1_41
-rw-r--r--result/schemas/any5_1_4.err1
-rw-r--r--result/schemas/any5_1_51
-rw-r--r--result/schemas/any5_1_5.err0
-rw-r--r--result/schemas/any5_1_61
-rw-r--r--result/schemas/any5_1_6.err1
-rw-r--r--test/schemas/any5_0.xml7
-rw-r--r--test/schemas/any5_0.xsd13
-rw-r--r--test/schemas/any5_1.xml12
-rw-r--r--test/schemas/any5_1.xsd14
-rw-r--r--test/schemas/any5_2.xml8
-rw-r--r--test/schemas/any5_3.xml11
-rw-r--r--test/schemas/any5_4.xml12
-rw-r--r--test/schemas/any5_5.xml12
-rw-r--r--test/schemas/any5_6.xml13
-rw-r--r--xmlregexp.c80
-rw-r--r--xmlschemas.c65
41 files changed, 223 insertions, 68 deletions
diff --git a/ChangeLog b/ChangeLog
index 10ca24bc..5289405f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,13 @@
-Tue Jul 19 12:33:31 CEST 2005 Daniel Veillard <daniel@veillard.com>
+Tue Jul 19 15:34:12 CEST 2005 Daniel Veillard <daniel@veillard.com>
+
+ * xmlregexp.c xmlschemas.c include/libxml/xmlautomata.h: fixing
+ bug #172215 about foreign namespaces by adding support for
+ negated string transitions. Error messages still need to be
+ improved.
+ * test/schemas/any5* result/schemas/any5*: adding regression
+ tests for this.
+
+Tue Jul 19 12:33:31 CEST 2005 Daniel Veillard <daniel@veillard.com>
* tree.c: applied patch from Alexander Pohoyda fixing xmlGetNodePath
on namespaced attributes #310417.
diff --git a/include/libxml/xmlautomata.h b/include/libxml/xmlautomata.h
index d29ddcfc..f98b55e2 100644
--- a/include/libxml/xmlautomata.h
+++ b/include/libxml/xmlautomata.h
@@ -65,6 +65,14 @@ XMLPUBFUN xmlAutomataStatePtr XMLCALL
const xmlChar *token,
const xmlChar *token2,
void *data);
+XMLPUBFUN xmlAutomataStatePtr XMLCALL
+ xmlAutomataNewNegTrans (xmlAutomataPtr am,
+ xmlAutomataStatePtr from,
+ xmlAutomataStatePtr to,
+ const xmlChar *token,
+ const xmlChar *token2,
+ void *data);
+
XMLPUBFUN xmlAutomataStatePtr XMLCALL
xmlAutomataNewCountTrans (xmlAutomataPtr am,
xmlAutomataStatePtr from,
diff --git a/result/schemas/any5_0_0 b/result/schemas/any5_0_0
new file mode 100644
index 00000000..910f8bbd
--- /dev/null
+++ b/result/schemas/any5_0_0
@@ -0,0 +1 @@
+./test/schemas/any5_0.xml fails to validate
diff --git a/result/schemas/any5_0_0.err b/result/schemas/any5_0_0.err
new file mode 100644
index 00000000..f9c434f1
--- /dev/null
+++ b/result/schemas/any5_0_0.err
@@ -0,0 +1 @@
+./test/schemas/any5_0.xml:4: element foo: Schemas validity error : Element '{urn:test:foo}foo': Missing child element(s).
diff --git a/result/schemas/any5_0_1 b/result/schemas/any5_0_1
new file mode 100644
index 00000000..5e2c461d
--- /dev/null
+++ b/result/schemas/any5_0_1
@@ -0,0 +1 @@
+./test/schemas/any5_1.xml fails to validate
diff --git a/result/schemas/any5_0_1.err b/result/schemas/any5_0_1.err
new file mode 100644
index 00000000..79d7e35b
--- /dev/null
+++ b/result/schemas/any5_0_1.err
@@ -0,0 +1 @@
+./test/schemas/any5_1.xml:11: element boo: Schemas validity error : Element '{urn:test:bar}boo': This element is not expected.
diff --git a/result/schemas/any5_0_2 b/result/schemas/any5_0_2
new file mode 100644
index 00000000..b049478c
--- /dev/null
+++ b/result/schemas/any5_0_2
@@ -0,0 +1 @@
+./test/schemas/any5_2.xml fails to validate
diff --git a/result/schemas/any5_0_2.err b/result/schemas/any5_0_2.err
new file mode 100644
index 00000000..68d77f1d
--- /dev/null
+++ b/result/schemas/any5_0_2.err
@@ -0,0 +1 @@
+./test/schemas/any5_2.xml:4: element foo: Schemas validity error : Element '{urn:test:foo}foo': Missing child element(s).
diff --git a/result/schemas/any5_0_3 b/result/schemas/any5_0_3
new file mode 100644
index 00000000..8cfb94e6
--- /dev/null
+++ b/result/schemas/any5_0_3
@@ -0,0 +1 @@
+./test/schemas/any5_3.xml validates
diff --git a/result/schemas/any5_0_3.err b/result/schemas/any5_0_3.err
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/schemas/any5_0_3.err
diff --git a/result/schemas/any5_0_4 b/result/schemas/any5_0_4
new file mode 100644
index 00000000..0a4bce06
--- /dev/null
+++ b/result/schemas/any5_0_4
@@ -0,0 +1 @@
+./test/schemas/any5_4.xml fails to validate
diff --git a/result/schemas/any5_0_4.err b/result/schemas/any5_0_4.err
new file mode 100644
index 00000000..74a6bda1
--- /dev/null
+++ b/result/schemas/any5_0_4.err
@@ -0,0 +1 @@
+./test/schemas/any5_4.xml:11: element boo: Schemas validity error : Element '{urn:test:bar}boo': This element is not expected.
diff --git a/result/schemas/any5_0_5 b/result/schemas/any5_0_5
new file mode 100644
index 00000000..6c15d25d
--- /dev/null
+++ b/result/schemas/any5_0_5
@@ -0,0 +1 @@
+./test/schemas/any5_5.xml fails to validate
diff --git a/result/schemas/any5_0_5.err b/result/schemas/any5_0_5.err
new file mode 100644
index 00000000..e50113f4
--- /dev/null
+++ b/result/schemas/any5_0_5.err
@@ -0,0 +1 @@
+./test/schemas/any5_5.xml:11: element boo: Schemas validity error : Element '{urn:test:foo}boo': This element is not expected.
diff --git a/result/schemas/any5_0_6 b/result/schemas/any5_0_6
new file mode 100644
index 00000000..c9df5626
--- /dev/null
+++ b/result/schemas/any5_0_6
@@ -0,0 +1 @@
+./test/schemas/any5_6.xml fails to validate
diff --git a/result/schemas/any5_0_6.err b/result/schemas/any5_0_6.err
new file mode 100644
index 00000000..b64cd4fb
--- /dev/null
+++ b/result/schemas/any5_0_6.err
@@ -0,0 +1 @@
+./test/schemas/any5_6.xml:11: element boo: Schemas validity error : Element '{urn:test:bar}boo': This element is not expected.
diff --git a/result/schemas/any5_1_0 b/result/schemas/any5_1_0
new file mode 100644
index 00000000..910f8bbd
--- /dev/null
+++ b/result/schemas/any5_1_0
@@ -0,0 +1 @@
+./test/schemas/any5_0.xml fails to validate
diff --git a/result/schemas/any5_1_0.err b/result/schemas/any5_1_0.err
new file mode 100644
index 00000000..f9c434f1
--- /dev/null
+++ b/result/schemas/any5_1_0.err
@@ -0,0 +1 @@
+./test/schemas/any5_0.xml:4: element foo: Schemas validity error : Element '{urn:test:foo}foo': Missing child element(s).
diff --git a/result/schemas/any5_1_1 b/result/schemas/any5_1_1
new file mode 100644
index 00000000..5e2c461d
--- /dev/null
+++ b/result/schemas/any5_1_1
@@ -0,0 +1 @@
+./test/schemas/any5_1.xml fails to validate
diff --git a/result/schemas/any5_1_1.err b/result/schemas/any5_1_1.err
new file mode 100644
index 00000000..bbfccb44
--- /dev/null
+++ b/result/schemas/any5_1_1.err
@@ -0,0 +1 @@
+./test/schemas/any5_1.xml:11: element boo: Schemas validity error : Element '{urn:test:bar}boo': This element is not expected. Expected is ( {urn:test:foo}boo ).
diff --git a/result/schemas/any5_1_2 b/result/schemas/any5_1_2
new file mode 100644
index 00000000..6eab2bb1
--- /dev/null
+++ b/result/schemas/any5_1_2
@@ -0,0 +1 @@
+./test/schemas/any5_2.xml validates
diff --git a/result/schemas/any5_1_2.err b/result/schemas/any5_1_2.err
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/schemas/any5_1_2.err
diff --git a/result/schemas/any5_1_3 b/result/schemas/any5_1_3
new file mode 100644
index 00000000..f114a670
--- /dev/null
+++ b/result/schemas/any5_1_3
@@ -0,0 +1 @@
+./test/schemas/any5_3.xml fails to validate
diff --git a/result/schemas/any5_1_3.err b/result/schemas/any5_1_3.err
new file mode 100644
index 00000000..e6c07b28
--- /dev/null
+++ b/result/schemas/any5_1_3.err
@@ -0,0 +1 @@
+./test/schemas/any5_3.xml:4: element foo: Schemas validity error : Element '{urn:test:foo}foo': Missing child element(s).
diff --git a/result/schemas/any5_1_4 b/result/schemas/any5_1_4
new file mode 100644
index 00000000..0a4bce06
--- /dev/null
+++ b/result/schemas/any5_1_4
@@ -0,0 +1 @@
+./test/schemas/any5_4.xml fails to validate
diff --git a/result/schemas/any5_1_4.err b/result/schemas/any5_1_4.err
new file mode 100644
index 00000000..6d89773d
--- /dev/null
+++ b/result/schemas/any5_1_4.err
@@ -0,0 +1 @@
+./test/schemas/any5_4.xml:11: element boo: Schemas validity error : Element '{urn:test:bar}boo': This element is not expected. Expected is ( {urn:test:foo}boo ).
diff --git a/result/schemas/any5_1_5 b/result/schemas/any5_1_5
new file mode 100644
index 00000000..e573d46d
--- /dev/null
+++ b/result/schemas/any5_1_5
@@ -0,0 +1 @@
+./test/schemas/any5_5.xml validates
diff --git a/result/schemas/any5_1_5.err b/result/schemas/any5_1_5.err
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/result/schemas/any5_1_5.err
diff --git a/result/schemas/any5_1_6 b/result/schemas/any5_1_6
new file mode 100644
index 00000000..c9df5626
--- /dev/null
+++ b/result/schemas/any5_1_6
@@ -0,0 +1 @@
+./test/schemas/any5_6.xml fails to validate
diff --git a/result/schemas/any5_1_6.err b/result/schemas/any5_1_6.err
new file mode 100644
index 00000000..8c3f020a
--- /dev/null
+++ b/result/schemas/any5_1_6.err
@@ -0,0 +1 @@
+./test/schemas/any5_6.xml:11: element boo: Schemas validity error : Element '{urn:test:bar}boo': This element is not expected. Expected is ( {urn:test:foo}boo ).
diff --git a/test/schemas/any5_0.xml b/test/schemas/any5_0.xml
new file mode 100644
index 00000000..e716cb1f
--- /dev/null
+++ b/test/schemas/any5_0.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<foo xmlns="urn:test:foo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:test:foo any5_0.xsd">
+ <boo/>
+ <boo/>
+</foo>
diff --git a/test/schemas/any5_0.xsd b/test/schemas/any5_0.xsd
new file mode 100644
index 00000000..70c87892
--- /dev/null
+++ b/test/schemas/any5_0.xsd
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:test:foo"
+ elementFormDefault="qualified">
+ <xsd:element name="foo">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="boo"/>
+ <xsd:any namespace="##other" maxOccurs="5" processContents="lax"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema> \ No newline at end of file
diff --git a/test/schemas/any5_1.xml b/test/schemas/any5_1.xml
new file mode 100644
index 00000000..91dcb548
--- /dev/null
+++ b/test/schemas/any5_1.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<foo xmlns="urn:test:foo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:test:foo any5_0.xsd">
+ <boo/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+</foo>
diff --git a/test/schemas/any5_1.xsd b/test/schemas/any5_1.xsd
new file mode 100644
index 00000000..4d3c9ded
--- /dev/null
+++ b/test/schemas/any5_1.xsd
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="urn:test:foo"
+ elementFormDefault="qualified">
+ <xsd:element name="foo">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="boo"/>
+ <xsd:any namespace="##other" maxOccurs="5" processContents="lax"/>
+ <xsd:element name="boo"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+</xsd:schema>
diff --git a/test/schemas/any5_2.xml b/test/schemas/any5_2.xml
new file mode 100644
index 00000000..e8434d18
--- /dev/null
+++ b/test/schemas/any5_2.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<foo xmlns="urn:test:foo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:test:foo any5_0.xsd">
+ <boo/>
+ <boo xmlns="urn:test:bar"/>
+ <boo/>
+</foo>
diff --git a/test/schemas/any5_3.xml b/test/schemas/any5_3.xml
new file mode 100644
index 00000000..828c4b33
--- /dev/null
+++ b/test/schemas/any5_3.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<foo xmlns="urn:test:foo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:test:foo any5_0.xsd">
+ <boo/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+</foo>
diff --git a/test/schemas/any5_4.xml b/test/schemas/any5_4.xml
new file mode 100644
index 00000000..91dcb548
--- /dev/null
+++ b/test/schemas/any5_4.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<foo xmlns="urn:test:foo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:test:foo any5_0.xsd">
+ <boo/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+</foo>
diff --git a/test/schemas/any5_5.xml b/test/schemas/any5_5.xml
new file mode 100644
index 00000000..e09d8a10
--- /dev/null
+++ b/test/schemas/any5_5.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<foo xmlns="urn:test:foo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:test:foo any5_0.xsd">
+ <boo/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo/>
+</foo>
diff --git a/test/schemas/any5_6.xml b/test/schemas/any5_6.xml
new file mode 100644
index 00000000..3b0ad73a
--- /dev/null
+++ b/test/schemas/any5_6.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<foo xmlns="urn:test:foo"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:test:foo any5_0.xsd">
+ <boo/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo xmlns="urn:test:bar"/>
+ <boo/>
+</foo>
diff --git a/xmlregexp.c b/xmlregexp.c
index e65c1a66..536e9f8b 100644
--- a/xmlregexp.c
+++ b/xmlregexp.c
@@ -329,6 +329,7 @@ struct _xmlRegExecCtxt {
static void xmlFAParseRegExp(xmlRegParserCtxtPtr ctxt, int top);
static void xmlRegFreeState(xmlRegStatePtr state);
static void xmlRegFreeAtom(xmlRegAtomPtr atom);
+static int xmlRegStrEqualWildcard(const xmlChar *expStr, const xmlChar *valStr);
/************************************************************************
* *
@@ -971,6 +972,8 @@ xmlRegPrintAtom(FILE *output, xmlRegAtomPtr atom) {
fprintf(output, "NULL\n");
return;
}
+ if (atom->neg)
+ fprintf(output, "not ");
xmlRegPrintAtomType(output, atom->type);
xmlRegPrintQuantType(output, atom->quant);
if (atom->quant == XML_REGEXP_QUANT_RANGE)
@@ -1741,6 +1744,8 @@ xmlFAEliminateEpsilonTransitions(xmlRegParserCtxtPtr ctxt) {
*/
static int
xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) {
+ int ret;
+
if (atom1 == atom2)
return(1);
if ((atom1 == NULL) || (atom2 == NULL))
@@ -1750,19 +1755,23 @@ xmlFACompareAtoms(xmlRegAtomPtr atom1, xmlRegAtomPtr atom2) {
return(0);
switch (atom1->type) {
case XML_REGEXP_STRING:
- return(xmlStrEqual((xmlChar *)atom1->valuep,
- (xmlChar *)atom2->valuep));
+ ret = xmlRegStrEqualWildcard((xmlChar *)atom1->valuep,
+ (xmlChar *)atom2->valuep);
+ break;
case XML_REGEXP_EPSILON:
return(1);
case XML_REGEXP_CHARVAL:
- return(atom1->codepoint == atom2->codepoint);
+ ret = atom1->codepoint == atom2->codepoint;
+ break;
case XML_REGEXP_RANGES:
TODO;
return(0);
default:
- break;
+ return(1);
}
- return(1);
+ if (atom1->neg != atom2->neg)
+ ret = !ret;
+ return(ret);
}
/**
@@ -2907,6 +2916,8 @@ xmlRegExecPushString(xmlRegExecCtxtPtr exec, const xmlChar *value,
break;
} else if (value != NULL) {
ret = xmlRegStrEqualWildcard(atom->valuep, value);
+ if (atom->neg)
+ ret = !ret;
if ((ret == 1) && (trans->counter >= 0)) {
xmlRegCounterPtr counter;
int count;
@@ -4736,6 +4747,65 @@ xmlAutomataNewTransition2(xmlAutomataPtr am, xmlAutomataStatePtr from,
}
/**
+ * xmlAutomataNewNegTrans:
+ * @am: an automata
+ * @from: the starting point of the transition
+ * @to: the target point of the transition or NULL
+ * @token: the first input string associated to that transition
+ * @token2: the second input string associated to that transition
+ * @data: data passed to the callback function if the transition is activated
+ *
+ * If @to is NULL, this creates first a new target state in the automata
+ * and then adds a transition from the @from state to the target state
+ * activated by any value except (@token,@token2)
+ *
+ * Returns the target state or NULL in case of error
+ */
+xmlAutomataStatePtr
+xmlAutomataNewNegTrans(xmlAutomataPtr am, xmlAutomataStatePtr from,
+ xmlAutomataStatePtr to, const xmlChar *token,
+ const xmlChar *token2, void *data) {
+ xmlRegAtomPtr atom;
+
+ if ((am == NULL) || (from == NULL) || (token == NULL))
+ return(NULL);
+ atom = xmlRegNewAtom(am, XML_REGEXP_STRING);
+ if (atom == NULL)
+ return(NULL);
+ atom->data = data;
+ atom->neg = 1;
+ if ((token2 == NULL) || (*token2 == 0)) {
+ atom->valuep = xmlStrdup(token);
+ } else {
+ int lenn, lenp;
+ xmlChar *str;
+
+ lenn = strlen((char *) token2);
+ lenp = strlen((char *) token);
+
+ str = (xmlChar *) xmlMallocAtomic(lenn + lenp + 2);
+ if (str == NULL) {
+ xmlRegFreeAtom(atom);
+ return(NULL);
+ }
+ memcpy(&str[0], token, lenp);
+ str[lenp] = '|';
+ memcpy(&str[lenp + 1], token2, lenn);
+ str[lenn + lenp + 1] = 0;
+
+ atom->valuep = str;
+ }
+
+ if (xmlFAGenerateTransitions(am, from, to, atom) < 0) {
+ xmlRegFreeAtom(atom);
+ return(NULL);
+ }
+ if (to == NULL)
+ return(am->state);
+ return(to);
+}
+
+/**
* xmlAutomataNewCountTrans2:
* @am: an automata
* @from: the starting point of the transition
diff --git a/xmlschemas.c b/xmlschemas.c
index d17c3bda..821b48f7 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -11132,14 +11132,9 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr ctxt,
} while (ns != NULL);
} else if (wild->negNsSet != NULL) {
- xmlAutomataStatePtr deadEnd;
-
- deadEnd = xmlAutomataNewState(ctxt->am);
- ctxt->state = xmlAutomataNewTransition2(ctxt->am,
- start, deadEnd, BAD_CAST "*", wild->negNsSet->value, wild);
- ctxt->state = xmlAutomataNewTransition2(ctxt->am,
- start, NULL, BAD_CAST "*", BAD_CAST "*", wild);
- xmlAutomataNewEpsilon(ctxt->am, ctxt->state, hop);
+ ctxt->state = xmlAutomataNewNegTrans(ctxt->am,
+ start, hop, BAD_CAST "*", wild->negNsSet->value,
+ wild);
}
xmlAutomataNewCountedTrans(ctxt->am, hop, start, counter);
xmlAutomataNewCounterTrans(ctxt->am, hop, end, counter);
@@ -11384,60 +11379,6 @@ xmlSchemaBuildAContentModel(xmlSchemaParserCtxtPtr ctxt,
ctxt->state =
xmlAutomataNewAllTrans(ctxt->am, ctxt->state, NULL, lax);
break;
-#if 0
- xmlAutomataStatePtr start, end, base;
- xmlSchemaParticlePtr sub;
- xmlSchemaElementPtr elemDecl;
- int nbtrans = 0;
- int lax = particle->minOccurs == 0;
- int counter = -1;
-
- sub = (xmlSchemaParticlePtr) particle->children->children;
- if (sub == NULL)
- break;
-
- start = ctxt->state;
- end = xmlAutomataNewState(ctxt->am);
- base = xmlAutomataNewState(ctxt->am);
- xmlAutomataNewEpsilon(ctxt->am, start, base);
-
- if (!lax) {
- while (sub != NULL) {
- sub = (xmlSchemaParticlePtr) sub->next;
- nbtrans++;
- }
- sub = (xmlSchemaParticlePtr) particle->children->children;
- nbtrans--;
- counter = xmlAutomataNewCounter(ctxt->am, nbtrans, nbtrans);
- }
-
- while (sub != NULL) {
- ctxt->state = base;
-
- elemDecl = (xmlSchemaElementPtr) sub->children;
- if (elemDecl == NULL) {
- xmlSchemaPErr(ctxt, NULL,
- XML_SCHEMAP_INTERNAL,
- "Internal error: xmlSchemaBuildAContentModel, "
- "<element> particle a NULL term.\n", NULL, NULL);
- return;
- };
- xmlSchemaBuildContentModelForElement(ctxt,
- (xmlSchemaParticlePtr) sub, 1);
- if (lax) {
- xmlAutomataNewEpsilon(ctxt->am, ctxt->state, base);
- xmlAutomataNewEpsilon(ctxt->am, ctxt->state, end);
- } else {
- xmlAutomataNewCountedTrans(ctxt->am, ctxt->state,
- base, counter);
- xmlAutomataNewCounterTrans(ctxt->am, ctxt->state,
- end, counter);
- }
- sub = (xmlSchemaParticlePtr) sub->next;
- }
- ctxt->state = end;
- break;
-#endif
}
default:
xmlGenericError(xmlGenericErrorContext,