I have an exctiing xml file which has id’s 1 – 20 when I create a new xml file I need it to add the ID to the file how can I do this ?
I know how you would do it with SQL but not with xml
please help
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
if your xml is already ordered from lowest to highest, you can do this xpath query:
otherwise, you can find the max id like so (assuming id is an attribute):
the above prints “3”, so your new id is 4
or use Veger’s solution which will also work