Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

XML String from WD to Flex XML

Former Member
0 Kudos
153

Hi,

I am new in flex development. I'd like to transfer an XML String to Flex. Unfortunately I don't´know how to do this.

In abap web dynpro I created a string variable which contains the xml. The string contains e.g. the following hierarchical information:

In flex I created the following variable:

public var XmlString:String;

I am using a open source component in flex which can display this hierarchy. This component expects the information as a variable of type XML:

Does anyone know, how to convert the string XML into the flex XML type?

Thank you and best regards, Eddy

5 REPLIES 5

Former Member
0 Kudos
108

Hi Edger,

You can use the new XML() constructor to create an XML object from a string, as follows:

var myDataProvider:XML = new XML('<Organization name="Manager" experience="20">
<Organization name="Project Lead" experience="10">
<Organization name="Architect" experience="6"/>
<Organization name="Developer" experience="3"/>
<Organization name="Developer" experience="1"/>
<Organization name="Developer" experience="2"/>');

For more help you can refer XML type conversion in :

http://127.0.0.1:54718/help/index.jsp?topic=/com.adobe.flexbuilder.help/html/13_Working_with_XML_01....

Regards,

Vivek

0 Kudos
108

Hi Vivek,

thank you for your answer.

I knew that possibility to create an XML using your mentioned XML constructor. My problem is I originally have an xml string on abap web dynpro side.

This string is sent to flex via binding. The next step on flex side would be, to convert this string to an xml object, as you mentioned above. So there must be something like an event handler that is called, every time the xml string is changed. In this event handler the string is converted to an xml object.

Do you have an idea, how to do this?

Thank you and best regards, Eddy

0 Kudos
108

Hi Edger,

Events are handled mainly on service responce or components. On change of raw value of any variable i don't find any event that you may find for any component like change of value in any TextInput etc.

When you start your application you can hit to back-end DB sytem to get latest values at present.

You can try to pass some trigger from WDA side to Flex so that it'll refresh it's XML collection at that moment.

Or another way is you have keep polling for that XML value at regular interval.

This can be done using Timer Class in Flex. you can get many examples for it's use in Help of Flex builder.

Regards,

Vivek

0 Kudos
108

Hi,

I can't believe that there isn't a way to convert a string from web dynpro to an flex xml object. I heard of setter methods in flex, which are called when the WD context is changed. Would this be the right approach to handle this problem? Or has anyone else a solution?

Best Regards, Edgar

0 Kudos
108

Hi Edger,

I don't know if this could help you, but you can try as you said with a setter method, like this:

public function set flexXMLString(XMLString:String):void{
  var _flexXML:String = XMLString;
  "your code"
}

This method will be called whenever the variable flexXMLString is changed.

Remeber to not declare flexXMLString, as it will be done implicitly but building up a setter method.

Hope this helps.

Kind reg,

R.