hi arri,
you just have to set the the XMLObject's property "ignoreWhite" to 1:
e.g.:
on beginSprite me
flashXml = newObject("XML")
flashXml.ignoreWhite = 1
setCallback(flashXml, "onLoad", #xmlLoaded, me)
flashXml.load("http://extra.waag.org/users/arjen/xml.txt")
end
on exitFrame me
go the frame
end
on xmlLoaded me, obj
put obj.childNodes.length
put obj.childNodes[0].childNodes.length
put obj.childNodes[0].childNodes[0].childNodes.length
put obj.childNodes[0].childNodes[0].childNodes[0].childNodes.length
end
--> message window:
-- 1.0000
-- 1.0000
-- 1.0000
-- 10.0000
I think the problem is that with the default setting "ignoreWhite=0"
the white space AFTER your closing </control>-tag (2 unix line feeds)
is treated as new text node.
cheers,
valentin
arjen wrote:
> it indeed has to do with the difference between opening a file (from
> disk or URL) and just getting respons from a server.. the latter works
> great, the first results in these empty childnodes.
>
> does anyone know if this would be solved by giving the file a
> (correct)
> documenttype?
> and what documenttype should that then be?
>
>
> thanks
> arri
>
>
>
>
> On 09 mei 2005, at 16:41, arjen wrote:
>
>> could it then maybe be solved with some kind of docTypedecleration?
>>
>> i must admit i haven't much experience using xml,
>> so i'm still learning.
>>
>> i think technically the xml we use is correct,
>> and i guess they're all unix-style line breaks.
>>
>> but this could actually verywell be the cause..
>> i'll look into that.
>>
>>
>> arri
>>
>>
>>
>> On 09 mei 2005, at 16:03, Johan Verhoeven wrote:
>>
>>> I have experienced the same problem when usinf XML in flash as
>>> well. I can't seem to pinpoint why it happens. When I use
>>> Dreamweaver to make the XML, this weird thing happens. When the XML
>>> is generated from a server, this isn't the case. I guess it has
>>> something to do with line-breaks that the flash XML parser
>>> recognizes as seperate objects..
>>>
>>> J.
>>
>> [To remove yourself from this list, or to change to digest mode, go
>> to http://www.penworks.com/lingo-l.cgi To post messages to the list,
>> email [email protected] (Problems, email
>> [EMAIL PROTECTED]). Lingo-L is for learning and helping with
>> programming Lingo. Thanks!]
>>
>
> [To remove yourself from this list, or to change to digest mode, go
> to http://www.penworks.com/lingo-l.cgi To post messages to the list,
> email [email protected] (Problems, email
> [EMAIL PROTECTED]). Lingo-L is for learning and helping with
> programming Lingo. Thanks!]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list, email
[email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]