Expand my Community achievements bar.

can someone help me ?

Avatar

Level 1
i use asp.net webservice return follow xmldatadocument:(
http://localhost/SpryData/DataTableWebService.asmx/GetCustomers)

<?xml version="1.0" encoding="utf-8"?>

<NewDataSet>

<Table>

<CustomerID>ABC </CustomerID>

<CompanyName>ABC Company</CompanyName>

<ContactName>John Smith</ContactName>

<ContactTitle>Owner</ContactTitle>

<Address>One My Way</Address>

</Table>

<Table>

<CustomerID>ALFKI</CustomerID>

<CompanyName>Alfreds Futterkiste</CompanyName>

<ContactName>Maria Anders</ContactName>

<ContactTitle>Sales
Representative</ContactTitle>

<Address>Obere Str. 57</Address>

<City>Berlin</City>

<PostalCode>12209</PostalCode>

<Country>Germany</Country>

<Phone>030-0074321</Phone>

<Fax>030-0076545</Fax>

</Table>

<Table>

<CustomerID>ANATR</CustomerID>

<CompanyName>Ana Trujillo Emparedados y
helados</CompanyName>

<ContactName>Ana Trujillo</ContactName>

<ContactTitle>Owner</ContactTitle>

<Address>Avda. de la Constitución
2222</Address>

<City>México D.F.</City>

<PostalCode>05021</PostalCode>

<Country>Mexico</Country>

<Phone>(5) 555-4729</Phone>

<Fax>(5) 555-3745</Fax>

</Table>

</NewDataSet>



i can use it in datagrid with
{Service.GetCustomers.lastResult.GetCustomersResult.NewDataSet.Table}

but i can't use it in ArrayCollection and XMLListCollection.



if someone can use it ,please tell me ,thanks !



email: youngsun45@gmail.com
1 Reply

Avatar

Level 1
You won't be able to use the xml in an ArrayCollection
directly. If you need to use an ArrayCollection you will have to
convert the elements to objects and add them yourself. In the
example you provided the XMLListCollection is being created on your
behalf when you assign the e4x expression to the dataProvider via
binding. Within the setter for the dataProvider property there is a
check of the data type (in this case XMLList) and based on the type
it will constuct an appropriate collection support object (in this
case XMLListCollection).