Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

[resolved]Get nodes from xml just not working with powershell

$
0
0

Hey guys,

I'm kind of new to powershell, but worked through everything (and I mean everything :) that I found on Google, but nothing helped. The problem is:

I am getting a xml with directory-listing from webdav, but can't work out to separate the value of the <D:href>-tag.

The code i send:

 $Doc =   [xml]($xmlReturn)
 $ns = New-Object Xml.XmlNamespaceManager $Doc.NameTable
 $ns.AddNamespace( "D", "DAV" )
 $nodelist = $Doc.SelectNodes("//Multistatus/response", $ns)

and the answer I am getting is:

<?xml version="1.0" encoding="utf-8"?><D:multistatus xmlns:D="DAV:"><D:response><D:href>
      http://what-ever.com</D:href><D:propstat><D:status>HTTP/1.1 200 OK</D:status><D:prop><D:getcontenttype/><D:getlastmodified="">
          Fri, 16 Nov 2012 13:29:12 GMT</D:getlastmodified><D:lockdiscovery/><D:ishidden>0</D:ishidden><D:supportedlock/><D:getetag=""/><D:displayname>SAVE</D:displayname><D:getcontentlanguage/><D:getcontentlength>0</D:getcontentlength><D:iscollection="">
          1</D:iscollection><D:creationdate>2012-11-16T13:29:05.136Z</D:creationdate><D:resourcetype><D:collection/></D:resourcetype></D:prop></D:propstat></D:response>
....</D:multistatus>

I need to get the value https //what-ever com. This is just one of a few ways I tried, but nothing worked. Anybody knows help?

Many thanks in advance and best regards,

Daniel



Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>