Is there a simple way to write to an existing XML file, but not to the end of it? Below is the XML I have, and I want to add a new <user></user>. But, I want that user in the <users></users> block. Everything I have been doing so far is putting the new element after the <groups></groups> block.
Code:<?xml version="1.0" encoding="utf-8" ?> <security> <users> <user name="EmployeeA" active="True"> <first>Employee</first> <last>A</last> <email>[email protected]</email> <address>1234 Here St.</address> <city>Mesa</city> <state>AZ</state> <zip>85205</zip> </user> <user name="EmployeeB" active="False"></user> <user name="ClientA" active="True"></user> <user name="ClientB" active="True"></user> </users> <groups> <group name="Employees" description="Default Group to hold all users that are employees"> <user>EmployeeA</user> <user>EmployeeB</user> </group> <group name="Clients" description="Default Group to hold all users that are clients"> <user>ClientA</user> <user>ClientB</user> </group> <group name="AllNonAdminUsers" description="Group containing all users that are not administrators"> <group>Employees</group> <group>Clients</group> </group> </groups> </security>




I drink to make other people more interesting!
Reply With Quote