[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[问题求助] [已解决]powershell 中 getElementById不起作用

本帖最后由 yiwuyun 于 2017-4-10 14:01 编辑
  1. if ($true){}# == ($true){}# goto ___yiwuyun
  2. <#BeginBatOperation#
  3. :___yiwuyun
  4. @echo off&setlocal&cls
  5. (echo $yiwuyun_fileName="%~f0"&echo $strPath="%~dp0"&type "%~f0")|powershell -command -
  6. pause
  7. exit/b 0
  8. #EndBatOperation#>
  9. <#StartPowerShell#>
  10. $xml=@"
  11. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  12. <root>
  13. <bat001 name="bat1" id="bat1">
  14. data
  15. </bat001>
  16. </root>
  17. "@
  18. $doc=New-Object -TypeName System.Xml.XmlDocument;
  19. $doc.LoadXml($xml);
  20. ###$doc.GetElementById("bat1");  这一句不起作用
  21. $doc.GetElementsByTagName("bat001");### 这一句正常
  22. <#EndPowerShell#>
复制代码
有朋友遇到过吗?不会是我写法错了吧。
1

评分人数

    • Batcher: 感谢给帖子标题标注[已解决]字样PB + 2

https://msdn.microsoft.com/en-us ... getelementbyid.aspx
  1. Note
  2. 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.
复制代码
1

评分人数

TOP

many thanks.

TOP

返回列表