开发者

Problem with dash symbol in powershell

开发者 https://www.devze.com 2023-01-05 17:31 出处:网络
I want to use dash symbol in xml node name but when i try to get that node it says something about unexpect开发者_JAVA百科ed token.

I want to use dash symbol in xml node name but when i try to get that node it says something about unexpect开发者_JAVA百科ed token.

<hudson.scm.SubversionSCM_-ModuleLocation>
<remote>svn://svn.something.ru/testlib/trunk/SOAPUI/pmplatform/email</remote> 
</hudson.scm.SubversionSCM_-ModuleLocation>

$xmlone = New-Object XML
$xmlone.Load($scriptRoot+"\config.xml")
$xmlone.project.scm.locations.hudson.scm.SubversionSCM_-ModuleLocation


Try quoting the name that has dashes in it:

PS > $xml = [xml]'<root><dash-it-all>text</dash-it-all></root>'
PS > $xml.root.'dash-it-all'
0

精彩评论

暂无评论...
验证码 换一张
取 消