I'm writing a script that will eventually clean up an XML file used by a user access provisioning system at work, based on what items are parsed in to be removed. The XML document has a various levels of child/parent nodes as below:
<Enterprise>
<Channel name="a">
<busunit name="one">
<dept name="x">
<role name ="role1">
<role name="role2">
</dept>
<dept name="y">
<dept name="z">
</busunit >
<busunit name="two">
<busunit name="three">
</Channel>
<Channel name="b" >
<Channel name="c">
</Enterprise>
What I'm wanting to do is read the document and group items based on their parents, but I'm struggling to come up with a solid way of doing this because of the various node levels.
I've made a start at using a series of lists for each channel that stores a list of business units, that stores a list of departments that finally stores a list of roles (essentially a multi-dimensional list) but I'm thinking this could get terribly hard to follow quite quickly and a nightmare to debug.
A few other things to note:
Hopefully this isn't to vague to understand but what I'm wanting to know in a nutshell is: What other alternatives do I have at my disposal other than multi-dimensional lists to group+store multiple parent/child nodes?
Thanks in advance!
答案 0 :(得分:1)
尝试将数据放入数据表中,以便于删除
RandomAccessFile