You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2021/11/27 07:42:22 UTC

svn commit: r1895367 - in /xerces/java/branches: xml-schema-1.1-dev/tools/ xs-1.1-tests/data/jira_bugs/ xs-1.1-tests/src/org/apache/xerces/tests/

Author: mukulg
Date: Sat Nov 27 07:42:22 2021
New Revision: 1895367

URL: http://svn.apache.org/viewvc?rev=1895367&view=rev
Log:
few improvements to implementation of jira issue XERCESJ-1732. adding few related test cases as well.

Added:
    xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_matches.xml
    xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_matches.xsd
    xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_replace.xml
    xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_replace.xsd
    xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_tokenize.xml
    xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_tokenize.xsd
Modified:
    xerces/java/branches/xml-schema-1.1-dev/tools/org.eclipse.wst.xml.xpath2.processor_1.2.1.jar
    xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java

Modified: xerces/java/branches/xml-schema-1.1-dev/tools/org.eclipse.wst.xml.xpath2.processor_1.2.1.jar
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/tools/org.eclipse.wst.xml.xpath2.processor_1.2.1.jar?rev=1895367&r1=1895366&r2=1895367&view=diff
==============================================================================
Binary files - no diff available.

Added: xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_matches.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_matches.xml?rev=1895367&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_matches.xml (added)
+++ xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_matches.xml Sat Nov 27 07:42:22 2021
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<X>
+  <a>123-456-789</a>
+  <a>Abc-PQR-mno</a>
+</X>
\ No newline at end of file

Added: xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_matches.xsd
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_matches.xsd?rev=1895367&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_matches.xsd (added)
+++ xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_matches.xsd Sat Nov 27 07:42:22 2021
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+    <xs:element name="X">
+       <xs:complexType>
+          <xs:sequence>
+             <xs:element name="a" type="xs:string" maxOccurs="unbounded"/>
+          </xs:sequence>
+          <xs:assert test="matches(a[1], '[0-9]{3}-[0-9]{3}-[0-9]{3}')"/>
+          <xs:assert test="matches(a[1], '[0-9]{3}
+                                             -
+                                          [0-9]{3}
+                                             -
+                                          [0-9]{3}', 'x')"/>
+          <xs:assert test="matches(a[2], '[a-z]{3}-[a-z]{3}-[a-z]{3}', 'i')"/>
+          <xs:assert test="matches(a[2], '[a-z]{3}
+                                             -
+                                          [a-z]{3}
+                                             -
+                                          [a-z]{3}', 'xi')"/>
+       </xs:complexType>
+    </xs:element>
+
+</xs:schema>
\ No newline at end of file

Added: xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_replace.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_replace.xml?rev=1895367&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_replace.xml (added)
+++ xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_replace.xml Sat Nov 27 07:42:22 2021
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<X>
+  <a>123 - 456 - 789</a>
+  <a>Abc - PQR - mno</a>
+</X>
\ No newline at end of file

Added: xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_replace.xsd
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_replace.xsd?rev=1895367&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_replace.xsd (added)
+++ xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_replace.xsd Sat Nov 27 07:42:22 2021
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+    <xs:element name="X">
+       <xs:complexType>
+          <xs:sequence>
+             <xs:element name="a" type="xs:string" maxOccurs="unbounded"/>
+          </xs:sequence>
+          <xs:assert test="replace(a[1], '\s*-\s*', '#') = '123#456#789'"/>
+          <xs:assert test="replace(a[1], '\s*
+                                          -
+                                          \s*', '#', 'x') = '123#456#789'"/>
+          <xs:assert test="lower-case(replace(a[2], '\s*-\s*', '#')) = 'abc#pqr#mno'"/>
+          <xs:assert test="lower-case(replace(a[2], '\s*
+                                                     -
+                                                     \s*', '#', 'x')) = 'abc#pqr#mno'"/>
+       </xs:complexType>
+    </xs:element>
+
+</xs:schema>
\ No newline at end of file

Added: xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_tokenize.xml
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_tokenize.xml?rev=1895367&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_tokenize.xml (added)
+++ xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_tokenize.xml Sat Nov 27 07:42:22 2021
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<X/>
\ No newline at end of file

Added: xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_tokenize.xsd
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_tokenize.xsd?rev=1895367&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_tokenize.xsd (added)
+++ xerces/java/branches/xs-1.1-tests/data/jira_bugs/1732_fn_tokenize.xsd Sat Nov 27 07:42:22 2021
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+    <xs:element name="X">
+       <xs:complexType>
+          <xs:assert test="deep-equal(tokenize('abracadabra', '(ab)|(a)'), ('', 'r', 'c', 'd', 'r', ''))"/>
+          <xs:assert test="deep-equal(tokenize('abracadabra', '(ab)|
+                                                                (a)', 'x'), ('', 'r', 'c', 'd', 'r', ''))"/>
+          <xs:assert test="deep-equal(tokenize('abracadabra', '(Ab)|
+                                                                (A)', 'xi'), ('', 'r', 'c', 'd', 'r', ''))"/>                                                                                                                                          
+          <xs:assert test="deep-equal(tokenize('The cat sat on the mat', '\s+'), ('The', 'cat', 'sat', 'on', 'the', 'mat'))"/>
+          <xs:assert test="deep-equal(tokenize('1, 15, 24, 50', ',\s*'), ('1', '15', '24', '50'))"/>
+          <xs:assert test="deep-equal(tokenize('1,15,,24,50,', ','), ('1','15','','24','50',''))"/>          
+          <xs:assert test="deep-equal(tokenize('Some unparsed &lt;br&gt; HTML &lt;BR&gt; text', '\s*&lt;br&gt;\s*', 'i'), ('Some unparsed', 'HTML', 'text'))"/>
+       </xs:complexType>
+    </xs:element>
+
+</xs:schema>
\ No newline at end of file

Modified: xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java?rev=1895367&r1=1895366&r2=1895367&view=diff
==============================================================================
--- xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java (original)
+++ xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java Sat Nov 27 07:42:22 2021
@@ -523,5 +523,53 @@ public class JiraBugsTests extends Xerce
            assertEquals("src-attribute.5: The property 'fixed' is present in attribute 'att1', so the value of 'use' must not be 'prohibited'.", ex.getMessage());
 		}
 	}
+	
+	public void testJira_1732_1() {
+		String xmlfile = fDataDir+"/jira_bugs/1732_fn_matches.xml";
+		String schemapath = fDataDir+"/jira_bugs/1732_fn_matches.xsd";		
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1732_2() {
+		String xmlfile = fDataDir+"/jira_bugs/1732_fn_replace.xml";
+		String schemapath = fDataDir+"/jira_bugs/1732_fn_replace.xsd";		
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
+	
+	public void testJira_1732_3() {
+		String xmlfile = fDataDir+"/jira_bugs/1732_fn_tokenize.xml";
+		String schemapath = fDataDir+"/jira_bugs/1732_fn_tokenize.xsd";		
+		try {
+		    Schema s = fSchemaFactory.newSchema(new StreamSource(schemapath));
+            Validator v = s.newValidator();
+		    v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+		} catch(Exception ex) {
+		   ex.printStackTrace();
+		   assertTrue(false);
+		}
+	}
 		
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org