1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-02-04 01:47:02 +03:00

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
This commit is contained in:
Daniel Veillard 2004-09-26 14:42:56 +00:00
parent a918b5b08a
commit 807b4de282
7 changed files with 40 additions and 56 deletions

View File

@ -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>

49
TODO
View File

@ -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

View File

@ -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
*/

View File

@ -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 "/>
^

View File

@ -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 "/>

View File

@ -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>

10
valid.c
View File

@ -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;
}