Macromedia Flex Macromedia Flex
Create XML From String
  Home

Feb 19, 2008 - Create XML From String
Useful in merging XML with PDF

Assuming that you have a servlet that merges XML and PDF the following code is a nice snippet that can be used for sending the XML to the aforementioned servlet.

public function generateForm(url):void {
var data:XML = new XML;
var url:String = servletUrl + formName;
var request:URLRequest = new URLRequest(url);

var strXmlConversion:String = ""
+ ""
+ " " + value + ""
+ " " + value + ""
+ " " + value + ""
+ " " + value + ""
+ "
"
+ ""
+ " " + value + ""
+ "
"
+ "
";
data = XML(strXmlConversion);

if (data) {
trace(data);

request.contentType = "application/xml";
request.method = "POST";
request.data = data;

navigateToURL(request, "_blank");
}




Billy Blackerby
bblackerby@tci-usa.com
http://www.tci-usa.com

File Details
Created On Feb, 19, 2008 by Billy Blackerby
Last Modified On Feb, 19, 2008 by Billy Blackerby
Group: Tips and Articles
Flex Versions: 2.0
Category: Integration
Type: Tip
Difficulty: Beginner
Keywords: XML, PDF, String, Conversion