I'm writing a simple program that selects user data based on attributes so I can learn more about programming.
My problem is selecting children based on attributes. Take this example:
<?xml version="1.0" standalone=no> <user attribute="1234"> <data>ect.</data> </user>
<user attribute="5678"> <data>example data</data> </user>
I want to be able to select a <user> based on what the attribute equals. Anyone know how to do this?
EDIT LAST MESSAGE:
After looking for the forums again for an answer, I realized that there can only be one root node.
The example should look like this: <!xml version="1.0" standalone=no> <root>
<user attribute="1234"> <data>ect.</data> </user>
</root>
I think you can traverse all the nodes and check if the attribute of it equals to the attribute you designate.
Ahhh... Good idea - I'll do that, thank you.
Log in to post a comment.
I'm writing a simple program that selects user data based on attributes so I can learn more about programming.
My problem is selecting children based on attributes. Take this example:
<?xml version="1.0" standalone=no>
<user attribute="1234">
<data>ect.</data>
</user>
<user attribute="5678">
<data>example data</data>
</user>
I want to be able to select a <user> based on what the attribute equals. Anyone know how to do this?
EDIT LAST MESSAGE:
After looking for the forums again for an answer, I realized that there can only be one root node.
The example should look like this:
<!xml version="1.0" standalone=no>
<root>
<user attribute="1234">
<data>ect.</data>
</user>
<user attribute="5678">
<data>example data</data>
</user>
</root>
I think you can traverse all the nodes and check if the attribute of it equals to the attribute you designate.
Ahhh... Good idea - I'll do that, thank you.