This is an automated email from the ASF dual-hosted git repository.

mukulg pushed a commit to branch xml-schema-1.1-tests
in repository https://gitbox.apache.org/repos/asf/xerces-j.git


The following commit(s) were added to refs/heads/xml-schema-1.1-tests by this 
push:
     new 11e49d59b committing test case for jira issue XERCESJ-1765
11e49d59b is described below

commit 11e49d59b6594b522d9dc44ef4d1888c472537f0
Author: Mukul Gandhi <[email protected]>
AuthorDate: Mon Jul 15 12:38:33 2024 +0530

    committing test case for jira issue XERCESJ-1765
---
 data/jira_bugs/1765.xsd                        | 23 +++++++++++++++++++++++
 data/jira_bugs/1765_1.xml                      |  5 +++++
 src/org/apache/xerces/tests/JiraBugsTests.java | 16 ++++++++++++++++
 3 files changed, 44 insertions(+)

diff --git a/data/jira_bugs/1765.xsd b/data/jira_bugs/1765.xsd
new file mode 100644
index 000000000..f34fe6972
--- /dev/null
+++ b/data/jira_bugs/1765.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
+  
+  <xs:element name="root">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element maxOccurs="unbounded" ref="event"/>
+      </xs:sequence>
+      <xs:assert test="tokenize(base-uri(.), '/')[last()] eq '1765_1.xml'"/>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="event">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element ref="id"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+  
+  <xs:element name="id" type="xs:integer"/>
+  
+</xs:schema>
diff --git a/data/jira_bugs/1765_1.xml b/data/jira_bugs/1765_1.xml
new file mode 100644
index 000000000..e8f79729a
--- /dev/null
+++ b/data/jira_bugs/1765_1.xml
@@ -0,0 +1,5 @@
+<root>
+   <event>
+         <id>1</id>
+   </event>
+</root>
\ No newline at end of file
diff --git a/src/org/apache/xerces/tests/JiraBugsTests.java 
b/src/org/apache/xerces/tests/JiraBugsTests.java
index a75b629d1..c579294c4 100644
--- a/src/org/apache/xerces/tests/JiraBugsTests.java
+++ b/src/org/apache/xerces/tests/JiraBugsTests.java
@@ -894,5 +894,21 @@ public class JiraBugsTests extends XercesAbstractTestCase {
                        assertTrue(false);
                }
        }
+       
+       public void testJira_1765_1() {
+               String xmlfile = fDataDir+"/jira_bugs/1765_1.xml";
+               String schemapath = fDataDir+"/jira_bugs/1765.xsd";             
+               try {
+                       Schema s = fSchemaFactory.newSchema(new 
File(schemapath));
+            Validator v = s.newValidator();
+                   v.setErrorHandler(this);
+            v.validate(new StreamSource(xmlfile));
+            assertNull(fErrSysId);
+            assertNull(fFatErrSysId);
+               } catch(Exception ex) {
+                       ex.printStackTrace();
+                       assertTrue(false);
+               }
+       }
                
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to