找回密码
 注册
搜索
[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
查看: 18074|回复: 2

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

[复制链接]
发表于 2017-4-10 12:36:19 | 显示全部楼层 |阅读模式
本帖最后由 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#>
复制代码
有朋友遇到过吗?不会是我写法错了吧。

评分

参与人数 1PB +2 收起 理由
Batcher + 2 感谢给帖子标题标注[已解决]字样

查看全部评分

发表于 2017-4-10 12:56:19 | 显示全部楼层
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技术 +1 收起 理由
Batcher + 1 乐于助人

查看全部评分

 楼主| 发表于 2017-4-10 14:00:55 | 显示全部楼层
many thanks.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|批处理之家 ( 渝ICP备10000708号 )

GMT+8, 2026-3-16 22:05 , Processed in 0.019107 second(s), 9 queries , File On.

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表