Hello friends, I need to parse a complex XML file given below. And I have to get the results like

Head -> All the Labels inside the Head (HashMap<String, TreeSet>)

Label -> Associated Head (HashMap<String, Set>)

<bigmac>

<RECORD id="000103585">
<HEAD>A, a</HEAD>
<SORTKEY>A0000000000</SORTKEY><FLAGS></FLAGS>
<PRON><PRN>e1</PRN><PRN type="say">ay</PRN></PRON>
<BODY><CHUNK>
<POS>noun</POS><INFLECTION><INF number="pl">A's</INF><INF number="pl">As</INF><INF number="pl">a's</INF></INFLECTION>
<DEF id="568"><DTEXT>the first letter of the English alphabet.</DTEXT>
</DEF>
<DEF id="089"><DTEXT>the first in any series.</DTEXT>
</DEF>
<DEF id="380"><DTEXT>the highest mark for school, college, or university work; alpha.</DTEXT>
</DEF>
<DEF id="724"><LABEL>Music</LABEL>
<SUBDEF id="510"><DTEXT>the sixth degree in the scale of C major, or the first in the relative minor scale (A minor).</DTEXT></SUBDEF>
<SUBDEF id="794"><DTEXT>a written or printed note representing this tone.</DTEXT></SUBDEF>
<SUBDEF id="883"><DTEXT>a string, key, or pipe tuned to this note.</DTEXT></SUBDEF>
<SUBDEF id="100"><DTEXT>(in the fixed system of solmisation) the sixth note of the scale, called <I>la</I>.</DTEXT></SUBDEF>
<SUBDEF id="660"><DTEXT>the note to which concert performers tune their instruments; concert A.</DTEXT></SUBDEF>
</DEF>
<DEF id="549"><DTEXT>a series of standard paper sizes, such as A1, A3, etc., being subdivisions of the basic A0 size, 1189 times; 841 mm.</DTEXT>
</DEF></CHUNK><CHUNK>
<POS>phrase</POS>
<DEF id="728"><SUBHEAD>from A to Z</SUBHEAD><DTEXT>from beginning to end.</DTEXT>
</DEF></CHUNK>
</BODY>
</RECORD>

<RECORD id="000098504"><HEAD>a<SUP>1</SUP></HEAD>
<SORTKEY>A0990010100</SORTKEY><FLAGS></FLAGS>
<PRON><PRN>7</PRN><PRN type="SAY">uh</PRN><LABEL>emphatic</LABEL><PRN>e1</PRN><PRN type="SAY">ay</PRN></PRON>
<BODY><CHUNK>
<POS>adjective or indefinite article</POS>
<DEFPREFIX>a word used especially before nouns beginning with a consonant sound to mean:</DEFPREFIX>
<DEF id="478"><DTEXT>some (indefinite singular referring to one individual of a class)</DTEXT><IP>a child</IP><IP>a house</IP><IP>a star.</IP>
</DEF>
<DEF id="110"><DTEXT>another</DTEXT><IP>he is a Cicero in eloquence.</IP>
</DEF>
<DEF id="620"><DTEXT>one</DTEXT><IP>two of a kind</IP><IP>a thousand.</IP>
</DEF>
<DEF id="164"><DTEXT>any (a single)</DTEXT><IP>not a one.</IP>
</DEF>
<DEF id="808"><DTEXT>indefinite plural</DTEXT><IP>a few</IP><IP>a great many.</IP>
</DEF></CHUNK><VARIANTS><VARPREFIX>before a vowel sound</VARPREFIX><VAR>an</VAR></VARIANTS>
</BODY><WRDETY><LANG>Middle English</LANG>, phonetic <LANG>variant</LANG> of <LINK>
<DESTHEAD recid="000099534">an<SUP>1</SUP></DESTHEAD></LINK></WRDETY> <USAGE type="LANGUAGE">The variant <I>an</I> is used before a vowel, as in <I>an address</I>, <I>an umbrella</I>. Pronunciation rather than spelling is the criterion: for example words like <I>hour</I> and <I>honour</I> have <I>an</I> before them because the initial <I>h</I> is not pronounced, while words like <I>union</I> and <I>user</I> take <I>a</I> because they are pronounced as if beginning with an initial <I>y</I> consonant. A few words with initial <I>h</I> are variable: most speakers pronounce an initial <I>h</I> in <I>historical</I> (<I>a historical survey</I>), some do not (<I>an historical survey</I>).</USAGE>
</RECORD>