libxml2 r3776 - in trunk: . result/schemas test/schemas



Author: veillard
Date: Tue Aug 26 07:46:42 2008
New Revision: 3776
URL: http://svn.gnome.org/viewvc/libxml2?rev=3776&view=rev

Log:
* Makefile.am: add the testchar to 'make check'
* xmlschemas.c: Volker Grabsch pointed out a typo
* xmlregexp.c: production [19] from XML Schemas regexps were a
  mistake removed in version REC-xmlschema-2-20041028, Volker Grabsch
  provided a patch to remove it
* test/schemas/regexp-char-ref_0.xml test/schemas/regexp-char-ref_0.xsd
  test/schemas/regexp-char-ref_1.xsd result/schemas/regexp-char-ref_0_0
  result/schemas/regexp-char-ref_1_0: Volker Grabsch also provided
  regession tests for this
Daniel


Added:
   trunk/result/schemas/regexp-char-ref_0_0
   trunk/result/schemas/regexp-char-ref_1_0
   trunk/test/schemas/regexp-char-ref_0.xml
   trunk/test/schemas/regexp-char-ref_0.xsd
   trunk/test/schemas/regexp-char-ref_1.xsd
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/xmlregexp.c
   trunk/xmlschemas.c

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Tue Aug 26 07:46:42 2008
@@ -172,7 +172,7 @@
 #testOOM_LDADD= $(LDADDS)
 
 runtests:
-	$(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
+	$(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
 
 check: all runtests
 

Added: trunk/result/schemas/regexp-char-ref_0_0
==============================================================================
--- (empty file)
+++ trunk/result/schemas/regexp-char-ref_0_0	Tue Aug 26 07:46:42 2008
@@ -0,0 +1 @@
+./test/schemas/regexp-char-ref_0.xml validates

Added: trunk/result/schemas/regexp-char-ref_1_0
==============================================================================
--- (empty file)
+++ trunk/result/schemas/regexp-char-ref_1_0	Tue Aug 26 07:46:42 2008
@@ -0,0 +1 @@
+./test/schemas/regexp-char-ref_0.xml validates

Added: trunk/test/schemas/regexp-char-ref_0.xml
==============================================================================
--- (empty file)
+++ trunk/test/schemas/regexp-char-ref_0.xml	Tue Aug 26 07:46:42 2008
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+
+<test test1="5"
+      test2="6"
+      test3="#"
+      test4=";"
+      test5="&amp;" />

Added: trunk/test/schemas/regexp-char-ref_0.xsd
==============================================================================
--- (empty file)
+++ trunk/test/schemas/regexp-char-ref_0.xsd	Tue Aug 26 07:46:42 2008
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
+
+    <xs:element name="test">
+        <xs:complexType>
+            <xs:attribute name="test1" type="myType"/>
+            <xs:attribute name="test2" type="myType"/>
+            <xs:attribute name="test3" type="myType"/>
+            <xs:attribute name="test4" type="myType"/>
+            <xs:attribute name="test5" type="myType"/>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:simpleType name="myType">
+        <xs:restriction base="xs:string">
+            <xs:pattern value="[56;&amp;#]"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+</xs:schema>

Added: trunk/test/schemas/regexp-char-ref_1.xsd
==============================================================================
--- (empty file)
+++ trunk/test/schemas/regexp-char-ref_1.xsd	Tue Aug 26 07:46:42 2008
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
+
+    <xs:element name="test">
+        <xs:complexType>
+            <xs:attribute name="test1" type="myType"/>
+            <xs:attribute name="test2" type="myType"/>
+            <xs:attribute name="test3" type="myType"/>
+            <xs:attribute name="test4" type="myType"/>
+            <xs:attribute name="test5" type="myType"/>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:simpleType name="myType">
+        <xs:restriction base="xs:string">
+            <xs:pattern value="[&amp;#65;]"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+</xs:schema>

Modified: trunk/xmlregexp.c
==============================================================================
--- trunk/xmlregexp.c	(original)
+++ trunk/xmlregexp.c	Tue Aug 26 07:46:42 2008
@@ -4907,64 +4907,6 @@
 }
 
 /**
- * xmlFAParseCharRef:
- * @ctxt:  a regexp parser context
- *
- * [19]   XmlCharRef   ::=   ( '&#' [0-9]+ ';' ) | (' &#x' [0-9a-fA-F]+ ';' )
- */
-static int
-xmlFAParseCharRef(xmlRegParserCtxtPtr ctxt) {
-    int ret = 0, cur;
-
-    if ((CUR != '&') || (NXT(1) != '#'))
-	return(-1);
-    NEXT;
-    NEXT;
-    cur = CUR;
-    if (cur == 'x') {
-	NEXT;
-	cur = CUR;
-	if (((cur >= '0') && (cur <= '9')) ||
-	    ((cur >= 'a') && (cur <= 'f')) ||
-	    ((cur >= 'A') && (cur <= 'F'))) {
-	    while (((cur >= '0') && (cur <= '9')) ||
-	           ((cur >= 'a') && (cur <= 'f')) ||
-		   ((cur >= 'A') && (cur <= 'F'))) {
-		if ((cur >= '0') && (cur <= '9'))
-		    ret = ret * 16 + cur - '0';
-		else if ((cur >= 'a') && (cur <= 'f'))
-		    ret = ret * 16 + 10 + (cur - 'a');
-		else
-		    ret = ret * 16 + 10 + (cur - 'A');
-		NEXT;
-		cur = CUR;
-	    }
-	} else {
-	    ERROR("Char ref: expecting [0-9A-F]");
-	    return(-1);
-	}
-    } else {
-	if ((cur >= '0') && (cur <= '9')) {
-	    while ((cur >= '0') && (cur <= '9')) {
-		ret = ret * 10 + cur - '0';
-		NEXT;
-		cur = CUR;
-	    }
-	} else {
-	    ERROR("Char ref: expecting [0-9]");
-	    return(-1);
-	}
-    }
-    if (cur != ';') {
-	ERROR("Char ref: expecting ';'");
-	return(-1);
-    } else {
-	NEXT;
-    }
-    return(ret);
-}
-
-/**
  * xmlFAParseCharRange:
  * @ctxt:  a regexp parser context
  *
@@ -4985,12 +4927,6 @@
 	return;
     }
 
-    if ((CUR == '&') && (NXT(1) == '#')) {
-	end = start = xmlFAParseCharRef(ctxt);
-        xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
-	                   XML_REGEXP_CHARVAL, start, end, NULL);
-	return;
-    }
     cur = CUR;
     if (cur == '\\') {
 	NEXT;

Modified: trunk/xmlschemas.c
==============================================================================
--- trunk/xmlschemas.c	(original)
+++ trunk/xmlschemas.c	Tue Aug 26 07:46:42 2008
@@ -15092,7 +15092,7 @@
 	xmlSchemaPCustomErr(ctxt,
 	    XML_SCHEMAP_ST_PROPS_CORRECT_1,
 	    WXS_BASIC_CAST type, NULL,
-	    "A type, derived by list or union, must have"
+	    "A type, derived by list or union, must have "
 	    "the simple ur-type definition as base type, not '%s'",
 	    xmlSchemaGetComponentQName(&str, baseType));
 	FREE_AND_NULL(str)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]