0 Replies Latest reply on Aug 8, 2010 10:20 PM by purusothamyb

    How to parse XML file with namesapce?

    purusothamyb

      Hi,

         I am trying to parse an xml file having namespace. But no data is returned.

       

      Sample Code:

       

      public class XMLFileLoader

      {

      var xml:XML = new XML();

      var myXML:XML = new XML();

      var XML_URL:String = "file:///C:/Documents and Settings/Administrator/Desktop/MyData.xml";

      var myLoader:URLLoader = null;

      public function XMLFileLoader()

      {

      var myXMLURL:URLRequest = new URLRequest(XML_URL);

      myLoader= new URLLoader(myXMLURL);

      myLoader.addEventListener(Event.COMPLETE,download);

      }

      public function download(event:Event):void

      {

      myXML = XML(myLoader.data);

      var ns:Namespace=myXML.namespace("xsi");

      for(var prop:String in myXML)

      {

           trace(prop);

      }

      //Alert.show(myXML..Parameters);

      //trace("Data loadedww."+myXML.toString());

      //Alert.show(myXML.DocumentInfo.attributes()+"test","Message");

      }

      }

       

       

      The XML Contains the following format.

       

      <Network xmlns="http://www.test.com/2005/test/omc/conf"

               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

               xsi:schemaLocation="http://www.test.com/2005/test/omc/conf/TestConfigurationEdition3proposal4.xsd">

       

          <TestDomain>

       

            <WAC>

              <!--Release Parameter  -->

              <Parameters ParameterName="ne_release" OutageType="None"

                          accessRight="CreateOnly" isMandatory="true"

                          Planned="false"

                          Reference="true" Working="true">

                <DataType>

                  <StringType/>

                </DataType>

                <GUIInfo graphicalName="Release"

                         tabName="All"

                         description="Describes the release version of the managed object"/>

              </Parameters>

      </TestDomain>

      </Network>

       

       

      Any sample code how to parse this kind of xml file with namespaces...

       

      Regards,

      Purushotham