Gabriel Roldán wrote: > gml:name were only an example > > I think the thing is more of gtxml not handling attributes for any type with > a > simple content model. > > The option, creating custom bindings for every type in an application schema > seems just unacceptable.
This in general is kind of tough. The parser / encoder is kind of built on the design that individual types will be bound to. I agree that this is a pain for application schemas and we would like to support encoding / parsing out of the box without fiddling with bindings. But I am not sure how to handle this cleanly. I mean gml:name for instance is an extension of string, so should the binding for string have to worry about encoding attributes defined in an extension... not too sure about that. > > So I meant if gtxml shouldnt have a way to treat xml attributes for complex > types with simple content models (aka, simple types + attributes), or if it > does, how? Maybe I am misunderstanding the issue. But right now complex types with simple content models map to a complex binding. So if a binding is registered this should be handled as normal. > > hope I'm explaining it well.. > > Gabriel > > On Wednesday 09 May 2007 16:56, Justin Deoliveira wrote: >> Hi Gabriel, >> >> My original message was a bit off. After looking into this some more it >> seems that "gml:name" is a "CodeType", which is indeed a complex type >> which extends a simple type. However there is no binding directly to >> gml:name or to "gml:CodeType", so the "xs:string" binding si the first >> one to execute. >> >> So if you register a binding for the "CodeType" type, you should get >> what you need as its a ComplexBinding. >> >> -Justin >> >> Gabriel Roldán wrote: >>> Hi Justin, >>> >>> Working on gtxml encoding and now parsing I guess I've found a design >>> limitation, though it can well be a limitation on my brain. >>> >>> Problem is I'm not being able of encoding non complex (in the nesting >>> sense) elements with xml attributes. >>> >>> Say I have to encode gml:name but it needs the codeSpace attribute: >>> >>> <gml:name codeSpace="myuri">value</gml:name> >>> >>> This kind of encodings are generally made through a SimpleBinding, >>> which, by one side, have no getProperty() method which could be used to >>> retrieve the attribute values, and by the other side, >>> SimpleBinding.encode() is expected to return an String and does not >>> recieves the Element it is going to be encoded at, so it is not possible >>> to set the attributes in the encode() implementation. >>> >>> Moreover, the Encoder seems to never try to encode the attributes when >>> it is a SimpleBinding. >>> >>> By trying to overcome this limitation, I've made a custom binding for >>> xs:anySimpleType, which is a ComplexBinding instead of a SimpleBinding. >>> It was working alright for encoding, as that way I can set the >>> attributes inside encode(). >>> >>> The problem arises when I send a HTTP POST GetFeature request, since it >>> uses the parser to build the request object, then ParseExecutor fails >>> with a ClassCastException at line 132, trying to cast an AttrtibuteImpl >>> to an ElementInstance. >>> >>> Hope I'm making some sense, in any case, feel free to contact me through >>> im as soon as you have a chance. >>> >>> regards, >>> >>> Gabriel >>> >>> >>> ------------------------------------------------------------------------ >>> >>> ------------------------------------------------------------------------- >>> This SF.net email is sponsored by DB2 Express >>> Download DB2 Express C - the FREE version of DB2 express and take >>> control of your XML. No limits. Just data. Click to get it now. >>> http://sourceforge.net/powerbar/db2/ >>> >>> >>> ------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> Geotools-devel mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/geotools-devel > > !DSPAM:4007,4641e870102481030819293! > -- Justin Deoliveira The Open Planning Project http://topp.openplans.org ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Geotools-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-devel
