wvxvw
20.08.2008, 19:19
Ну, желательно, чтобы самому не парсить =)
Кстати, не уверен, но по-моему раньше так не было...
Вот тест:
(почему во втором случае hasChildNodes() == true, nodeType == 1 для меня загадка)
var xml:XML = new XML('<Slide />');
trace(xml.hasChildNodes());
trace(xml.nodeType);
trace(xml.childNodes[0]);
for(var i:String in xml)
{
trace(i+" => "+xml[i]);
}
trace("-----------");
xml = new XML('foo');
trace(xml.hasChildNodes());
trace(xml.nodeType);
trace(xml.childNodes[0]);
for(i in xml)
{
trace(i+" => "+xml[i]);
}
Output:
true
1
<Slide />
namespaceURI => null
localName => null
prefix => null
previousSibling => null
parentNode => null
nodeValue => null
nodeType => 1
nodeName => null
nextSibling => null
lastChild => <Slide />
firstChild => <Slide />
childNodes => <Slide />
attributes => undefined
getPrefixForNamespace => [type Function]
getNamespaceForPrefix => [type Function]
toString => [type Function]
hasChildNodes => [type Function]
appendChild => [type Function]
insertBefore => [type Function]
removeNode => [type Function]
cloneNode => [type Function]
xmlDecl => undefined
status => 0
loaded => undefined
ignoreWhite => false
docTypeDecl => undefined
contentType => application/x-www-form-urlencoded
addRequestHeader => [type Function]
getBytesTotal => [type Function]
getBytesLoaded => [type Function]
onData => [type Function]
onLoad => [type Function]
sendAndLoad => [type Function]
send => [type Function]
load => [type Function]
parseXML => [type Function]
createTextNode => [type Function]
createElement => [type Function]
-----------
true
1
foo
namespaceURI => null
localName => null
prefix => null
previousSibling => null
parentNode => null
nodeValue => null
nodeType => 1
nodeName => null
nextSibling => null
lastChild => foo
firstChild => foo
childNodes => foo
attributes => undefined
getPrefixForNamespace => [type Function]
getNamespaceForPrefix => [type Function]
toString => [type Function]
hasChildNodes => [type Function]
appendChild => [type Function]
insertBefore => [type Function]
removeNode => [type Function]
cloneNode => [type Function]
xmlDecl => undefined
status => 0
loaded => undefined
ignoreWhite => false
docTypeDecl => undefined
contentType => application/x-www-form-urlencoded
addRequestHeader => [type Function]
getBytesTotal => [type Function]
getBytesLoaded => [type Function]
onData => [type Function]
onLoad => [type Function]
sendAndLoad => [type Function]
send => [type Function]
load => [type Function]
parseXML => [type Function]
createTextNode => [type Function]
createElement => [type Function]
Кстати, не уверен, но по-моему раньше так не было...
Вот тест:
(почему во втором случае hasChildNodes() == true, nodeType == 1 для меня загадка)
var xml:XML = new XML('<Slide />');
trace(xml.hasChildNodes());
trace(xml.nodeType);
trace(xml.childNodes[0]);
for(var i:String in xml)
{
trace(i+" => "+xml[i]);
}
trace("-----------");
xml = new XML('foo');
trace(xml.hasChildNodes());
trace(xml.nodeType);
trace(xml.childNodes[0]);
for(i in xml)
{
trace(i+" => "+xml[i]);
}
Output:
true
1
<Slide />
namespaceURI => null
localName => null
prefix => null
previousSibling => null
parentNode => null
nodeValue => null
nodeType => 1
nodeName => null
nextSibling => null
lastChild => <Slide />
firstChild => <Slide />
childNodes => <Slide />
attributes => undefined
getPrefixForNamespace => [type Function]
getNamespaceForPrefix => [type Function]
toString => [type Function]
hasChildNodes => [type Function]
appendChild => [type Function]
insertBefore => [type Function]
removeNode => [type Function]
cloneNode => [type Function]
xmlDecl => undefined
status => 0
loaded => undefined
ignoreWhite => false
docTypeDecl => undefined
contentType => application/x-www-form-urlencoded
addRequestHeader => [type Function]
getBytesTotal => [type Function]
getBytesLoaded => [type Function]
onData => [type Function]
onLoad => [type Function]
sendAndLoad => [type Function]
send => [type Function]
load => [type Function]
parseXML => [type Function]
createTextNode => [type Function]
createElement => [type Function]
-----------
true
1
foo
namespaceURI => null
localName => null
prefix => null
previousSibling => null
parentNode => null
nodeValue => null
nodeType => 1
nodeName => null
nextSibling => null
lastChild => foo
firstChild => foo
childNodes => foo
attributes => undefined
getPrefixForNamespace => [type Function]
getNamespaceForPrefix => [type Function]
toString => [type Function]
hasChildNodes => [type Function]
appendChild => [type Function]
insertBefore => [type Function]
removeNode => [type Function]
cloneNode => [type Function]
xmlDecl => undefined
status => 0
loaded => undefined
ignoreWhite => false
docTypeDecl => undefined
contentType => application/x-www-form-urlencoded
addRequestHeader => [type Function]
getBytesTotal => [type Function]
getBytesLoaded => [type Function]
onData => [type Function]
onLoad => [type Function]
sendAndLoad => [type Function]
send => [type Function]
load => [type Function]
parseXML => [type Function]
createTextNode => [type Function]
createElement => [type Function]