01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.geoserver.wfs.xml.v1_1_0;
06:
07: import org.eclipse.xsd.XSDSchema;
08: import org.eclipse.xsd.util.XSDSchemaLocationResolver;
09:
10: public class WFSSchemaLocationResolver implements
11: XSDSchemaLocationResolver {
12: public String resolveSchemaLocation(XSDSchema xsdSchema,
13: String namespaceURI, String schemaLocationURI) {
14: if (schemaLocationURI == null) {
15: return null;
16: }
17:
18: //if no namespace given, assume default for the current schema
19: if (((namespaceURI == null) || "".equals(namespaceURI))
20: && (xsdSchema != null)) {
21: namespaceURI = xsdSchema.getTargetNamespace();
22: }
23:
24: if ("http://www.opengis.net/wfs".equals(namespaceURI)
25: && (schemaLocationURI != null)) {
26: if (schemaLocationURI.endsWith("wfs.xsd")) {
27: return WFSSchemaLocationResolver.class.getResource(
28: "wfs.xsd").toString();
29: }
30: }
31:
32: return null;
33: }
34: }
|