When you do:

var xml : XML = <someDocument>;

It looks like it's a normal hierarchical Object the way you can get things
via:

[EMAIL PROTECTED]

But it's not really, it's an E4X object, which is a special case. You can do
all sorts of funky stuff, but until you reference a "text" node or an
Attribute (which will always be a string), every Object you get back will be
an XML or XMLList, which is just sort of a "pointer" to one or more nodes
inside your original root XML.

When you call

someXML.newName = myDate;

>From the top of my head, what's really happening is the creationg of a new
node named "newName" which contains a single text node containing
myDate.toString(), or perhaps the result of a call to SimpleXMLEncoder or
something along those lines.

-Josh

On Fri, Jun 20, 2008 at 8:28 AM, Frank Sommers <[EMAIL PROTECTED]>
wrote:

> Hi,
>
> I'm trying to figure out how to add a non-XML property to an XML
> object. The XML object implements both the . and [] operators so that
> anything assigned via these operators becomes XML or XMLList. I would
> like to somehow revert to the regular behavior for the . and []
> operators so that I can assign non-XML properties to an XML object.
>
> For example, I may have an XML object as in:
>
> var x:XML = <xmlobj/>;
>
> And a variable, such as:
>
> var d:Date = new Date();
>
> I would like to be able to assign the value of d as a Date to x. With
> a regular object, this works just fine:
>
> var o:Object = new Object();
> o.date = d;
>
> But using the same notation for the XML object creates an XMLList,
> i.e., a child of the XML object:
>
> x.date = d;
> // x.date is now an XMLList.
>
> Is there a way to override this behavior so that d is added as a Date?
>
> Thanks,
>
> -- Frank
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>


-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]

Reply via email to