Use of MX: Model and mx: XML in flex

Source: Internet
Author: User
Both standards can be used for dataprovider use by other standards. the data obtained from the backend is generally in XML format, but the XML obtained in flex cannot be directly written into the image list, combox, in a linkbar or other standard, you must first import mx: model or mx: XML before using it. You can also use array to parse the XML, other cases can be handled using objects. This will be done in the next section.

MX: Model
<Mx: Model id = "linkdata">
<Part> GG </Part>
<Item>
<Label>
Dfsg
</Label>
<DATA>
DF
</Data>
</Item>
<Item>
<Label>
Dfsgfd
</Label>
<DATA>
DFF
</Data>
</Item>
</MX: Model>
For example, the model definition can use {linkdata. item}, so if you want to obtain the vertex value, you can use linkdata. part or linkdata. item [0]. label. The obtained values are Gg and dfsg.

MX: XML
Example
<Mx: XML id = "treexml">
<Node label = "mail">
<Label> DF </label>
<DATA> dfgg </data>
</Node>
<Node>
<Label> FGD </label>
<DATA> hdfh </data>
</Node>
<Node>
<Label> FH </label>
<DATA> fgtpd </data>
</Node>
</MX: XML>
As defined in XML, {linkdata can be used in lists and comboxes. childnodes} to complete (from linkdata. childnodes. in tostring (), we can see that it passes through dataprovider. when additem is added, the format <mx: Object Label = "" Data = ""/> is not the same as that in MX: model, yes <item> <label> </label & gt; <DATA> </data> </item> (or mx: XML and mx: model are the same ), so you can use linkdata in MX: model. item can indicate all worker partitions, while linkdata in MX: XML. childnodes only displays the newly added data records .),
In addition, if a single vertex is used to obtain a value, use linkdata. childnodes [0]. firstchild. firstchild. nodevalue. The value is DF.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.