My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 42: FlexXb 2.0.1 XmlArray deserialisation with namespaced element ignored when alias="*"
1 person starred this issue and may be notified of changes. Back to list
Status:  Invalid
Owner:  ----
Closed:  Mar 2011


 
Reported by domdelor...@gmail.com, Mar 16, 2011
What steps will reproduce the problem?

See the attached file for a working example of the  bug

1 . Create an xml file containing namespaced elements:

<xs:data xmlns:xs="http://www.example.com" >
	<xs:item value="1" />
	<xs:item value="2" />
	<xs:nested>
		<xs:item value="3" />
		<xs:item value="4" />
	</xs:nested>
</xs:data>

2. Map the immediate and nested item elements to arrays based on the "*" and "nested"  aliases;

Data.as Class:

	[XmlClass(alias="data", prefix="xs")]
	[Namespace(prefix="xs", uri="http://www.example.com")
	public class Data
	{
		[XmlArray(alias="*", type="Item", namespace="xs")]
		public var localItems:ArrayCollection = new ArrayCollection();

		[XmlArray(alias="nested", type="Item", namespace="xs")]
		public var nestedItems:ArrayCollection = new ArrayCollection();

		public function Data()
		{
		}
	}

Item.as Class:

	[XmlClass(alias="item", prefix="xs")]
	[Namespace(prefix="xs", uri="http://www.example.com")
	public class Item
	{

		[XmlAttribute]
		public var value:String;

		public function Item()
		{
		}
	}

3. Deserialise the xml

	var data:Data = FxBEngine.instance.getXmlSerializer().deserialize(xml, Data);
	trace("localItems: expect 2, found " + data.localItems.length);
	trace("nestedItems: expect 2, found " + data.nestedItems.length);

What is the expected output? What do you see instead?

//localItems: expect 2, found 0
//nestedItems: expect 2, found 2

Expect to see 2 items inside both the localItems and nestedItems array collections.

Instead the local items are totally ignored (alias="*"). The nested items deserialise as expected.

Furthermore, if the namespace prefix is removed from the local items (e.g. <item> rather than <xs:item> then deserialisation occurs (FlexXB seems to ignore the explicitly specified namespace)

What version of the product are you using? On what operating system?
2.0.1, osx 10.6.6

Please provide any additional information below.
See the attached file for a working example of the bug

FlexXB_array_namespace_bug.zip
2.3 MB   Download
Mar 16, 2011
Project Member #1 alex.id....@gmail.com
(No comment was entered for this change.)
Status: Accepted
Labels: Milestone-2.1.0
Mar 19, 2011
Project Member #2 alex.id....@gmail.com
Add the uri when you specify the XmlClass metadata:

[XmlClass(alias="item", prefix="xs", uri="http://www.example.com")

The XmlClass behaves a little different in this manner, due to the legacy code. I'm planning  an update to take into account this particularity but also have the usual behavior in place. If you do not provide the uri it should inspect its list of declared namespaces and find one matching the prefix.
Status: Invalid

Powered by Google Project Hosting