Use bracket access instead of attributes() for xsi type retreival

13 views
Skip to first unread message

tfs

unread,
Nov 11, 2011, 2:05:29 AM11/11/11
to FxWorks
Hi,

i've recently upgraded from my custom modified FlexXB version (
http://groups.google.com/group/flexxb/browse_thread/thread/72043bb87b45c8ad/15bd5c1bad82ce4b?lnk=gst#15bd5c1bad82ce4b
) to the latest release, and noticed that some of my files wouldn't
deserialize correctly anymore. After some trial and error i've found
out that the problem is caused by an additional attribute named "type"
on a node which also contains an "xsi:type" attribute.

The attributes() method which is currently used (
http://www.google.com/codesearch#leyGIisSjfA/trunk/FlexXB/FlexXB/src/main/flex/com/googlecode/flexxb/xml/XmlDescriptionContext.as&q=xsitype%20package:http://flexxb\.googlecode\.com&l=136
) returns the non-prefixed "type" attribute too (not sure whether this
is the correct behaviour), resulting in "type" and "xsi:type" being
concatenated, while bracket access returns only the "xsi:type"
attribute. Example:

------------------
var document:XML =
<root>
<foo type="Something" xsi:type="SomeOtherThing" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance">
</foo>
</root>;


var xsiNamespace:Namespace = new Namespace("xsi", "http://www.w3.org/
2001/XMLSchema-instance");
var xsiType:QName = new QName(xsiNamespace, "type");

trace(document.foo.attribute(xsiType));
trace(document.foo.@[xsiType]);
------------------

You should see that attributes() returns "SomethingSomeOtherThing" and
bracket access "SomeOtherThing".

Regards, Tim

Alexutz

unread,
Nov 18, 2011, 4:37:51 AM11/18/11
to FxWorks
Good catch, I'll take a look at it

Thanks,
Alex

On Nov 11, 9:05 am, tfs <timo.fier...@web.de> wrote:
> Hi,
>
> i've recently upgraded from my custom modified FlexXB version (http://groups.google.com/group/flexxb/browse_thread/thread/72043bb87b...
> ) to the latest release, and noticed that some of my files wouldn't
> deserialize correctly anymore. After some trial and error i've found
> out that the problem is caused by an additional attribute named "type"
> on a node which also contains an "xsi:type" attribute.
>
> The attributes() method which is currently used (http://www.google.com/codesearch#leyGIisSjfA/trunk/FlexXB/FlexXB/src/....googlecode\.com&l=136

tfs

unread,
Nov 18, 2011, 9:02:12 AM11/18/11
to FxWorks
Thanks... and you've probably noticed it, i've mixed up attributes()
and attribute(), ofcourse i always ment attribute().

Regards, Tim


On Nov 18, 10:37 am, Alexutz <alex.id.ciob...@gmail.com> wrote:
> Good catch, I'll take a look at it
>
> Thanks,
> Alex
>
> On Nov 11, 9:05 am, tfs <timo.fier...@web.de> wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > i've recently upgraded from my custom modified FlexXB version (http://groups.google.com/group/flexxb/browse_thread/thread/72043bb87b...
> > ) to the latest release, and noticed that some of my files wouldn't
> > deserialize correctly anymore. After some trial and error i've found
> > out that the problem is caused by an additional attribute named "type"
> > on a node which also contains an "xsi:type" attribute.
>
> > The attributes() method which is currently used (http://www.google.com/codesearch#leyGIisSjfA/trunk/FlexXB/FlexXB/src/....com&l=136

tfs

unread,
Jul 18, 2012, 8:39:25 PM7/18/12
to fle...@googlegroups.com
Let me bump this up :)
Reply all
Reply to author
Forward
0 new messages