我试图能够从 XML 文档中加载所有 XML 数据,并且即使进行了研究,它也一直失败
这是我尝试加载的 XML 片段:
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id>urn:uuid:5762c9e8-4e65-3b0c-83b3-7874683f3dbe</id>
<link href="/v1/espi_third_party_batch_feed" rel="self">
</link>
<title type="text">Opower ESPI Third Party Batch Feed v1</title>
<updated>2012-04-03T22:55:36.364Z</updated>
<entry>
<id>urn:uuid:baa6a50a-1306-3680-80a4-51d228db8f25</id>
<link href="/v1/User/3560606/UsagePoint/6403112/MeterReading/1/IntervalBlock/1" rel="self">
</link>
<content type="xml">
<IntervalBlock xmlns="http://naesb.org/espi">
<interval>
<duration>3600</duration>
<start>1299128400</start>
</interval>
<IntervalReading>
<timePeriod>
<duration>3600</duration>
<start>1299128400</start>
</timePeriod>
<value>436</value>
</IntervalReading>
</IntervalBlock>
</content>
</entry>
</feed>
这是我在 XmlLoader 中困惑的 AS3 代码片段:
public function returnArray():Array
{
var ATOM:Namespace = new Namespace("http://www.w3.org/2005/Atom");
var NAESB:Namespace = new Namespace("http://naesb.org/espi");
trace("entered returnArray");
var tempArray:Array = new Array();
var x:Number = 0;
var y:Number = 0;
var entries = this.docXML.ATOM::entry;
trace(entries.length()); //returns 4 and supposed to
trace(entries[3].content.length()); //returns 0 supposed to return 1
trace(this.docXML.ATOM::entry[3].content.NAESB::interval.length()); //returns 0`enter code here`