0 Replies Latest reply on Aug 15, 2006 4:21 PM by djdevvydev

    object access to XML attribute in a different namespace?

    djdevvydev
      Hi -

      I'm trying to access the value of an attribute in an XML file from Actionscript. Normally this shouldn't be a problem but in this case the attribute has a different namespace, and I can't seem to access it. The XML looks like this:

      <assessmentItem identifier="choice" title="Mult Choice, Select Single" adaptive="false" timeDependent="false" tpr:entityId="12455" tpr:duration="" tpr:endWarningTime="" tpr:businessItemTypeId="0000" tpr:questionType="M" tpr:displayItemFormat="multChoiceIndicatorHottext" tpr:passageRef="2">

      And I need to get access to the "tpr:entityId" attribute. The problem is, I can't use a colon in the reference...

      This:

      feedRequest.lastResult.assessment.section.section.assessmentItem[currentItem].identifier

      returns the correct value ("choice"), but none of these ways of accessing the tpr: attributes work:

      feedRequest.lastResult.assessment.section.section.assessmentItem[currentItem].tpr:entityId
      (generates a syntax error during compile)

      feedRequest.lastResult.assessment.section.section.assessmentItem[currentItem].entityId
      (compiles but fails at runtime with Error #1009: Cannot access a property or method of a null object reference.)

      feedRequest.lastResult.assessment.section.section.assessmentItem[currentPage].attribute("t pr:entityId");
      (also compiles but gives runtime error: Error #1010: A term is undefined and has no properties. )

      I'm at a loss. Anyone got any ideas?

      D Copley