I’ve got a lot of xml files that look something like this:some text some text an integer ... an integer ... more stuff
There could be no “pref_of_interest” fields or there could be several.
What I need to do is the following:
- If there are no pref_of_interest fields, or there’s already a
pref_of_interest set to the desired value, leave the file untouched.
- If there are prefs_of_interest and none contain the required value,
add a new pref_of_interest element with the required value in.
I have not had much success with hpricot past parsing the file. Can
anyone suggest the proper way to add the new element? Thanks.