标题: [问题求助] [已解决]powershell 中 getElementById不起作用 [打印本页]
作者: yiwuyun 时间: 2017-4-10 12:36 标题: [已解决]powershell 中 getElementById不起作用
本帖最后由 yiwuyun 于 2017-4-10 14:01 编辑
- if ($true){}# == ($true){}# goto ___yiwuyun
- <#BeginBatOperation#
- :___yiwuyun
- @echo off&setlocal&cls
- (echo $yiwuyun_fileName="%~f0"&echo $strPath="%~dp0"&type "%~f0")|powershell -command -
- pause
- exit/b 0
- #EndBatOperation#>
-
- <#StartPowerShell#>
- $xml=@"
- <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
- <root>
- <bat001 name="bat1" id="bat1">
- data
- </bat001>
- </root>
- "@
- $doc=New-Object -TypeName System.Xml.XmlDocument;
- $doc.LoadXml($xml);
- ###$doc.GetElementById("bat1"); 这一句不起作用
- $doc.GetElementsByTagName("bat001");### 这一句正常
-
- <#EndPowerShell#>
复制代码
有朋友遇到过吗?不会是我写法错了吧。
作者: pcl_test 时间: 2017-4-10 12:56
https://msdn.microsoft.com/en-us ... getelementbyid.aspx- Note
- The DOM implementation must have information which defines which attributes are of type ID. Although attributes of type ID can be defined in either XSD schemas or DTDs, this version of the product only supports those defined in DTDs. Attributes with the name "ID" are not of type ID unless so defined in the DTD. Implementations where it is unknown whether the attributes are of type ID are expected to return null.
复制代码
作者: yiwuyun 时间: 2017-4-10 14:00
many thanks.
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |