上次修改时间: 2015年3月9日
适用范围: SharePoint Server 2010
<Namespace name='namespaceName' uri='uriName'/>
属性和元素
以下各部分介绍了属性、子元素和父元素。
属性
属性 |
说明 |
|---|---|
name |
必需。一个指定命名空间的前缀名的字符串。 |
uri |
必需。一个指定命名空间的 URI 字符串。 |
子元素
无。
父元素
元素 |
说明 |
|---|---|
指定一组从 XPath 表达式到已爬网属性的映射。 |
示例
以下示例指定默认命名空间和自定义命名空间,以及如何映射这两个命名空间的 XML 内容。第一个代码节提供了示例 XML 输入。第二个代码节提供了一个关联的 XML 映射器配置,该配置可将各个命名空间中的内容映射到不同的已爬网属性。
<root xmlns="http://somewhere.com/someplace" xmlns:custom="http://somewhere.com/anotherplace">
<child>I'm a child</child>
<custom:anotherchild>I'm a child too</custom:anotherchild>
</root>
<XMLMappings>
<Namespace name="default" uri="http://somewhere.com/someplace"/>
<Namespace name="custom" uri="http://somewhere.com/anotherplace"/>
<Mapping attr="child" path="//default:child"/>
<Mapping attr="anotherchild" path="//custom:anotherchild" />
</XMLMappings>