September 27th, 2001, 06:47 AM
easy to do with XSL, but for reasons that would take to long to
Basically, If I have the following simple XML:
How do I extract/get the section attributes?
<head><title>XML File output</title></head>
<XML ID="xml_file" SRC="questionaire.xml"></XML>
function parse_xml( node )
section_list = xml_file.XMLDocument.selectNodes( "Questionaire/Section" );
//Loop through the sections
for( i = 0; i < section_list.length; i++ )
// I want to get the attribute here
section_array = new section( section_list[i] );
question_list = section_list[i].selectNodes( "Question" );
// Now loop through each question in the section
for( j = 0; j < question_list.length; j++ )
question_array= new question( question_list[j] );
I know that the logical solution would be to change the XML section
definition to the following:
But the other way is still standard XML and you should be able
I tried different combinations of the following with no success
Last edited by BJohnson; September 27th, 2001 at 06:53 AM.
October 6th, 2001, 09:51 AM
how about this line
var title = section_list[i].getAttribute("title")
October 8th, 2001, 03:44 AM
That's great, its just that simple!
I have a book that explains XML and has some
but it doesnt include that method.
I was also searching all over the internet
XML functions. Do you know of anything.
Thanks alot for your help.