On Tue, Mar 3, 2015 at 11:24 PM, Andrea Aime <andrea.a...@geo-solutions.it>
wrote:

> On Wed, Mar 4, 2015 at 1:09 AM, Torben Barsballe <
> tbarsba...@boundlessgeo.com> wrote:
>
>>
>> Note that for GML 3 the elements inherit the namespaces of the parent
>> XML. I am not sure if this is desired?
>>
>
> Probably not... but is it ok to have non namespaced elements?
> Also, can't the document we're publishing have namespaces of its own?
>
>

In theory, there should be no problem with non-namespaced elements. GML2
handles it just fine.
And yes, the document we are publishing should be able to define its own
namespace (although I haven't tested if this works yet).

Digging more into how GML3 handles namespaces, I have hit a bit of a snag.
In the GML3 encoder, if we don't declare a namespace for an element, then
it applies the default namespace - see here
<https://github.com/geotools/geotools/blob/master/modules/extension/xsd/xsd-core/src/main/java/org/geotools/xml/Encoder.java#L1189>
.

I could change this behaviour by:

   - Changing the encoder to not set a default namespace if no namespace is
   declared
   - Change the forceQualified check to return false if
   XSDElementDeclaration is null:

    boolean forceQualified(XSDElementDeclaration e) {
        return namespaceAware && (e == null || e.isGlobal() ||
e.getSchema() == null ||
                e.getSchema().getElementFormDefault() ==
XSDForm.QUALIFIED_LITERAL);
    }

I feel like either of these changes could have far-reaching effects, and I
still don't know the XML/GML encoder well enough to determine if this
change is viable, and which would be the better option.

Any input would be appreciated.

Thanks,

Torben
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to