Alessandro,

using relative schema URLs is problematic because they have to be passed 
to the underlying EMF infrastructure, and relative URLs have no 
protocol, and so make no sense in the absence of a context. There is an 
ugly hack that allows relative file: URLs for mapping file paths to be 
used in your data store configuration file, but these are invalid URLs 
because relative URLs have no protocol. No such hack is available for 
schemaUri. Furthermore, relative imports in popular schemas cause chaos 
(OGC schemas that import ../../../something) unless all your schemas are 
mirrored in the same place.

This is where the app-schema-resolver comes in:
http://docs.geoserver.org/latest/en/user/data/app-schema/app-schema-resolution.html

We use unpublished schemas very often. The easiest option for an 
unpublished schema is to assign it a pretend URL:

http://my.schemas.example.org/xsd/myschema.xsd

Then place it in the app-schema-cache at the expected location. Once 
found, it will be used an never overwritten, and the made-up URL will 
never be accessed. The cache location is in your data directory:

$GEOSERVER_DATA_DIR/app-schema-cache/org/example/schemas/my/xsd/myschema.xsd

You can also use an OASIS Catalog, but the schema cache is easier. A 
catalog looks like this (you can have many rewriteURI entries):

<?xml version="1.0"?>
<!DOCTYPE catalog PUBLIC
"-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd";>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI uriStartString="http://my.schemas.example.org/xsd/"; 
rewritePrefix="path/relative/to/catalog/" />
</catalog>

If you use an OASIS Catalog, it must be configured in the mapping file.
http://docs.geoserver.org/latest/en/user/data/app-schema/mapping-file.html#catalog-optional

The resolver will also read schemas off the classpath, for example

WEB-INF/classes/org/example/schemas/my/xsd/myschema.xsd

which is rather handy for unit testing with schemas in jar files, but 
not so good for production as it will get removed every time GeoServer 
is redeployed. If you are rewriting your web.xml to set 
GEOSERVER_DATA_DIR in your post-deployment procedure, you can install a 
schema as well. But there is no advantage over the app-schema-cache 
method, which is just as easy and keeps your schemas in your data 
directory where they belong.

Kind regards,
Ben.

On 21/08/12 03:14, alessandro marrone wrote:
> Hello
> The .xsd file that I'm using in schemaUri's tag is local to the server,
> so I need to specify a relative path.
> At the moment, it works just if I use an absolute path like this:
>
> <FeatureType>
>      <schemaUri>  file:C:/Users/Alessandro/.opengeo/data_dir/workspaces/
> ....  </schemaUri>
> </FeatureType>
>
>
> Can you tell me the correct way to specify a relatvie path?

-- 
Ben Caradoc-Davies <[email protected]>
Software Engineer
CSIRO Earth Science and Resource Engineering
Australian Resources Research Centre



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to