Good afternoon ben:

> I am trying to encode XML attributes on arbitrary ComplexAttribute
> instances. In GeoServer 1.6.x / GeoTools 2.4.x community-schemas this
> was done by smuggling attributes in a UserData map.

Yep.

> In org.geotools.xml.Encoder a GetPropertyExecutor is used to get XML
> attributes, which suggest the possibility of passing XML attributes
> directly as GeoAPI properties.
>
> What is the preferred way to pass XML attributes in GeoAPI
> ComplexAttribute instances?

I would list them as a normal attribute; they happen to be limited to
simple content but that is neither here nor there.

> (A) Store them in the UserData, and unpack them in bindings for processing by 
> the Encoder.

If they are formally part of your schema (ie data model) then they
should be handled and documented as formal attribtues of your feature.

> (B) Store them directly as GeoAPI properties for processing by the Encoder.

I would choose this one.

> (B) seems cleaner at first, but as I deeper into implementing it, I
> encounter problems.

Yeah feedback.

> Every attribute must be added to the GeoAPI type
> schema as a fake property. So rather than removing hacks, they have been
> swept under a different carpet.

I do not think they are a fake property; but are a real property. I am
not sure I see where the problem is occurring...

> Which is the preferred way of using GeoAPI to transport XML attributes?

The geoapi feature model should be generated from your xml schema; and
should capture all the attributes defined; as well as if they are
required or not (multiplicity 0:1 or 1:1).  From the programming point
of view they should be handled as is (ie as a GeoAPI
attributedescriptor; referring to an AttributeType).

The bindings will make use of the original xsd schema to figure out
how to encode/decode this content. How you want to handle this is kind
of up to you; when encoding and decoding you should have access to the
origional xsd schema as a data structure; using this you can decide to
encode a specific geoapi attribute as an xml attribute or xml element.
Since you also control the process of making the geoapit attribute
descriptors from the origional xsd you could store a hint about which
descriptors are encoded as attributes or not (and avoid looking this
up all the time) - but this would be an optimization only.

Jody

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to