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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.