Loading XML into Flex AS3

General Tech Learning Aids/Tools 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I am trying to be able to load all XML data from an XML document and have been failing all night on it even with research

Here is a snippet of the XML I am trying to load:

xml version="1.0"?>
 xmlns="http://www.w3.org/2005/Atom" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  urn:uuid:5762c9e8-4e65-3b0c-83b3-7874683f3dbe
   href="/v1/espi_third_party_batch_feed" rel="self">
  
   type="text">Opower ESPI Third Party Batch Feed v1
  2012-04-03T22:55:36.364Z

  
    urn:uuid:baa6a50a-1306-3680-80a4-51d228db8f25
     href="/v1/User/3560606/UsagePoint/6403112/MeterReading/1/IntervalBlock/1" rel="self">
    
     type="xml">
       xmlns="http://naesb.org/espi">
        
          3600
          1299128400
        
        
          
            3600
            1299128400
          
          436
        
      
    
  

Here is a snippet of the AS3 code I am puzzled on in the XmlLoader:

    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`
profilepic.png
manpreet 2 years ago

The answer to this thanks frankhermes and www.Flextras.com for aiding my learning is in order to continue to traverse there is the need to add another namespace of ATOM into the xml to keep traversing

var entries = this.docXML.ATOM::entry;
trace(entries[3].content.length()); 

should be

var entries = this.docXML.ATOM::entry;
trace(entries[3].ATOM::content.length()); 

0 views   0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

tuteehub community

Join Our Community Today

Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.

tuteehub community