/build/static/layout/Breadcrumb_cap_w.png
04/18/2017 1065 views
I'm looking to edit an XML is Powershell.
I've been racking my head for a couple of days, and i can get close, but can't quite get done what i need.

This is what i have in the XML:

  -ConfigData xmlns="http://xml.avaya.com/endpointAPI">
  -version>1
  -parameter>
    -name>Language
    -value>en
      -/parameter>
  -parameter>
    -name>Server1
    -value>1.1.1.1
      -/parameter>
 -/ConfigData>

This is what i need:
 -ConfigData xmlns="http://xml.avaya.com/endpointAPI">
  -version>1
  -parameter>
    -name>Language
    -value>en
      -/parameter>
  -parameter>
    -name>Server1
    -value>1.1.1.1
      -/parameter>
  -parameter>
    -name>Sever2
    -value>1.1.1.2
      -/parameter>
 -/ConfigData>


Not sure how to get around this one.
My hang up seems to be releated to the duplication of the same element with no true Root Element.
Any help will be greatly appreciated.
0 Comments   [ + ] Show comments

Comments


All Answers

1
You could use the Microsoft XML object model, 'Microsoft.XMLDOM' and its 'createElement' method.

I use an edited version of John McFadyen's XML class, IpXMLClass.vbs. Clearly, it's in VBS but you should be able to munge its functions into Powershell.
Answered 04/19/2017 by: VBScab
Red Belt