[geotk] How to Get Namespaces from SLD API

johann sorel johann.sorel at geomatys.com
Fri Jun 16 02:20:01 PDT 2017


Hello Cullen,

Thank you for using GeotoolKit (and for the metadata work on SIS).

The current SLD/SE decoder (and API) do not provide the namespace/prefix 
mapping sorry.

Rather then providing a Map (or similar) on the root style objects I 
think i would be more appropriate to resolve the prefixes in the 
PropertyName value when the xml is parsed. This way the PropertyName 
would be self-sufficient.

This operation would happen in the two classes :
- org.geotoolkit.ogc.xml.OGC100toGTTransformer#visitPropertyName
- org.geotoolkit.ogc.xml.OGC110toGTTransformer#visitPropertyName

The problem is with JAXB, we need to find a way to grab the 
namespace/prefix map for the object somehow, I haven't search for a long 
time but if you found out how to do it that would make thinks easier 
(Maybe there is something more to explore with 
com.sun.xml.bind.marshaller.NamespacePrefixMapper).

In the mean time you can use the expanded form for your xpath.
example : /{http://test.com}attCpx/{http://test.com}attString


Johann




On 15/06/2017 23:38, Cullen Rombach wrote:
> Hello all,
>
> I am currently working with the Geotoolkit SLD API, and I would like 
> to know if it is possible to get the namespace context of an SLD or SE 
> document, specifically Expression and Filter elements, either in a 
> key-value map or otherwise.
>
> In instances where there is a PropertyName present, there is often an 
> XPath with a namespace prefix. I would like to be able to access the 
> associated namespace declaration so that I can resolve the XPath later on.
>
> Thank you,
> Cullen Rombach
>
> -- 
> Cullen Rombach
> Image Matters LLC
> www.imagemattersllc.com <http://www.imagemattersllc.com>
>
>
> _______________________________________________
> Geotoolkit mailing list
> Geotoolkit at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/geotoolkit

-- 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20170616/0469c7a6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature_Agro2.png
Type: image/png
Size: 46154 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/geotoolkit/attachments/20170616/0469c7a6/attachment-0001.png>


More information about the Geotoolkit mailing list