protected void process ( XSDSchema schema , String encoding , long contentSize , Node rootNode ) throws Exception { assert schema != null ; logger . debug ( "Target namespace: '{0}'" , schema . getTargetNamespace ( ) ) ; rootNode . setProperty ( SrampLexicon . CONTENT_TYPE , MimeTypeConstants . APPLICATION_XML ) ; if ( encoding != null ) { rootNode . setProperty ( SrampLexicon . CONTENT_ENCODING , encoding ) ; } rootNode . setProperty ( SrampLexicon . CONTENT_SIZE , contentSize ) ; // Parse the annotations first to aggregate them all into a single 'sramp:description' property ... @ SuppressWarnings ( "unchecked" ) List < XSDAnnotation > annotations = schema . getAnnotations ( ) ; processAnnotations ( annotations , rootNode ) ; processNonSchemaAttributes ( schema , rootNode , Collections . < String > emptySet ( ) ) ; // Parse the objects ... for ( EObject obj : schema . eContents ( ) ) { if ( obj instanceof XSDSimpleTypeDefinition ) { processSimpleTypeDefinition ( ( XSDSimpleTypeDefinition ) obj , rootNode ) ; } else if ( obj instanceof XSDComplexTypeDefinition ) { processComplexTypeDefinition ( ( XSDComplexTypeDefinition ) obj , rootNode ) ; } else if ( obj instanceof XSDElementDeclaration ) { processElementDeclaration ( ( XSDElementDeclaration ) obj , rootNode ) ; } else if ( obj instanceof XSDAttributeDeclaration ) { processAttributeDeclaration ( ( XSDAttributeDeclaration ) obj , rootNode , false ) ; } else if ( obj instanceof XSDImport ) { processImport ( ( XSDImport ) obj , rootNode ) ; } else if ( obj instanceof XSDInclude ) { processInclude ( ( XSDInclude ) obj , rootNode ) ; } else if ( obj instanceof XSDRedefine ) { processRedefine ( ( XSDRedefine ) obj , rootNode ) ; } else if ( obj instanceof XSDAttributeGroupDefinition ) { processAttributeGroupDefinition ( ( XSDAttributeGroupDefinition ) obj , rootNode ) ; } else if ( obj instanceof XSDAnnotation ) { // already processed above ... } } // Resolve any outstanding, unresolved references ... resolveReferences ( ) ; }
Read an XSDSchema instance and create the node hierarchy under the given root node .