Jump to content

XML - Point in the right direction please.


Assorro

Recommended Posts

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.

 

Link to comment
https://forums.phpfreaks.com/topic/229207-xml-point-in-the-right-direction-please/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.