Solved

powershell write-xml line

Posted on 2013-11-20
1
730 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Simple Linear Regression
Six Sigma Control Plans

691 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