A Flash Developer Resource Site

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Jun 2010

    Angry Can't access tags directly

    Can somebody please explain to me what's going on here?

    I can load an external .xml sheet no problem. I can trace the entire content of that .xml sheet no problem. I CAN'T seem to directly access the tags. When I try to trace them, I get nothing.

    Here's the code (called from another script. I pass the URL location of the .xml file)
    public function init(target:String)
    			myLoader.load(new URLRequest(target));
    			myLoader.dataFormat = URLLoaderDataFormat.TEXT;
    			myLoader.addEventListener(Event.COMPLETE, processXML);
    		public function processXML(e:Event):void 
    			var xml:XMLList = XML(myLoader.data);
    			trace(xml.responseDeclaration); //traces nothing
                            trace(xml) //traces all xml code
    Here is the xml file

    <?xml version="1.0" encoding="utf-8"?>
    <?xml version="1.0" encoding="UTF-8" ?> 
    <assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqti_v2p1 http://www.imsglobal.org/xsd/imsqti_v2p1.xsd" identifier="PDC_PM101_C1_FE1_Q1" title="Question" timeDependent="false" adaptive="false">
        <responseDeclaration identifier="Q1" cardinality="single">
            <mapping defaultValue="0">
                <mapEntry mapKey="A" mappedValue="10" /> 
                <mapEntry mapKey="B" mappedValue="0" />
                <mapEntry mapKey="C" mappedValue="0" />	
                <mapEntry mapKey="D" mappedValue="0" />	
            <p>Which statement is TRUE about the Statement of Work (SOW)?</p>
            <choiceInteraction responseIdentifier="Q1" maxChoices="1" shuffle="true">
                <simpleChoice identifier="A">When the customer and the project team belong to the same business, the SOW is the only project agreement required.</simpleChoice> 
                <simpleChoice identifier="B">When the customer and the project team belong to the same business, no SOW is required.</simpleChoice>
                <simpleChoice identifier="C">The SOW is a legal contract.</simpleChoice> 
                <simpleChoice identifier="D">A SOW is sufficient when the project team and the customer are different legal entities.</simpleChoice> 
        <!--<responseProcessing template="explanationTemplate.xml" />--> 
        <!--<modalFeedback outcomeIdentifier="EXPLANATION" identifier="completed" showHide="show">
            <p>The project charter authorizes a project and includes the initial project requirements.</p>
            <p>Reference: <i>A Guide to the Project Management Body of Knowledge (PMBOK® Guide)</i> Chapter 4, Section 4.1.</p>
        </modalFeedback> -->
    The only thing I can get to work at this point is to access the tags via:

    trace(xml.children()[0].localName()) //traces responseDeclaration
    trace(xml.children().length() //traces 2

    I do NOT want to have to resort to recursive functions as a "work around".

  2. #2

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.