Hi all,

the init.xml file has among its lines, one line as <guid>5934</guid>

init.xml
-------------------
-------------------
<guid>5934</guid>
-------------------
------------------

I need to increment the guid every time I modify the file. Could any one please tell me how to do that.

Regards,
Prashanth

Edited 3 Years Ago by mike_2000_17: Fixed formatting

You can use Regular Expressions.
Search the file for that pattern, get the "guid" number, increment it by one, then write it.
I haven't done regex in a while, so I'm not sure about the syntax.

Well, the first thing is that [URL="http://dirtsimple.org/2004/12/python-is-not-java.html"]"XML is not the answer"[/URL]. If you need to allow people to edit the file by hand; or if you are supporting an existing system, then maybe. Otherwise, I strongly suggest you use something else (pickle file? Python format config file?, simple ini type layout?).

Assuming you are stuck with this, I would either use an xml parser or a regular expression to find and replace the guid value. Be aware that since this is a text file, users [B]can[/B] hand edit it, so you cannot count on the exact format (there might be an added or missing line break, extra white space, comments ...)

Edited 3 Years Ago by Nick Evan: Fixed formatting

This question has already been answered. Start a new discussion instead.