Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-26-2009, 06:10 PM   #1
Jerry62712
Senior Member
 
Jerry62712's Avatar
 
Join Date: Nov 2008
Posts: 186
Question Manupilating a string to XML

I have a string I get in from the URL of the web page. This string is in XML format:

Code:
FSCalc.html?xml=
<?xml version="1.0" encoding="UTF-8" ?>
<FSParm>
<HouseholdSize>6</HouseholdSize>
</FSParm>
Now I want to convert the string into XML and XML pairs (key-value). Here is the non-working code:

Code:
			var testing:String = getQueryString().toString();
Alert.show("**Testing** query as string" + testing,"XML as string");

			parseXML = getQueryString() as XMLList;
			if (parseXML) {
Alert.show("**testing** parm length=" + parseXML.length(),"Test parm length");
				var item:XML;
				for each(item in parseXML) {
					Alert.show("item:" + item.toXMLString());
				}
			}
Because of the Alerts, I know the string looks like this:

Code:
<?xml version="1.0" encoding="UTF-8" ?><FSParm><HouseholdSize>6</HouseholdSize></FSParm>
But when it is placed into parseXML, nothing gets there and I never reach the second Alert. I'm convinced that I'm just making a newbie mistake. Can anyone tell me what I'm doing wrong?

Last edited by Jerry62712; 06-26-2009 at 07:58 PM.
Jerry62712 is offline   Reply With Quote
Old 06-26-2009, 06:31 PM   #2
Sekhar
Marketer/Technologist
 
Join Date: Aug 2007
Location: San Diego, CA
Posts: 434
Default

Do parseXML = XMLList(getQueryString()); You'll get a list with one node: FSParm.
__________________
AllureFX LLC
Twitter Facebook LinkedIn
Sekhar is offline   Reply With Quote
Old 06-26-2009, 07:16 PM   #3
Jerry62712
Senior Member
 
Jerry62712's Avatar
 
Join Date: Nov 2008
Posts: 186
Default

Thanks, that eliminated the problem. Now how do I access the name of the key and the value?
Jerry62712 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:57 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.