summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2004-09-26 14:42:56 +0000
committerDaniel Veillard <veillard@src.gnome.org>2004-09-26 14:42:56 +0000
commit807b4de28293518671393d0e26505ee0dddbe6a0 (patch)
treed95bb02e34c423d383ef50b9eec18cc50b21240e
parenta918b5b08ac20d4e7c765bdce653969ebad6c315 (diff)
downloadlibxml2-807b4de28293518671393d0e26505ee0dddbe6a0.tar.gz
applied patch from Malcolm Tredinnick fixing errata E20 concerning
* valid.c TODO: applied patch from Malcolm Tredinnick fixing errata E20 concerning NMTOKENS and co. validation #153722 * result/VC/AttributeNmtokens test/VC/AttributeNmtokens test/VCM/AttributeNmtokens.xml: also added tests from Malcolm Daniel
-rw-r--r--ChangeLog8
-rw-r--r--TODO49
-rw-r--r--parser.c6
-rw-r--r--result/VC/AttributeNmtokens3
-rw-r--r--test/VC/AttributeNmtokens6
-rw-r--r--test/VCM/AttributeNmtokens.xml14
-rw-r--r--valid.c10
7 files changed, 40 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index 7909b344..31adaec2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,14 @@
+Sun Sep 26 16:40:24 CEST 2004 Daniel Veillard <daniel@veillard.com>
+
+ * valid.c TODO: applied patch from Malcolm Tredinnick fixing errata
+ E20 concerning NMTOKENS and co. validation #153722
+ * result/VC/AttributeNmtokens test/VC/AttributeNmtokens
+ test/VCM/AttributeNmtokens.xml: also added tests from Malcolm
+
Sun Sep 26 16:24:44 CEST 2004 Daniel Veillard <daniel@veillard.com>
* xstc/xstc.py: applied patch from Malcolm Tredinnick fixing space/tabs
+ #153713
* xpath.c: fixed a realloc potential problem
Fri Sep 24 16:14:12 CEST 2004 Daniel Veillard <daniel@veillard.com>
diff --git a/TODO b/TODO
index a53e482c..e348834f 100644
--- a/TODO
+++ b/TODO
@@ -19,55 +19,6 @@ DOCS:
TODO:
=====
-
-- E20
-[17:21:38] <PGrosso> DV, you have an action to Check what your parser does on E20. Have you done this?
-[17:22:42] <PGrosso> DV, ref: http://www.w3.org/XML/xml-V10-2e-errata#E20
-[17:39:07] <DV> paphio:~/XML -> cat tst.xml
-[17:39:07] <DV> <!DOCTYPE test [
-[17:39:07] <DV> <!ELEMENT test EMPTY>
-[17:39:07] <DV> <!ATTLIST test attr1 NMTOKENS #IMPLIED>
-[17:39:07] <DV> <!ATTLIST test attr2 NMTOKENS #IMPLIED>
-[17:39:07] <DV> <!ATTLIST test attr3 NMTOKENS #IMPLIED>
-[17:39:07] <DV> ]>
-[17:39:07] <DV> <test
-[17:39:07] <DV> attr1=" a b "
-[17:39:07] <DV> attr2=" a&#x20;b "
-[17:39:07] <DV> attr3=" a&#x9;b "
-[17:39:07] <DV> />
-[17:39:07] <DV> paphio:~/XML -> xmllint --valid tst.xml
-[17:39:07] <DV> <?xml version="1.0"?>
-[17:39:07] <DV> <!DOCTYPE test [
-[17:39:07] <DV> <!ELEMENT test EMPTY>
-[17:39:07] <DV> <!ATTLIST test attr1 NMTOKENS #IMPLIED>
-[17:39:07] <DV> <!ATTLIST test attr2 NMTOKENS #IMPLIED>
-[17:39:07] <DV> <!ATTLIST test attr3 NMTOKENS #IMPLIED>
-[17:39:07] <DV> ]>
-[17:39:07] <DV> <test attr1="a b" attr2="a b" attr3="a&#9;b"/>
-[17:39:07] <DV> paphio:~/XML ->
-[17:39:16] <DV> I think it's okay
-[17:40:28] <PGrosso> DV, so you're saying that your parser implements E20 correctly, right?
-[17:40:48] <DV> assuming I understood E20 point correctly, yes
-[17:41:15] <DV> and that's because I'm unsure taht I pasted the est document and result
-[17:41:25] <DV> s/ est/ test/
-[17:48:56] <richard> does your parser say that document is invalid?
-[17:49:03] <DV> richard: did I understood it ?
-[17:49:11] <DV> richard: no it considers it valid
-[17:49:16] <richard> that document is invalid
-[17:49:47] <DV> ah , well it's unclear
-[17:50:03] <richard> the normalized value is a-tab-b, which you are correctly serializing as a&#9;b, but it is invalid
-[17:50:11] <DV> richard: okay
-[17:50:23] <DV> that should be really easy to fix
-[17:50:39] <richard> the validity check should require a single space between tokens
-[17:51:03] <DV> no leading and no trailing either
-[17:51:07] <richard> right
-[17:51:18] <DV> which makes sense
-[17:52:42] <richard> a&#32;b is valid, because it turns into a-space-b anyway without any normalization
-[17:54:31] <DV> okay that's attr2 attr2=" a&#x20;b "
-[17:54:44] * DV tends to still think in hexa
-[17:55:59] <DV> richard: and attr2="a&#x20; b" would lead to a validity error too then, if I understand correctly
-[17:56:37] <richard> attr2 is valid
-[17:57:11] <richard> the normalized value is a space b
- XInclude at the SAX level (libSRVG)
- fix the C code prototype to bring back doc/libxml-undocumented.txt
to a reasonable level
diff --git a/parser.c b/parser.c
index 998a97ad..47102708 100644
--- a/parser.c
+++ b/parser.c
@@ -2342,7 +2342,7 @@ static xmlChar * xmlParseAttValueInternal(xmlParserCtxtPtr ctxt,
*
* [5] Name ::= (Letter | '_' | ':') (NameChar)*
*
- * [6] Names ::= Name (S Name)*
+ * [6] Names ::= Name (#x20 Name)*
*
* Returns the Name parsed or NULL
*/
@@ -2467,7 +2467,7 @@ xmlParseNameComplex(xmlParserCtxtPtr ctxt) {
*
* [5] Name ::= (Letter | '_' | ':') (NameChar)*
*
- * [6] Names ::= Name (S Name)*
+ * [6] Names ::= Name (#x20 Name)*
*
* Returns the Name parsed or NULL. The @str pointer
* is updated to the current location in the string.
@@ -2547,7 +2547,7 @@ xmlParseStringName(xmlParserCtxtPtr ctxt, const xmlChar** str) {
*
* [7] Nmtoken ::= (NameChar)+
*
- * [8] Nmtokens ::= Nmtoken (S Nmtoken)*
+ * [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)*
*
* Returns the Nmtoken parsed or NULL
*/
diff --git a/result/VC/AttributeNmtokens b/result/VC/AttributeNmtokens
new file mode 100644
index 00000000..4c19285b
--- /dev/null
+++ b/result/VC/AttributeNmtokens
@@ -0,0 +1,3 @@
+./test/VC/AttributeNmtokens:6: element test: validity error : Syntax of value for attribute attr1 of test is not valid
+<test attr1=" a&#x9;b "/>
+ ^
diff --git a/test/VC/AttributeNmtokens b/test/VC/AttributeNmtokens
new file mode 100644
index 00000000..8710de48
--- /dev/null
+++ b/test/VC/AttributeNmtokens
@@ -0,0 +1,6 @@
+<!DOCTYPE test [
+ <!ELEMENT test EMPTY>
+ <!ATTLIST test attr1 NMTOKENS #IMPLIED>
+]>
+<!-- Should be invalid due to http://www.w3.org/XML/xml-V10-2e-errata#E20 -->
+<test attr1=" a&#x9;b "/>
diff --git a/test/VCM/AttributeNmtokens.xml b/test/VCM/AttributeNmtokens.xml
new file mode 100644
index 00000000..575f8113
--- /dev/null
+++ b/test/VCM/AttributeNmtokens.xml
@@ -0,0 +1,14 @@
+<!DOCTYPE doc [
+ <!ELEMENT doc (norm+)>
+ <!ELEMENT norm EMPTY>
+ <!ATTLIST norm attr NMTOKENS #IMPLIED>
+]>
+<doc>
+ <norm attr = ' foo bar
+'/>
+ <norm attr = 'foobar
+
+'/>
+ <norm attr = 'foo bar '/>
+ <norm attr = ' foo &#x20;bar'/>
+</doc>
diff --git a/valid.c b/valid.c
index f1e50079..6b2d08ec 100644
--- a/valid.c
+++ b/valid.c
@@ -3306,8 +3306,9 @@ xmlValidateNamesValue(const xmlChar *value) {
cur += len;
}
- while (IS_BLANK(val)) {
- while (IS_BLANK(val)) {
+ /* Should not test IS_BLANK(val) here -- see erratum E20*/
+ while (val == 0x20) {
+ while (val == 0x20) {
val = xmlStringCurrentChar(NULL, cur, &len);
cur += len;
}
@@ -3418,8 +3419,9 @@ xmlValidateNmtokensValue(const xmlChar *value) {
cur += len;
}
- while (IS_BLANK(val)) {
- while (IS_BLANK(val)) {
+ /* Should not test IS_BLANK(val) here -- see erratum E20*/
+ while (val == 0x20) {
+ while (val == 0x20) {
val = xmlStringCurrentChar(NULL, cur, &len);
cur += len;
}