You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by nd...@apache.org on 2006/03/04 23:20:48 UTC
svn commit: r383214 - in /xerces/java/trunk:
src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
tests/schema/annotations/XSModelGroupAnnotationsTest.java
tests/schema/annotations/XSModelGroupTest01.xsd
Author: nddelima
Date: Sat Mar 4 14:20:48 2006
New Revision: 383214
URL: http://svn.apache.org/viewcvs?rev=383214&view=rev
Log:
Fix for a ModelGroup getAnnotation/getAnnotations bug when traversing ComplexTypes with ComplexContents.
Modified:
xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
xerces/java/trunk/tests/schema/annotations/XSModelGroupAnnotationsTest.java
xerces/java/trunk/tests/schema/annotations/XSModelGroupTest01.xsd
Modified: xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java?rev=383214&r1=383213&r2=383214&view=diff
==============================================================================
--- xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java (original)
+++ xerces/java/trunk/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java Sat Mar 4 14:20:48 2006
@@ -870,10 +870,12 @@
group.fParticles = new XSParticleDecl[2];
group.fParticles[0] = (XSParticleDecl)baseType.getParticle();
group.fParticles[1] = fParticle;
+ group.fAnnotations = XSObjectListImpl.EMPTY_LIST;
// the particle to contain the above sequence
XSParticleDecl particle = new XSParticleDecl();
particle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
particle.fValue = group;
+ particle.fAnnotations = fParticle.getAnnotations();
fParticle = particle;
}
@@ -1029,9 +1031,11 @@
group.fCompositor = XSModelGroupImpl.MODELGROUP_SEQUENCE;
group.fParticleCount = 0;
group.fParticles = null;
+ group.fAnnotations = XSObjectListImpl.EMPTY_LIST;
fEmptyParticle = new XSParticleDecl();
fEmptyParticle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
fEmptyParticle.fValue = group;
+ fEmptyParticle.fAnnotations = XSObjectListImpl.EMPTY_LIST;
}
particle = fEmptyParticle;
}
Modified: xerces/java/trunk/tests/schema/annotations/XSModelGroupAnnotationsTest.java
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/XSModelGroupAnnotationsTest.java?rev=383214&r1=383213&r2=383214&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/XSModelGroupAnnotationsTest.java (original)
+++ xerces/java/trunk/tests/schema/annotations/XSModelGroupAnnotationsTest.java Sat Mar 4 14:20:48 2006
@@ -487,6 +487,38 @@
group9AnnotationTest(Boolean.TRUE);
}
+ public void testGroup10Annotation() {
+ String expected = trim("<annotation "
+ + "xmlns=\"http://www.w3.org/2001/XMLSchema\" "
+ + "xmlns:sv=\"XSModelGroup\" xmlns:sn=\"SyntheticAnnotation\" > "
+ + "</annotation>");
+
+ XSModel model = fSchemaLoader
+ .loadURI(getResourceURL("XSModelGroupTest01.xsd"));
+
+ XSComplexTypeDefinition type = (XSComplexTypeDefinition) model
+ .getTypeDefinition("CT4", "XSModelGroup");
+ XSModelGroup modelGroup = (XSModelGroup) type.getParticle().getTerm();
+
+ XSAnnotation annotation = modelGroup.getAnnotation();
+ XSObjectList annotations = modelGroup.getAnnotations();
+ assertNull("TEST10_NO_ANNOTATIONS_CT4", annotation);
+ assertEquals("TEST10_NO_ANNOTATIONS_CT4", annotations.getLength(), 0);
+
+ type = (XSComplexTypeDefinition) model.getTypeDefinition("CT5",
+ "XSModelGroup");
+ annotation = modelGroup.getAnnotation();
+ annotations = modelGroup.getAnnotations();
+ assertNull("TEST10_NO_ANNOTATIONS_CT5", annotation);
+ assertEquals("TEST10_NO_ANNOTATIONS_CT5", annotations.getLength(), 0);
+
+ XSParticle part = (XSParticle) type.getParticle();
+ assertEquals("TEST10_NO_ANNOTATIONS_CT5", expected,
+ trim(((XSAnnotation) part.getAnnotations().item(0))
+ .getAnnotationString()));
+ }
+
+
public static void main(String args[]) {
junit.textui.TestRunner.run(XSModelGroupAnnotationsTest.class);
}
Modified: xerces/java/trunk/tests/schema/annotations/XSModelGroupTest01.xsd
URL: http://svn.apache.org/viewcvs/xerces/java/trunk/tests/schema/annotations/XSModelGroupTest01.xsd?rev=383214&r1=383213&r2=383214&view=diff
==============================================================================
--- xerces/java/trunk/tests/schema/annotations/XSModelGroupTest01.xsd (original)
+++ xerces/java/trunk/tests/schema/annotations/XSModelGroupTest01.xsd Sat Mar 4 14:20:48 2006
@@ -73,4 +73,20 @@
</choice>
</complexType>
+ <complexType name='CT4'>
+ <sequence>
+ <element name='el1' type='string' />
+ </sequence>
+ </complexType>
+ <complexType name='CT5'>
+ <complexContent>
+ <extension base='sv:CT4'>
+ <sequence>
+ <annotation/>
+ <element name='el2' type='string' />
+ </sequence>
+ </extension>
+ </complexContent>
+ </complexType>
+
</schema>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org