public void testSchemaParsing() throws Exception
{
final XmlDocumentSchema schema = XmlDocumentSchemasCache.getSchema( NAMESPACE );
final XmlElementDefinition workbookElementDef = schema.getElement( "workbook" );
final XmlSequenceGroup workbookContentModel = (XmlSequenceGroup) workbookElementDef.getContentModel();
final List<XmlContentModel> workbookNestedContent = workbookContentModel.getNestedContent();
assertEquals( 1, workbookNestedContent.size() );
final XmlContentModelReference shapesGroupRef = (XmlContentModelReference) workbookNestedContent.get( 0 );
final XmlGroupContentModel shapesGroup = (XmlGroupContentModel) shapesGroupRef.getContentModel();
final List<XmlContentModel> shapesGroupNestedContent = shapesGroup.getNestedContent();
assertEquals( 2, shapesGroupNestedContent.size() );
final XmlElementDefinition circleElementDef = (XmlElementDefinition) shapesGroupNestedContent.get( 0 );
final XmlSequenceGroup circleContentModel = (XmlSequenceGroup) circleElementDef.getContentModel();
final List<XmlContentModel> circleNestedContent = circleContentModel.getNestedContent();
assertEquals( "circle", circleElementDef.getName().getLocalPart() );
assertEquals( 3, circleNestedContent.size() );
assertEquals( "x", ( (XmlElementDefinition) circleNestedContent.get( 0 ) ).getName().getLocalPart() );
assertEquals( "y", ( (XmlElementDefinition) circleNestedContent.get( 1 ) ).getName().getLocalPart() );
assertEquals( "radius", ( (XmlElementDefinition) circleNestedContent.get( 2 ) ).getName().getLocalPart() );
final XmlElementDefinition rectangleElementDef = (XmlElementDefinition) shapesGroupNestedContent.get( 1 );
final XmlSequenceGroup rectangleContentModel = (XmlSequenceGroup) rectangleElementDef.getContentModel();
final List<XmlContentModel> rectangleNestedContent = rectangleContentModel.getNestedContent();
assertEquals( "rectangle", rectangleElementDef.getName().getLocalPart() );
assertEquals( 4, rectangleNestedContent.size() );
assertEquals( "x", ( (XmlElementDefinition) rectangleNestedContent.get( 0 ) ).getName().getLocalPart() );
assertEquals( "y", ( (XmlElementDefinition) rectangleNestedContent.get( 1 ) ).getName().getLocalPart() );