/** * Returns the locations of all schema files that contributed to the given namespace. * * @param namespace * namespace, must not be <code>null</code> * @return the locations of the schema files, or <code>null</code> if the namespace does not belong to the schema */ public List<String> getComponentLocations( String namespace ) { return getNSMap().get( namespace ); }
public XSTypeDefinition getTypeDef( String localName, String namespace ) { return getTypeDef( new QName( namespace, localName ) ); }
/** * Creates a new {@link XMLSchemaInfoSet} instance that reads the schema documents from the given URLs. * * @param schemaUrls * locations of the schema documents, must not be <code>null</code> and contain at least one entry * @throws ClassCastException * @throws ClassNotFoundException * @throws InstantiationException * @throws IllegalAccessException */ public XMLSchemaInfoSet( String... schemaUrls ) throws ClassCastException, ClassNotFoundException, InstantiationException, IllegalAccessException { xsModel = loadModel( schemaUrls ); init(); }
if ( nsToPrefix == null ) { nsToPrefix = new HashMap<String, String>(); for ( String ns : getSchemaNamespaces() ) { for ( String componentLocation : getComponentLocations( ns ) ) { InputStream is = null; try {
/** * Determines the GML version of the given {@link XMLSchemaInfoSet} heuristically. * * @param xmlSchemaInfoSet * XML schema, must not be <code>null</code> * @return gml version, never <code>null</code> * @throws IllegalArgumentException * if the GML version cannot be determined */ public static GMLVersion determineGMLVersion( XMLSchemaInfoSet xmlSchemaInfoSet ) throws IllegalArgumentException { GMLVersion gmlVersion = GML_32; Set<String> namespaces = xmlSchemaInfoSet.getSchemaNamespaces(); if ( namespaces.contains( GML_32_NS ) ) { LOG.debug( "Schema must be GML 3.2 (found GML 3.2 namespace)" ); } else if ( !namespaces.contains( GMLNS ) ) { String msg = "Cannot interpret XML schema as GML schema. " + "Neither GML core schema components in GML 3.2 namespace (" + GML3_2_NS + "), nor in " + "pre-GML 3.2 namespace (" + GMLNS + ") are present."; throw new IllegalArgumentException( msg ); } else { gmlVersion = GML_31; LOG.debug( "Automatic differentiation between GML 3.1, 3.0 and 2 is not implemented (same namespace URLs)." ); } return gmlVersion; }
/** * Creates a new <code>XSModelAnalyzer</code> for the given (Xerces) XML schema infoset. * * @param xmlSchema * schema infoset, must not be <code>null</code> */ public XMLSchemaInfoSet( XSModel xmlSchema ) { this.xsModel = xmlSchema; init(); }
public XSElementDeclaration getElementDecl( String localName, String namespace ) { return getElementDecl( new QName( namespace, localName ) ); }
/** * Returns the declarations of all elements that are substitutable for a given element name. * * @param elementName * qualified name of the element, must not be <code>null</code> * @param namespace * only element declarations in this namespace are returned, set to <code>null</code> for all namespaces * @param transitive * if true, also substitutions for substitutions (and so one) are included * @param onlyConcrete * if true, only concrete (non-abstract) declarations are returned * @return the declarations of all substitution elements in the requested namespace */ public List<XSElementDeclaration> getSubstitutions( QName elementName, String namespace, boolean transitive, boolean onlyConcrete ) { XSElementDeclaration elementDecl = nameToElDecl.get( elementName ); if ( elementDecl == null ) { String msg = "The schema does not declare a top-level element with name '" + elementName + "'."; throw new IllegalArgumentException( msg ); } return getSubstitutions( elementDecl, namespace, transitive, onlyConcrete ); }
/** * Creates a new {@link XMLSchemaInfoSet} instance that reads the schema documents from the given inputs. * * @param inputs * schema documents, must not be <code>null</code> and contain at least one entry * @throws ClassCastException * @throws ClassNotFoundException * @throws InstantiationException * @throws IllegalAccessException */ public XMLSchemaInfoSet( LSInput... inputs ) throws ClassCastException, ClassNotFoundException, InstantiationException, IllegalAccessException { xsModel = loadModel( inputs ); init(); }
/** * Returns all namespaces that participate in this infoset. * * @return all namespaces, never <code>null</code> */ public Set<String> getSchemaNamespaces() { return getNSMap().keySet(); }