【发布时间】:2011-11-17 15:55:29
【问题描述】:
不久前,我向question 询问了有关在 MSXML 中使用命名空间的问题。起初,我用 XPath *[local-name()]-hack 绕过了整个事情(请参阅我以前的帖子),但由于良心危机,我决定以正确的方式做事。 (呸!)
考虑以下 XML:
<?xml version="1.0" encoding="UTF-8"?>
<Root xsi:schemaLocation="http://www.foo.bar mySchema.xsd" xmlns="http://www.foo.bar" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MyElement>
</MyElement>
</Root>
当我尝试使用 IXMLDOMDocument3.setProperty('SelectionNamespaces', NSString); 添加这些命名空间时,我收到以下错误:“SelectionNamespaces 属性值无效。只允许格式正确的 xmlns 属性。”。删除命名空间xsi:schemaLocation="http://www.foo.bar mySchema.xsd" 时,一切运行顺利。我在这里做错了什么? XML 中有错误吗?是 MSXML 的错吗?
【问题讨论】:
标签: namespaces msxml