PDA

View Full Version : XML issues


mrand01
07-16-2003, 12:42 PM
I am trying to pull a value out of an XML document, with no success. I can get EVERY other value out of this document, except the one that says <"TITLE NAME = "Yeah"/>. I want to get that "Yeah" into a variable in flash. How would I do this?

<QUIZ>
<TITLE>
<TITLE NAME = "Yeah"/>
</TITLE>
<QUESTIONS>
<QUESTION NUMBER = "0"
TITLE="Question 1"
QUESTION="Who is the presenter in this presentation?"
ANSWER="C"/>
<CHOICES>
<CHOICE TITLE="A" PROMPT="Dr. No"/>
<CHOICE TITLE="B" PROMPT="Dr. Yep"/>
<CHOICE TITLE="C" PROMPT="Dr. Blah"/>
<CHOICE TITLE="D" PROMPT="Dr. Oh"/>
</CHOICES>

<QUESTION NUMBER = "1"
TITLE="Question 2"
QUESTION="What was the subject of the presentation?"
ANSWER="B"/>
<CHOICES>
<CHOICE TITLE="A" PROMPT="Baseball"/>
<CHOICE TITLE="B" PROMPT="Computers"/>
<CHOICE TITLE="C" PROMPT="Cars"/>
<CHOICE TITLE="D" PROMPT="Music"/>
</CHOICES>
</QUESTIONS>
</QUIZ>

JHallam
07-16-2003, 01:06 PM
What about -


XMLDOC.firstChild.firstChild.childNodes[0]

mrand01
07-16-2003, 01:12 PM
<TITLE NAME="Yeah" />

I get that...im going to try attributes on this maybe

edit: it worked like this.

this.firstChild.firstChild.childNodes[0].attributes.name

JHallam
07-16-2003, 01:14 PM
I'm in the process. I'm all new to using attributes, Ive only just started using XML frequently.

JHallam
07-16-2003, 01:18 PM
Aha! Just typed that!!

snapple
07-19-2003, 07:01 AM
Because attributes is an array, it is better written like this:

eg:

this.firstChild.firstChild.childNodes[0].attributes["NAME"];


snapple