Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <Man schemaVersion="1">
- <version>2.2</version>
- <file>
- <properties>
- …
- </properties>
- <group>
- <properties>
- ...
- </properties>
- </group>
- <group>
- <properties>
- …
- </properties>
- <group>
- <properties>
- <items>
- <name>test</name>
- <description>A test</description>
- </items>
- </properties>
- </group>
- <group>
- <properties>
- <items>
- <name>test2</name>
- <description>A test field again</description>
- </items>
- </properties>
- </group>
- </group>
- </file>
- </Man>
- <group>
- <properties>
- <items>
- <name>test3</name>
- <description>one more field</description>
- </items>
- </properties>
- </group>
- <group>
- <properties>
- <items>
- <name>test</name>
- <description>A test</description>
- </items>
- </properties>
- </group>
- <group>
- <properties>
- <items>
- <name>test2</name>
- <description>A test field again</description>
- </items>
- </properties>
- </group>
- <group>
- <properties>
- <items>
- <name>test3</name>
- <description>one more field</description>
- </items>
- </properties>
- </group>
- $strXMLfile="c:blablabla.xml";
- $xml=get-content $strXMLfile;
- $xmlRoot=$xml.get_DocumentElement();
- $xmlnode=$xmlRoot.file.group;
- $group=0;
- while (!($xmlnode[$group].properties.name -eq "test node")) {
- $group++
- }
- $nodesGroups=$xmlnode[$group].group;
- if ($nodesGroups.count -eq $null) {
- $intNewGroup=2
- }
- else {
- $intNewGroup=$nodesGroups.count+1
- }
- #Here should be the code for the group,properties,items line creation. Partially
- $newline=$xml.CreateElement("items")
- #Here should be the code for the <name>. Not ready yet
- > $xml = [XML]"<Man>...</Man>"
- > $newGrp = $xml.CreateElement("group")
- > $newGrp.InnerText = "group 3"
- > $xml.Man.file.group.AppendChild($newGrp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement