- Code: Select all
<result>
<record>
<field name="donor_id" id="donor_id" value="1"/>
<field name="first_name" id="first_name" value="John D."/>
<field name="last_name" id="last_name" value="McClurkin"/>
<field name="middle_name" id="middle_name" value=""/>
</record>
<record>
<field name="donor_id" id="donor_id" value="2"/>
<field name="first_name" id="first_name" value="Bill"/>
<field name="last_name" id="last_name" value="Jones"/>
<field name="middle_name" id="middle_name" value=""/>
</record>
</result>
That's literally all it returns. There is no default namespace.
So, I thought it would be a piece of cake parsing it using this:
- Code: Select all
var str = plugins.http.getPageData("myLongURL")
var myXML = new XML(str);
var firstName = myXML.result.record.field.attribute("first_name").toString()
I know that I'm doing something stupid but everything I try just winds up with an empty string.
Then I tried:
- Code: Select all
var firstName = myXML.result.record[0].field.attribute("first_name").toString()
But that just got an error:
- Code: Select all
TypeError: Cannot read property \"field\" from undefined
I've already had a look at viewtopic.php?f=22&t=15818&p=85410 and I guess I'm just missing it.
Any pointers would be greatly appreciated!