in reply to Item Identification in XML Files

Why are you attempting to talk yourself out of a good solution? Stores (both on-line and brick-and-mortar) use unique identifiers for their items. Things like part numbers and ISBN numbers make sure that when you order an item, the store knows exactly what you want. If you expect to have item names that are identical, how will you keep them straight, let alone your script, without a unique identifier?

However, if you insist on not having to set per-item ids, you can simply add an extra id field to each item as you convert it to html to display on your web interface. The item's location in the file(i.e. which number it is) could be the id. When you resubmit your form, you can use this number to make sure you are modifying the correct item. This assumes that only one person changes the file at a time(since adding an item could throw the count off.)

Later

Replies are listed 'Best First'.
Re: Re: Item Identification in XML Files
by Anonymous Monk on Apr 30, 2003 at 05:51 UTC

    So you think doing something like the following would be the best solution?

    <inventory> <item id="1"> <name>item's name</name> <price>item price</price> </item> <item id="2"> <name>item's name</name> <price>item price</price> </item> </inventory>

    If so, which do you think is the best way to go about assigning the numbers. Also do you think the cron job idea is good for reassigning item ids that are currently no longer being used? Or is there a less costly method? Thanks.

      Why do you insist on re-assigning numbers? Do you have a limited supply of them ;--)

        hi, I'll probably end up doing it this way. just one more question -- what do you think is the best way to store the identification numbers? should I just store the current max assigned number in a file? any other ideas? thanks.