<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Powershell: Working with XML part 2</title>
	<atom:link href="http://www.thomasmaurer.ch/2010/07/powershell-working-with-xml-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thomasmaurer.ch/2010/07/powershell-working-with-xml-part-2/</link>
	<description>Just another private cloud weblog</description>
	<lastBuildDate>Wed, 08 Feb 2012 17:41:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Nico de Jong</title>
		<link>http://www.thomasmaurer.ch/2010/07/powershell-working-with-xml-part-2/comment-page-1/#comment-3558</link>
		<dc:creator>Nico de Jong</dc:creator>
		<pubDate>Tue, 29 Nov 2011 10:21:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.thomasmaurer.ch/?p=863#comment-3558</guid>
		<description>I&#039;m searching but can find my answer - read this article still not clear. Problem is the following

I have a an XML file with







I want to loop through the scope rules and put the value from the xml into a variable.
I already put a reference to the xml file in $xmlData with Get-Content cmdlet.

$xmlData.ContentSourcesScopesRules.ScopeRules.Rule &#124; 
    ForEach-Object{ 
    $ScopeName=$_.ScopeName
    $contentSourceName=$_.ContentSourceName

When debugging I see the value of $_.ScopeName in the popup in Powershell ISE but when I then use the $ScopeName variable in another cmdlet it is empty.

Do you have any idea how to get the xml value into a variable as a string? I tried some strongtyping of the variables but may some casting is needed... 

Thanks for any feedback - I know it is maybe better to ask in a forum ..</description>
		<content:encoded><![CDATA[<p>I&#8217;m searching but can find my answer &#8211; read this article still not clear. Problem is the following</p>
<p>I have a an XML file with</p>
<p>I want to loop through the scope rules and put the value from the xml into a variable.<br />
I already put a reference to the xml file in $xmlData with Get-Content cmdlet.</p>
<p>$xmlData.ContentSourcesScopesRules.ScopeRules.Rule |<br />
    ForEach-Object{<br />
    $ScopeName=$_.ScopeName<br />
    $contentSourceName=$_.ContentSourceName</p>
<p>When debugging I see the value of $_.ScopeName in the popup in Powershell ISE but when I then use the $ScopeName variable in another cmdlet it is empty.</p>
<p>Do you have any idea how to get the xml value into a variable as a string? I tried some strongtyping of the variables but may some casting is needed&#8230; </p>
<p>Thanks for any feedback &#8211; I know it is maybe better to ask in a forum ..</p>
]]></content:encoded>
	</item>
</channel>
</rss>

