Change one variables values in large XML file to being incremental beginning at 1



So I have a giant XML file, in the following format:



<?xml version="1.0" encoding="UTF-8"?>
<furnidata>
<roomitemtypes>
<furnitype id="13" classname="shelves_norja">
<revision>49500</revision>
<defaultdir>0</defaultdir>
<xdim>1</xdim>
<ydim>1</ydim>
<partcolors>
<color>#ffffff</color>
<color>#F7EBBC</color>
</partcolors>
<name>Beige Bookcase</name>
<description>For nic naks and books.</description>
<adurl/>
<offerid>1871</offerid>
<buyout>1</buyout>
<rentofferid>-1</rentofferid>
<rentbuyout>0</rentbuyout>
<bc>1</bc>
<excludeddynamic>0</excludeddynamic>
<customparams/>
<specialtype>1</specialtype>
<canstandon>0</canstandon>
<cansiton>0</cansiton>
<canlayon>0</canlayon>
</furnitype>
<furnitype id="14" classname="shelves_polyfon">
<revision>48082</revision>
<defaultdir>0</defaultdir>
<xdim>2</xdim>
<ydim>1</ydim>
<partcolors>
<color>0</color>
<color>0</color>
<color>0</color>
</partcolors>
<name>Bookcase</name>
<description>Make your books look sleek.</description>
<adurl/>
<offerid>2123</offerid>
<buyout>1</buyout>
<rentofferid>-1</rentofferid>
<rentbuyout>0</rentbuyout>
<bc>1</bc>
<excludeddynamic>0</excludeddynamic>
<customparams/>
<specialtype>1</specialtype>
<canstandon>0</canstandon>
<cansiton>0</cansiton>
<canlayon>0</canlayon>
</furnitype>
</roomitemtypes>
</furnidata>


So theres about 1000 different sets of 'furnitypes' and to keep it simple, I want (from top to bottom), the 'offerid' of each furnitype to start at 1 for the first one at the top, and increase by 1 for every furnitype.


So the first offerid for the first furnitype would be 1, 2 for the second, 3 for the third, and so forth. Right now the offerid's for each furnitype are random numbers.


Theres way too many for me to manually edit them 1 by 1.


No comments:

Post a Comment