class Main extends Sprite
{
public function new()
{
super();
try
{
var xml:Xml = Xml.parse("<count>6</count>");
trace(xml.nodeType);
for (x in xml.elementsNamed("count"))
{
trace(x.nodeName);
trace(x.nodeType);
trace(x.nodeValue);
}
}
catch (err:Dynamic)
{
trace(err);
Sys.exit(1);
}
}
}
输出:
主要.hx:23:6
Main.hx:27: 计数
Main.hx:28:0
Main.hx:34:错误的节点类型,意外的 0
我不能完全理解nodeValue
财产的运作原理。因此,我无法解决我的问题。这里有什么帮助吗?
PS 我的配置是:Haxe + OpenFL 针对 Neko。