avm2: Implement XMLNode.nodeValue

This commit is contained in:
Tom Schuster 2023-07-30 00:02:14 +02:00 committed by Nathan Adams
parent acddd6c26d
commit f237aa1da2
4 changed files with 16 additions and 0 deletions

View File

@ -87,6 +87,14 @@ package flash.xml
}
}
public function get nodeValue(): String {
if (_xml.nodeKind() == "text") {
return _xml.toString();
}
return null;
}
public function appendChild(node: XMLNode): void {
stub_method("flash.xml.XMLNode", "appendChild");
}

View File

@ -8,16 +8,20 @@ import flash.xml.XMLDocument;
var doc = new XMLDocument('<foo>bar</foo><x>y</x>');
trace("doc.nodeType: " + doc.nodeType);
trace("doc.nodeName: " + doc.nodeName);
trace("doc.nodeValue: " + doc.nodeValue);
trace("doc.childNodes: " + doc.childNodes);
trace("doc.toString(): " + doc.toString());
trace("doc.firstChild.nodeType: " + doc.firstChild.nodeType);
trace("doc.firstChild.nodeName: " + doc.firstChild.nodeName);
trace("doc.firstChild.nodeValue: " + doc.firstChild.nodeValue);
trace("doc.firstChild.toString(): " + doc.firstChild.toString());
trace("doc.firstChild.firstChild.nodeType: " + doc.firstChild.firstChild.nodeType);
trace("doc.firstChild.firstChild.nodeName: " + doc.firstChild.firstChild.nodeName);
trace("doc.firstChild.firstChild.nodeValue: " + doc.firstChild.firstChild.nodeValue);
trace("doc.firstChild.firstChild.toString(): " + doc.firstChild.firstChild.toString());
trace("doc.firstChild.nextSibling: " + doc.firstChild.nextSibling);
trace("doc.firstChild.nextSibling.nodeName: " + doc.firstChild.nextSibling.nodeName);
trace("doc.firstChild.nextSibling.nodeValue: " + doc.firstChild.nextSibling.nodeValue);
trace("///")

View File

@ -1,15 +1,19 @@
doc.nodeType: 1
doc.nodeName: null
doc.nodeValue: null
doc.childNodes: <foo>bar</foo>,<x>y</x>
doc.toString(): <foo>bar</foo><x>y</x>
doc.firstChild.nodeType: 1
doc.firstChild.nodeName: foo
doc.firstChild.nodeValue: null
doc.firstChild.toString(): <foo>bar</foo>
doc.firstChild.firstChild.nodeType: 3
doc.firstChild.firstChild.nodeName: null
doc.firstChild.firstChild.nodeValue: bar
doc.firstChild.firstChild.toString(): bar
doc.firstChild.nextSibling: <x>y</x>
doc.firstChild.nextSibling.nodeName: x
doc.firstChild.nextSibling.nodeValue: null
///
doc2.nodeType: 1
doc2.nodeName: null