Re: [Flashcoders] XML confusion

2007-09-12 Thread EECOLOR
The trace functions arguments are implemented as follows trace(...
arguments). Which means that all types of variables are accepted. Every type
of variable extends Object and with that every instance will have a toString
method. This is the method the trace function will call to display the
value.

The actual text from the documentation:

Displays expressions, or writes to log files, while debugging. A single
trace statement can support multiple arguments. If any argument in a trace
statement includes a data type other than a String, the trace function
invokes the associated toString() method for that data type. For example, if
the argument is a Boolean value the trace function invokes Boolean.toString()
and displays the return value.


Greetz Erik


On 9/10/07, ben gomez farrell [EMAIL PROTECTED] wrote:

 I don't think you're doing anything wrong, its just that the trace
 function only accepts strings as parameters.  So when you pass in your
 XML variable it would throw an error if you were using a more strict
 language like Actionscript 3 (at least I assume it throws an error in
 AS3, maybe it actually does the same thing).
 However, if you're using AS2, which is less strict, the trace function
 expects a string, so it'll try to convert your XML to a string, and it
 looks like its successful. It probably runs the XML.toString() method
 when it gets to the trace method.
 So you're not going to get anything from trace except for a converted
 string.  And it'll do the same thing in your scriptPath string, because
 its going to convert that XML variable to a string.
 If you want more control, you might try looping through your XML to
 create a more custom string, and then use that.
 ben

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] XML confusion

2007-09-11 Thread Paul Steven
Thanks for the replies. That helped alot and I have now got it working
thanks to your useful tips.



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ben gomez
farrell
Sent: 10 September 2007 20:16
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] XML confusion

I don't think you're doing anything wrong, its just that the trace 
function only accepts strings as parameters.  So when you pass in your 
XML variable it would throw an error if you were using a more strict 
language like Actionscript 3 (at least I assume it throws an error in 
AS3, maybe it actually does the same thing).
However, if you're using AS2, which is less strict, the trace function 
expects a string, so it'll try to convert your XML to a string, and it 
looks like its successful. It probably runs the XML.toString() method 
when it gets to the trace method.
So you're not going to get anything from trace except for a converted 
string.  And it'll do the same thing in your scriptPath string, because 
its going to convert that XML variable to a string.
If you want more control, you might try looping through your XML to 
create a more custom string, and then use that.
ben

Paul Steven wrote:
 I am trying to convert a string to xml but for some reason when I convert
to
 xml it only displays the encoded string. See below the code snippet for
 what is traced. Any idea what I am doing wrong?

 Here is my test file

 var encodedString:String = encoded string;

 var XMLString:String; 
 XMLString = ?xml version=\1.0\ encoding=\UTF-8\?;
 XMLString += file;
 XMLString += ![CDATA[ + encoded string + ]];
 XMLString += /file;
   
 trace (XMLString =  + XMLString); // Trace 1
   
 var dataToSend:XML = new XML(XMLString);
   
 trace (dataToSend =  + dataToSend); // Trace 2  
   
 var scriptPath:String = uploadUrl + ?xml= +  dataToSend + key= + _key
+
 session= + _sessionId; 

 -
 Trace Results
 -
 1.
 XMLString = ?xml version=1.0 encoding=UTF-8?file![CDATA[encoded
 string]]/file
 2.
 encoded string



 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

   
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] XML confusion

2007-09-10 Thread Paul Steven
I am trying to convert a string to xml but for some reason when I convert to
xml it only displays the encoded string. See below the code snippet for
what is traced. Any idea what I am doing wrong?

Here is my test file

var encodedString:String = encoded string;

var XMLString:String;   
XMLString = ?xml version=\1.0\ encoding=\UTF-8\?;
XMLString += file;
XMLString += ![CDATA[ + encoded string + ]];  
XMLString += /file;

trace (XMLString =  + XMLString); // Trace 1

var dataToSend:XML = new XML(XMLString);

trace (dataToSend =  + dataToSend); // Trace 2

var scriptPath:String = uploadUrl + ?xml= +  dataToSend + key= + _key +
session= + _sessionId;   

-
Trace Results
-
1.
XMLString = ?xml version=1.0 encoding=UTF-8?file![CDATA[encoded
string]]/file
2.
encoded string



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] XML confusion

2007-09-10 Thread Ron Wheeler
You do not want to send an XML object, you just want to send the string. 
It is the server that needs to convert the string to an XML Object. Just 
send it the characters.
You may have to encode the string since HTTP has no idea about CDATA. 
The browser and server will look at every character inside the CDATA and 
look for things to process .


Try making it shorter.

var encodedString:String = encoded string;

var XMLString:String;   
XMLString = ?xml version=\1.0\ encoding=\UTF-8\?;
XMLString += file;
XMLString += ![CDATA[ + encoded string + ]];
XMLString += /file;

trace (XMLString =  + XMLString); // Trace 1

//Need an encode here to protect the encoded data from interpretation 
  

var scriptPath:String = uploadUrl + ?xml= +  XMLString + key= + _key +
session= + _sessionId; 


Paul Steven wrote:

I am trying to convert a string to xml but for some reason when I convert to
xml it only displays the encoded string. See below the code snippet for
what is traced. Any idea what I am doing wrong?

Here is my test file

var encodedString:String = encoded string;

var XMLString:String;   
XMLString = ?xml version=\1.0\ encoding=\UTF-8\?;
XMLString += file;
XMLString += ![CDATA[ + encoded string + ]];
XMLString += /file;

trace (XMLString =  + XMLString); // Trace 1

var dataToSend:XML = new XML(XMLString);

trace (dataToSend =  + dataToSend); // Trace 2  

var scriptPath:String = uploadUrl + ?xml= +  dataToSend + key= + _key +
session= + _sessionId; 

-
Trace Results
-
1.
XMLString = ?xml version=1.0 encoding=UTF-8?file![CDATA[encoded
string]]/file
2.
encoded string



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


  

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] XML confusion

2007-09-10 Thread ben gomez farrell
I don't think you're doing anything wrong, its just that the trace 
function only accepts strings as parameters.  So when you pass in your 
XML variable it would throw an error if you were using a more strict 
language like Actionscript 3 (at least I assume it throws an error in 
AS3, maybe it actually does the same thing).
However, if you're using AS2, which is less strict, the trace function 
expects a string, so it'll try to convert your XML to a string, and it 
looks like its successful. It probably runs the XML.toString() method 
when it gets to the trace method.
So you're not going to get anything from trace except for a converted 
string.  And it'll do the same thing in your scriptPath string, because 
its going to convert that XML variable to a string.
If you want more control, you might try looping through your XML to 
create a more custom string, and then use that.

ben

Paul Steven wrote:

I am trying to convert a string to xml but for some reason when I convert to
xml it only displays the encoded string. See below the code snippet for
what is traced. Any idea what I am doing wrong?

Here is my test file

var encodedString:String = encoded string;

var XMLString:String;   
XMLString = ?xml version=\1.0\ encoding=\UTF-8\?;
XMLString += file;
XMLString += ![CDATA[ + encoded string + ]];
XMLString += /file;

trace (XMLString =  + XMLString); // Trace 1

var dataToSend:XML = new XML(XMLString);

trace (dataToSend =  + dataToSend); // Trace 2  

var scriptPath:String = uploadUrl + ?xml= +  dataToSend + key= + _key +
session= + _sessionId; 

-
Trace Results
-
1.
XMLString = ?xml version=1.0 encoding=UTF-8?file![CDATA[encoded
string]]/file
2.
encoded string



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

  

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com