Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Man schemaVersion="1">
  3. <version>2.2</version>
  4. <file>
  5. <properties>
  6. </properties>
  7. <group>
  8. <properties>
  9. ...
  10. </properties>
  11. </group>
  12. <group>
  13. <properties>
  14. </properties>
  15. <group>
  16. <properties>
  17. <items>
  18. <name>test</name>
  19. <description>A test</description>
  20. </items>
  21. </properties>
  22. </group>
  23. <group>
  24. <properties>
  25. <items>
  26. <name>test2</name>
  27. <description>A test field again</description>
  28. </items>
  29. </properties>
  30. </group>
  31. </group>
  32. </file>
  33. </Man>
  34.  
  35. <group>
  36. <properties>
  37. <items>
  38. <name>test3</name>
  39. <description>one more field</description>
  40. </items>
  41. </properties>
  42. </group>
  43.  
  44. <group>
  45. <properties>
  46. <items>
  47. <name>test</name>
  48. <description>A test</description>
  49. </items>
  50. </properties>
  51. </group>
  52. <group>
  53. <properties>
  54. <items>
  55. <name>test2</name>
  56. <description>A test field again</description>
  57. </items>
  58. </properties>
  59. </group>
  60. <group>
  61. <properties>
  62. <items>
  63. <name>test3</name>
  64. <description>one more field</description>
  65. </items>
  66. </properties>
  67. </group>
  68.  
  69. $strXMLfile="c:blablabla.xml";
  70. $xml=get-content $strXMLfile;
  71. $xmlRoot=$xml.get_DocumentElement();
  72. $xmlnode=$xmlRoot.file.group;
  73. $group=0;
  74. while (!($xmlnode[$group].properties.name -eq "test node")) {
  75. $group++
  76. }
  77. $nodesGroups=$xmlnode[$group].group;
  78. if ($nodesGroups.count -eq $null) {
  79. $intNewGroup=2
  80. }
  81. else {
  82. $intNewGroup=$nodesGroups.count+1
  83. }
  84.  
  85. #Here should be the code for the group,properties,items line creation. Partially
  86.  
  87. $newline=$xml.CreateElement("items")
  88.  
  89. #Here should be the code for the <name>. Not ready yet
  90.  
  91. > $xml = [XML]"<Man>...</Man>"
  92. > $newGrp = $xml.CreateElement("group")
  93. > $newGrp.InnerText = "group 3"
  94. > $xml.Man.file.group.AppendChild($newGrp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement