I have the following XML document:
<database name="pressPlay">
<table name="users">
<column name="userID" type="INT" constraints="tableID_c" />
<column name="username" type="VARCHAR(50)" constraints="user_c" />
<column name="password" type="VARCHAR(50)" constraints="not_null_c" />
</table>
<table name="song">
<column name="songID" type="INT" constraints="tableID_c" />
<column name="albumID" type="INT" constraints="albumFK_c" />
<column name="artistID" type="INT" constraints="artistFK_c" />
<column name="songName" type="VARCHAR(50)" constraints="not_null_c" />
<column name="songDuration" type="VARCHAR(5)" constraints="not_null_c" />
<column name="link" type="VARCHAR(100)" />
</table>
<table name="album">
<column name="albumID" type="INT" constraints="tableID_c" />
<column name="albumName" type="VARCHAR(50)" constraints="not_null_c" />
<column name="albumGener" type="VARCHAR(50)" constraints="not_null_c" />
</table>
<table name="artist">
<column name="artistID" type="INT" constraints="tableID_c" />
<column name="artistName" type="VARCHAR(50)" constraints="not_null_c" />
</table>
<constraints>
<constraint name="tableID_c" type="unique" content="not_null" increment="auto"/>
<constraint name="user_c" type="unique" content="not_null"/>
<constraint name="not_null_c" content="not_null"/>
<constraint name="albumFK_c" type="forign_key" content="not_null" columns="album.albumID" />
<constraint name="artistFK_c" type="forign_key" content="not_null" columns="artist.artistID" />
</constraints>
</database>
now what i need is to get attributes from nodes that share a parent with a specific name attribute.
I tried to useXmlNodeList but that gives me all the nodes named column regardless of what the parents name is, i.e:
i need the name attributes from column nodes, with the parent name being users.
anyone know how to do this? i’ve been busting my head for a while now..
something Like that :
this will give you :
Now you can walk through each and take its attribute.