This class should is subclasses for the xs, gml, filter, sld, etc... schemas. Subclasses should be implemented as singletons.
262263264265266267268269270271272273
root.setAttribute("xmlns:" + prefix, uri ); } //process the schemaLocation, replace any schema locations that we know about if (root.hasAttribute("xsi:schemaLocation")) { XSD xsd = config.getXSD(); List<XSD> deps = xsd.getAllDependencies(); deps.add(xsd); String[] locations = root.getAttribute("xsi:schemaLocation").split(" +"); for (int i = 0; i < locations.length; i += 2) { String uri = locations[i];
412413414415416417418419420421422423
NamespaceSupport namespaces = new NamespaceSupport(); HashMap mappings = new HashMap(); try { for (Iterator d = configuration.getXSD().getDependencies().iterator(); d.hasNext();) { XSD xsd = (XSD) d.next(); XSDSchema schema = xsd.getSchema(); mappings.putAll(schema.getQNamePrefixToNamespaceMap()); } mappings.putAll(configuration.getXSD().getSchema().getQNamePrefixToNamespaceMap());
284285286287288289290291292293294295296297298299300
public XSDSchema locateSchema(XSDSchema schema, String namespaceURI, String rawSchemaLocationURI, String resolvedSchemaLocationURI) { for ( Iterator x = xsds.iterator(); x.hasNext(); ) { XSD xsd = (XSD) x.next(); if ( xsd == null ) { continue; } if ( xsd.getNamespaceURI().equals( namespaceURI ) ) { try { return xsd.getSchema(); } catch (IOException e) { getLog().warn("Error occured locating schema: " + namespaceURI, e); } }
422423424425426427428429430431432
final QName featureName = new QName(typeName.getNamespaceURI(), typeName.getLocalPart()); String namespaceURI = featureName.getNamespaceURI(); String uri = schemaLocation.toExternalForm(); XSD xsd = new org.geotools.gml2.ApplicationSchemaXSD(namespaceURI, uri); Configuration configuration = new Configuration(xsd) { { addDependency(new XSConfiguration()); addDependency(gmlConfiguration); // use our GML configuration }