3 Replies Latest reply on Jul 14, 2011 9:59 AM by Flex harUI

    XML using the XMLDocument and XMLNode

    NilanPerera

      Hi guys,

      Im new to flex and I am trying to create an xml document in code. Here is a snippet of my code:

       

      fuelNode = xmlDoc.createElement("Fuel");

      sectionNode.appendChild(fuelNode);

      childNode = xmlDoc.createElement("FuelID");

      childNode.nodeType = 1;

      childNode.nodeValue = inArray[i].FuelID;

      fuelNode.appendChild(childNode);

       

      This creates the following xml :

       

      <Fuels>

           <Fuel>

                <FuelID />

           </Fuel>

      </Fuels>

       

      as you can see there is no value for FuelID.

       

      if I change the childNode.nodeType to 3 I get the following :

       

      <Fuels>

           <Fuel>1</Fuel>

      </Fuels>

       

      What I am trying to create is :

       

      <Fuels>

           <Fuel>

                <FuelID>1</FuelID>

           </Fuel>

      </Fuels>

       

      Any help would be really appreciated. Thanks