XMLArray

12 views
Skip to first unread message

michael....@gmail.com

unread,
Sep 7, 2011, 5:22:02 AM9/7/11
to fle...@googlegroups.com
Hi,

I have the problem, that my xml looks like that:

<kategorien>
<hauptkategorie>
  <ID>1</ID>
  <name><![CDATA[somename]]></name>
  <subkategorie>
    <ID>11</ID>
    <name><![CDATA[somesub]]></name>
  </subkategorie>
  <subkategorie>
    <ID>nlfld000000000001029</ID>
    <name><![CDATA[Schwerpunkte Steuern]]></name>
  </subkategorie>
</hauptkategorie>
</kategorien>

michael....@gmail.com

unread,
Sep 7, 2011, 5:24:58 AM9/7/11
to fle...@googlegroups.com
Sorry, I accidentally sent the mail.


but when I try to deserialize it, with this Class:

[XmlClass(alias="hauptkategorie")]
[Bindable]
public class MainCategory implements IIdentifiable
{
[XMLElement()]
public var ID : String;
[XMLElement(ali)]
public var name : String;
[XmlArray(alias="*", memberName="subkategorie", type="model.SubCategory")]
        public var subCategories : Array;
public function MainCategory()
{
super();
}
public function get thisType():Class
{
return MainCategory;
}

public function get id() : String
{
return ID;
}
}
it deserializes the structure of the arrays correct, but doesn't deserialize the correct values if "ID" and "name", they are always null.


Any suggestions?

Thanks,
Michael

Alexutz

unread,
Sep 7, 2011, 7:37:52 AM9/7/11
to FxWorks
Hi Michael,

Use XmlElement instead of XMLElement.Oh and that "ali" string should
not be in there at the name field.

Alex

On Sep 7, 12:24 pm, "michael.reich...@gmail.com"

michael....@gmail.com

unread,
Sep 7, 2011, 7:56:58 AM9/7/11
to fle...@googlegroups.com
Thanks Alex,

that "ali" was just a typo from copying.

Good to know - i tried to find the differences to your samples - but that "XML" vs "Xml" i just missed.

Michael
Reply all
Reply to author
Forward
0 new messages