Skip to main content
February 16, 2009
Question

Extracting data from XML

  • February 16, 2009
  • 2 replies
  • 347 views
Hi anyone
I have created a list of Classes in a school in Excel and saved it as an XML file. In each row it contains the name of the class followed by a list of class members. In col 1 is the word "Class", in the next col is "7C1" ( or equivalent) then each cell after that contains the names of the class members. I can load the XML file no problem, and display the full contents using 'trace', but I don't seem to be able to extract just the class names and student names to use in a Flash application. Any ideas? The code I'm using so far is attached.
This topic has been closed for replies.

2 replies

Inspiring
February 16, 2009
So I think what you are looking for is the "Worksheet.Table.Column.Row"-XMLList which will contain each class.
Count its length via Worksheet.Table.Column.Row.length(), which will give you the number of classes, make a loop and read every class into an array. The specific Class entries can be accessed via Worksheet-Table.Column.Row[classNo].data[dataNo].text()

Inspiring
February 16, 2009
I'm not that 100% sure if I got your XML-structure right (could you post a example?) but I think you are aiming for sth. like output:XMLList = Class.7C1.students; (or inside your function students.7c1.students - I don't know if this will generate a naming conflict)
February 16, 2009
Thank you for your prompt reply. That must be a record! I've attached a sample printout of the Excel XML stuff. All I need to do is extract the names (by each teaching group) into an array for processing. I may be better of sticking to a simple text file! It's just that all my records are already on Excel so it seemed simpler that way.
The 'trace' attached is just a mock up with a few names in each class just til I get it to work. Then I'll apply it to the whole set.
Rick