0 Replies Latest reply on Oct 7, 2009 6:48 AM by hastingsr

    How to specify xml declaration in an xml variable

    hastingsr Level 1

      The web service my flex 3 application is sending Post requests to requires that the XML declaration:

      <?xml version="1.0" encoding "UTF-8"?>  be at the begining of the request content.  I can't see how to do this with an XML variable.  I searched the forum and found http://forums.adobe.com/message/136345#136345 , but there was never any answer.

       

      Here is the code snippit:

       

                          var x:XML =
                            <device xmlns="urn:ams:device">
                              <device-id>{deviceId}</device-id>
                              <name>{deviceNameUI.text}</name>
                              <host>{deviceHostUI.text}</host>

                          </device>;

                          trace("sending this xml: \n" + x.toXMLString());
                          deviceAddDialog = this;

       

                          var token:AsyncToken = deviceService.send(x);

       

       

      The output of x.toXMLString() is :

       

      <device xmlns="urn:ams:device">

        <device-id>0</device-id>
        <name>device1</name>
        <host>device1</host>
      </device>

       

      I need it to be:

       

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

      <device xmlns="urn:ams:device">

        <device-id>0</device-id>
        <name>device1</name>
        <host>device1</host>
      </device>