I have an XML file that looks like this:
<Student_x0020_Query>
<HUSID>1234567891234</HUSID>
<OWNSTU>00012345</OWNSTU>
<BIRTHDTE>2000-12-27T00:00:00</BIRTHDTE>
<FNAMES>John</FNAMES>
<SURNAME>Smith</SURNAME>
<ID>21</ID>
<Instance_NUMHUS>00012345</Instance_NUMHUS>
<COMDATE>2021-10-01T00:00:00</COMDATE>
<ENDDATE>2022-09-30T00:00:00</ENDDATE>
<SPLENGTH>3</SPLENGTH>
<UNITLGTH>1</UNITLGTH>
<EntryProfile_NUMHUS>00012345</EntryProfile_NUMHUS>
<DOMICILE>England</DOMICILE>
<POSTCODE>AA1 1AA</POSTCODE>
<StudentEquality_NUMHUS>00060735</StudentEquality_NUMHUS>
<DISABLE>00</DISABLE>
<ETHNIC>01</ETHNIC>
<GENDERID>01</GENDERID>
<NATION>GB</NATION>
<RELBLF>01</RELBLF>
<SEXID>01</SEXID>
<SEXORT>04</SEXORT>
</Student_x0020_Query>
This is simply one of many of the 'Student' element in the XML file--there are thousands of them.
I need to do one of a few things to this data.
- Firstly, I need to separate out some of the data within the 'Student' element, and make it into its own element as a child of 'Student'. So, for example, the line that reads, '<Instance_NUMHUS>00012345</Instance_NUMHUS>'--I want to make that, and the 4 lines below it, a child element of 'Student'.
- Secondly, I need to be able to remove certain attributes/lines from elements.
- Thirdly, I need to be able to do both of the above en masse. I need to apply one of the two things above to every 'Student' element, for example. So when I make '<Instance_NUMHUS>00012345</Instance_NUMHUS>' and the 4 lines below it its own element, I need the same thing to happen to every element.
If you can help me, I am really begging you to help me.
Thank you.