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_0_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: if (schemaLocationURI.endsWith("WFS-basic.xsd")) {
26: return getClass().getResource("WFS-basic.xsd")
27: .toString();
28: }
29:
30: if (schemaLocationURI.endsWith("WFS-transaction.xsd")) {
31: return getClass().getResource("WFS-transaction.xsd")
32: .toString();
33: }
34: }
35:
36: return null;
37: }
38: }
|