Author: mukulg
Date: Fri Feb 15 00:37:37 2013
New Revision: 1446414

URL: http://svn.apache.org/r1446414
Log:
commiting fix for jira issue XERCESJ-1605. commiting few related test cases as 
well.

Added:
    xerces/java/branches/xs-1.1-tests/data/jira_bugs/1603_1.xsd
    xerces/java/branches/xs-1.1-tests/data/jira_bugs/1605_1.xsd
Modified:
    
xerces/java/branches/xs-1.1-tests/src/org/apache/xerces/tests/JiraBugsTests.java

Added: xerces/java/branches/xs-1.1-tests/data/jira_bugs/1603_1.xsd
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/jira_bugs/1603_1.xsd?rev=1446414&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/jira_bugs/1603_1.xsd (added)
+++ xerces/java/branches/xs-1.1-tests/data/jira_bugs/1603_1.xsd Fri Feb 15 
00:37:37 2013
@@ -0,0 +1,21 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
elementFormDefault="qualified">
+    <xs:defaultOpenContent mode="interleave">
+        <xs:any namespace="##targetNamespace"/>
+    </xs:defaultOpenContent>
+    <xs:complexType name="mainCT">
+        <xs:all>
+            <xs:element name="elemA" type="mainCT"/>
+        </xs:all>
+    </xs:complexType>
+    <xs:complexType name="bCT">
+        <xs:complexContent>
+            <xs:extension base="mainCT">
+                <xs:openContent mode="interleave">
+                </xs:openContent>
+                <xs:all>
+                    <xs:element name="elemB"/>
+                </xs:all>
+            </xs:extension>
+        </xs:complexContent>
+    </xs:complexType>
+</xs:schema>
\ No newline at end of file

Added: xerces/java/branches/xs-1.1-tests/data/jira_bugs/1605_1.xsd
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xs-1.1-tests/data/jira_bugs/1605_1.xsd?rev=1446414&view=auto
==============================================================================
--- xerces/java/branches/xs-1.1-tests/data/jira_bugs/1605_1.xsd (added)
+++ xerces/java/branches/xs-1.1-tests/data/jira_bugs/1605_1.xsd Fri Feb 15 
00:37:37 2013
@@ -0,0 +1,26 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
+
+    <xsd:complexType name="type1">
+        <xsd:choice>
+            <xsd:sequence>
+                <xsd:element name="Element1">
+                    <xsd:alternative test="@index='3'" type="TypeI3"/>
+                    <xsd:alternative type="TypeI5"/>
+                </xsd:element>
+            </xsd:sequence>
+            <xsd:sequence>
+                <xsd:element name="Element1">
+                    <xsd:alternative test="@index='3'" type="TypeI3"/>
+                    <xsd:alternative type="TypeI5"/>
+                    <xsd:unique name="TypeI5_U">
+                        <xsd:selector xpath="*"/>
+                        <xsd:field xpath="@index"/>
+                    </xsd:unique>
+                </xsd:element>
+            </xsd:sequence>
+        </xsd:choice>
+    </xsd:complexType>
+    <xsd:complexType name="TypeI3"/>
+    <xsd:complexType name="TypeI5"/>
+       
+</xsd: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=1446414&r1=1446413&r2=1446414&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
 Fri Feb 15 00:37:37 2013
@@ -25,6 +25,8 @@ import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.Validator;
 
+import org.xml.sax.SAXException;
+
 /**
  * @xerces.internal
  * 
@@ -348,5 +350,25 @@ public class JiraBugsTests extends Xerce
                   assertTrue(false);
                }
        }
+       
+       public void testJira_1603() {
+               String schemapath = fDataDir+"/jira_bugs/1603_1.xsd";   
+               try {
+                   Schema s = fSchemaFactory.newSchema(new 
StreamSource(schemapath));
+               } catch(SAXException ex) {
+                       // test expected error messages
+                       assertEquals("src-ct.5: Complex Type Definition 
Representation Error for type 'bCT'. If <openContent> is present and the actual 
value of its mode [attribute] is not none, then there must be an <any> among 
the [children] of <openContent>.", ex.getMessage());
+               }
+       }
+       
+       public void testJira_1605() {
+               String schemapath = fDataDir+"/jira_bugs/1605_1.xsd";   
+               try {
+                   Schema s = fSchemaFactory.newSchema(new 
StreamSource(schemapath));
+               } catch(SAXException ex) {
+                       // test expected error messages
+            assertEquals("cos-nonambig: Element1 and Element1 (or elements 
from their substitution group) violate \"Unique Particle Attribution\". During 
validation against this schema, ambiguity would be created for those two 
particles.", ex.getMessage());
+               }
+       }
                
 }



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

Reply via email to