Assorro Posted March 1, 2011 Share Posted March 1, 2011 I'm just starting to research xml and I need to know if there's a specific name I should be looking for. I'm trying to read data from an xml file which is easy when all the tags are different but I've got a test file of students where alot of the data is the same. For instance: <STUDENTS> <STUDENT> <FIRSTNAME>Micheal</FIRSTNAME> <LASTNAME>Dorne</LASTNAME> <GRADE>10</GRADE> <MATHSCORE>89</MATHSCORE> <TEACHER>Flinn</TEACHER> </STUDENT> <STUDENT> <FIRSTNAME>Terry</FIRSTNAME> <LASTNAME>Williams</LASTNAME> <GRADE>11</GRADE> <MATHSCORE>78</MATHSCORE> <TEACHER>Edwards</TEACHER> </STUDENT> <STUDENT> <FIRSTNAME>Kimberly</FIRSTNAME> <LASTNAME>Jenson</LASTNAME> <GRADE>10</GRADE> <MATHSCORE>92</MATHSCORE> <TEACHER>Flinn</TEACHER> </STUDENT> </STUDENTS> I've reached a point where I need to acquire data from an xml file structured similar to this and need to know where to start. I could be looking for all the data on one specific student or acquiring a list of all student names that have the same teacher for example. I'd appreciate it if someone could point me the right direction with this. Thanks. Quote Link to comment Share on other sites More sharing options...
devWhiz Posted March 1, 2011 Share Posted March 1, 2011 http://php.net/manual/en/function.simplexml-load-file.php http://php.net/manual/en/function.simplexml-load-string.php Quote Link to comment Share on other sites More sharing options...
Assorro Posted March 1, 2011 Author Share Posted March 1, 2011 Well thank you for the links but I'm looking for a way to parse the data for individual students into separate variables. The query could be for a first name for instance. I need to be able to search the xml and place into variables the information for only that student. This is easy when the xml doesn't have repeating tags unlike the example I provided. I figure that there's a way and that it's probably referred to by a name. Scraping won't do it since there are multiple instances of the same tags so I'd appreciate a little direction concerning this. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.