Mapping Element
Applies to: SharePoint Server 2010
<Mapping path='XPath' attr='propName' propset='GUID' type='varType' sep-str='separator' post-str='postString' ignore-whitespace='yes|no' strip-tags='yes|no' shallow='yes|no' mode='append|prepend|overwrite' />
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
Attributes
Attribute |
Description |
---|---|
path |
Required. Specifies an XPath to the XML node from which to retrieve content. |
attr |
Specifies the property name of the created crawled property. Required only when the element is not part of a MappingGroup. |
propset |
Optional. Specifies a string representing a hexadecimal propset GUID. Overrides the default property set. Applies only when the element is not part of a MappingGroup. |
type |
Optional. Specifies a variant type specification that overrides the default variant type. Applies only when the element is not part of a MappingGroup element. |
sep-str |
Optional. Specifies the separation string when the path matches more than one XML node. Default: A single space character. |
post-str |
Optional. Specifies a string to append to the extracted content. Default: An empty string. |
ignore-white-space |
Optional. A yes value indicates that consecutive white-space characters are replaced with a single space. A no value indicates no mapping of multiple white spaces. Default: yes |
strip-tags |
Optional. A yes value indicates that child-element tags are stripped from the extracted content. For example, when the path matches an element that contains child elements. A no value indicates that the subelement tags are kept in the extracted content. You should not use no if the crawled property is mapped to a searchable managed property. Default: yes |
shallow |
Optional. A yes value indicates that only text from the matching elements is extracted. A no value indicates that text from all descendant XML elements is extracted also. The following example assumes that the path attribute contains an XPath expression that matches the body element.
When shallow="yes", only Some text and End of body are extracted. When shallow="no", more text is also extracted (together with Some text and End of body) because it is in a descendant subelement of <body>. Default: no |
mode |
Optional. Defines the behavior when another Mapping element or MappingGroup element has mapped content to the same property name. Applies only when the element is not part of a MappingGroup. Default: append |
mode Attribute
Value |
Description |
---|---|
append |
Adds the new content to the end of the existing content. |
prepend |
Adds the new content to the beginning of the existing content. |
overwrite |
Overwrites the existing content. |
Child Elements
None.
Parent Elements
Name |
Description |
---|---|
Specifies a set of mappings from XPath expressions to crawled properties. |
|
Maps the contents of child Mapping elements to a crawled property. |
|
Defines a common base path for contained Mapping, MappingGroup, and SubTree elements. |
Example
The first code section provides sample XML input. The second code section provides an associated XML Mapper configuration that maps title, size, and keywords to the crawled properties mytitle, mysize, and mykeywords.
<Document>
<title>My title</title>
<size>128</size>
<keywords>
<keyword>math</keyword>
<keyword>biology</keyword>
</keywords>
</Document>
<XMLPropertiesCreator>
<propset>d6ee4933-09c4-46e3-a5e4-b3787cb4a090</propset>
<type>31</type>
<XMLMappings>
<Mapping attr="mytitle" path="//title"/>
<Mapping attr="mysize" path="//size" propset="38c35ad5-69ee-4776-886f-95961a73d52d" type="3"/>
<Mapping attr="mykeywords" path="//keyword" sep-str=","/>
</XMLMappings>
</XMLPropertiesCreator>