why dont u guys use the dot operators http://livedocs.adobe.com/flex/2/langref/XML.html#includeExamplesSummary
http://livedocs.adobe.com/flex/2/langref/XMLList.html#includeExamplesSummary Check out the examples of the above link on right side corner LINK named as examples On Wed, Mar 4, 2009 at 2:31 PM, kalpesh mahida <[email protected]>wrote: > Hi, > try this out and let me know if it help you > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute" creationComplete="loadXML()"> > <mx:Script> > <![CDATA[ > import mx.controls.Alert; > > private function loadXML():void{ > var urlReq:URLRequest = new URLRequest("database.xml"); > var urlLoader:URLLoader = new URLLoader(); > urlLoader.addEventListener(Event.COMPLETE,onComplete); > > urlLoader.load(urlReq); > } > private function onComplete(event:Event):void{ > var loader:URLLoader = URLLoader(event.target); > var xmlData:XML = new XML(loader.data); > var listdata:XMLList = xmlData.conf; > Alert.show("Host::"+listdata[0].host); > Alert.show("Id::"+listdata[0].id); > } > ]]> > </mx:Script> > </mx:Application> > > below is the databse.xml > <?xml version="1.0" encoding="iso-8859-1"?> > <db> > <conf> > <id>1</id> > <host>myhost</host> > </conf> > </db> > > Regards, > Kalpesh Mahida > > > > On Wed, Mar 4, 2009 at 11:54 AM, Akhil Agrawal <[email protected]>wrote: > >> >> i followed the same way it is working with other element in the form >> <ele>...</ele> >> bt not working with <ele/> type element >> >> On Mar 4, 10:56 am, kalpesh mahida <[email protected]> wrote: >> > Hi, >> > >> > I think first you should load XML data in one xmlData variable like >> > >> > var xmlData:XML = new XML(loader.data); >> > >> > and use xmlData variable to get the attribute value >> > >> > Regards, >> > Kalpesh Mahida >> > >> > On Wed, Mar 4, 2009 at 11:09 AM, Akhil Agrawal <[email protected] >> >wrote: >> > >> > >> > >> > > Hi, >> > > I am trying to retrieve the attribute of an element from an xml file. >> > > element is like this... >> > > <database host="akhil" id="se" >> > > name="0ad953ea7bbb781b11d1d69fc9501001"/> >> > > using this code >> > > var data:XML=element.child("database ")[0]; >> > > where element is an xml type variable parent of database node >> > > bt it is giving null error. how to fix it >> > > thanx >> > >> > > regards >> > > akhil agrawal >> >> > > > > -- ----------------------------- Regards, HISSAM, ------------------------------ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/flex_india?hl=en -~----------~----~----~----~------~----~------~--~---

