?
Solved

powershell write-xml line

Posted on 2013-11-20
1
Medium Priority
?
742 Views
Last Modified: 2013-11-20
I have to recreate an xml file to import into a program.  The line I am having problems recreating looks like this
<Type xmlns="http://www.microsoft.com/provisioning/EapCommon">11</Type>

I can write the element type and add the xmlns attrbuite but I don't know how to add the value and then close the element.  The closes I have gotten is

<Type xmlns="http://www.microsoft.com/provisioning/EapCommon"/>

using this code
$xmlWriter.WriteElementString('Type')                                    $XmlWriter.WriteAttributeString('xmlns',"http://www.microsoft.com/provisioning/EapCommon")

What do I need to do to get the lines to match

Thanks

Dan
0
Comment
Question by:DanDWolff
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
DanDWolff earned 0 total points
ID: 39663096
Figured it out, thought I would post the code in case anybody else runs into this problem

$XmlWriter.WriteStartElement("Type")
$XmlWriter.WriteAttributeString('xmlns',"http://www.microsoft.com/provisioning/EapCommon")
$XmlWriter.WriteString("25")
$XmlWriter.WriteEndElement()

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
Simple Linear Regression
Six Sigma Control Plans

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question