This topic contains 4 replies, has 3 voices, and was last updated by
November 7, 2018 at 1:29 am #122349
for openers, how do I post sample xml to this forum? the "pre" stuff isn't working for me.
November 7, 2018 at 4:24 am #122382
November 7, 2018 at 9:29 pm #122585
so here is some xml. it's an RDG file from microsoft's Remote Desktop Connection Manager.
assume $xml = [xml](get-content testrdg.rdg)
$xml.rdcman.file.group.server.name returns "testserver".
$xml.selectnode("//rdcman/file/group/server/name") returns nothing
$xml | select-xml -XPath "//rdcman/file/server/properties/name" returns nothing
I've read that this has to do with "namespace," and I have to define a namespace. but I don't see a namespace defined in that xml, so I don't know how to decide what namespace to tell powershell to use.
November 9, 2018 at 5:26 pm #123252
November 9, 2018 at 5:53 pm #123285ParticipantTopics: 0Replies: 22Points: 975Rank: Major Contributor
XPath is case-sensitive.
Using your example XML, these work.
Select-Xml -Xml $xml -XPath "//RDCMan/file/group/server/properties/name" $xml.SelectNodes("//RDCMan/file/group/server/properties/name")
The topic ‘select-xml’ is closed to new replies.