小编San*_*tos的帖子

通过powershell将数据附加到现有的xml文件中

我可以帮助使用PowerShell将节点添加到现有XML中吗?

这是我有的:

<agentList>
 <newAgent>
      <name>Justice, Kari</name>
      <mu>4690</mu>
  <agentData>
   <group>
       <description>GROUP_DESCRIPTION</description><value>GROUP_NAME</value>
   </group>
  </agentData>
 </newAgent>
</agentList>
Run Code Online (Sandbox Code Playgroud)

我需要添加这个:

  <group><description>ACSR System Logon</description><value></value></group>
  <group><description>Current Call Type</description><value></value></group>
  <group><description>OMS</description><value></value></group>
  <group><description>RIO Log-in</description><value></value></group>
  <group><description>Site</description><value></value></group>
Run Code Online (Sandbox Code Playgroud)

这里:

<agentList>
 <newAgent>
      <name>Justice, Kari</name>
      <mu>4690</mu>
  <agentData>
   <group>
       <description>GROUP_DESCRIPTION</description><value>GROUP_NAME</value>
           <====== HERE
           <====== HERE
           <====== HERE
           <====== HERE
   </group>
  </agentData>
 </newAgent>
</agentList>
Run Code Online (Sandbox Code Playgroud)

我可能在XML上有多个用户,所以我想使用FOREACH行..但我在powershell中使用xml失去了...如果有人可以分享一些想法,我将很高兴与它一起玩...

xml powershell foreach selectnodes

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

foreach ×1

powershell ×1

selectnodes ×1

xml ×1