XMLFlattener
合并为特征的属性的XML元素(一个或多个)的含量。
This transformer provides a quick and easy way to output any content or attributes of an XML element as feature attributes by specifying the element name or path. Optionally, the XML attributes from the ancestors of the specified elements can be fetched as FME attributes as well.
该XMLFlattener目前不支持多个匹配,因此对于新一代的从源XML多种功能,请用XMLFragmenter。
输入端口
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
包含XML文档的信息输入功能。
输出端口
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
每个特征将包含被从XML元素(多个)变平属性。
参数
XML源代码
Selecting from the list enables that selection's corresponding parameter:
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
- XML文件:使XML文件字段。
- XML Attribute: enables the XML Attribute field.
拼合路径
此参数指定哪些元素变平。平化路径是由空格隔开xfMap匹配表达式或每个表达可以在新的一行指定。欲了解更多信息,请参阅FME读/写器手册:XML(可扩展标记语言)读卡器/写> xfMap。
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
直接在文本框中键入或单击浏览按钮来显示编辑或选择Set to Attribute Value挑选含元素表达式的特征属性。
要素路径是由空格隔开xfMap匹配表达式。欲了解更多信息,请参阅FME读/写器手册:XML(可扩展标记语言)读卡器/写> xfMap。
例如:input.xml中
<运送订单>约翰·史密斯 orderperson> <名>奥拉诺德曼名称> <地址> Langgt 23 地址> <市> 4000斯塔万格城市> <国家>挪威国家> SHIPTO> <项目ID = “1” 状态=”待定”> 帝国滑稽 TITLE> <注意>特别版注释> <量> 1 数量> <价格> 10.90 价格> 项目> <项目ID = “2” 状态=”已装船”> <标题>隐藏你的心脏 title> <量> 1 数量> <价格> 9.90 价格> 项目> 运送订单>
This table lists some Flatten Paths xfMap expressions shown in the above example.
“orderperson” | 添加orderperson元素的文本内容转换成orderperson特征属性 |
“运送到” | 添加SHIPTO元素的子元素的文本内容分为以下几个要素的属性:名称,地址,城市和国家。 |
“item[@id=1]” or equivalently |
标题,笔记,数量和价格:这其属性ID等于1,它增加了孩子们的文字内容为特征的属性命名的文件项的元素相匹配。 |
“orderperson SHIPTO <项目ID =‘1’>” | 前面的三个匹配的表达式相结合,每个分离的由换行。 |
自定义属性
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
This parameter can be specified to extract the children of the matched elements as xml fragments.
例如,如果元素匹配是运送到和元素作为XML片段设定为country,则输出特性有一个额外的属性“xml_fragment_country {0}”,其值被设置为“<国家>挪威国家>”
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
该选项按钮可打开XML展平选项对话框。这些选项控制元素的含量是如何作为特征属性进行映射。
默认视图为基本模式,其中包括几个选项中列出:
- 启用压扁被默认选中。
- 忽略特定子元素>子元素忽略:指定应该被忽略匹配的元素(从平铺路径)的儿童。在上面的例子,如果拼合路径是“SHIPTO”,那么如果这个选项设置为“国家城市”,那么这两个国家和城市内容的输出被忽略。
- 跳过空元素:指定空的元素是否应该被映射为空要素属性
- 添加自定义前缀>前缀:指定所有前缀要素属性将从扁平XML结构添加
- 包括XML子位置>属性名称:指定值将成为其父项内的子元素的位置的属性名称。
- 添加ancestor属性>祖先元素(一个或多个):指定其XML属性作为特征在输出属性也将添加平铺路径中的元素的父元素(一个或多个)。
The Advanced button opens the Advanced Editor, which provides additional options for customizing the feature attributes. The functionality of each option is described in the table below. The options here allow customization of the attributes and attribute lists of the matched XML subtree that will be added to FME Features.
Option (with example value) | 描述 | Default Value | 可能的值 |
---|---|---|---|
隔板= “”。 |
该选项的这个值被用作匹配元素的儿童的属性命名的分隔符。 |
句点(。) |
any string |
开放式列表括号=“{” |
Specifies the open list index delimiter brace for the flattened attributes. |
如果没有指定的默认值:{ |
any string |
close-list-brace="}" |
Specifies the close list index delimiter brace for the flattened attributes. |
如果没有指定的默认值:} |
any string |
map-empty-elements="yes" |
如果设置为YES,任何空元素将被添加到所述特征具有空值的属性。否则,属性不会被添加到功能。 |
如果没有指定缺省值:yes |
是|no 可能的值:任何字符串 |
匹配前缀=“属性” |
FME要素属性是否生产该选项控制将与匹配的元素的名称为前缀。 If the value is yes, then both the matched element's attributes and all its children are prefixed If the value is no, then none of the feature attributes are prefixed with matched element's name 如果该值是孩子,那么只有匹配元素的儿童前缀 如果该值是属性,则仅匹配元素的属性前缀。 |
如果没有指定缺省值:yes |
是|没有|儿童|属性 |
匹配的属性=“是” |
如果此选项设置为yes,那么匹配元素的属性被映射为FME要素的属性。否则,匹配元素的属性被忽略。 匹配的前缀选项也可以设置为属性或者是允许属性与所匹配的元素的名称作为前缀。 |
如果没有指定缺省值:yes |
是|no |
匹配-祖先属性=“” |
是否从所述匹配元素的祖先XML属性的选项控制应该被包括作为FME特征属性。 - 'parent' or '1' : XML attributes of the parent of the matched element are added - “祖父母”或“2”:所述匹配元素的祖父母的XML属性被添加 - “根”或“-1”:该文档的根的XML属性被添加 - 任何非负数:由上升从匹配元素x水平的祖先的XML属性被添加。0是匹配元素。 以包括多于一个的祖先,多个值可以由空格隔开。 例如:要想从根,父母和祖父母的属性,我们可以指定 匹配-祖先的属性=“父祖父母根” |
家长|祖父母|根 |
|
基数= “+ {}?” |
This option can be specified as a space separated list of cardinality directives. |
默认值:{?} +(治疗小儿元素的列表,如果有一个以上的名称相同) |
Possible values: Refer to the xfMap section in the XML Reader documentation. |
除外=“” |
The except attribute accepts the same types of expressions as the match or except attribute of a mapping rule. 例如,除了=“父/子{2}”的表述可用于排除所述第二从结构子规则的输出在<父>元素包含<子>元素。 |
任何路径表达式 |
|
structure-prefix="" |
This option can be set to non-empty string that serves as a prefix to every attribute that is generated for a matched element. |
any string |
|
child-position-attribute="" |
当这个选项被设置为非空字符串,每个子元素将产生一个额外的功能属性,其值将是其父项内的子元素的位置。 |
any string |
|
attribute-identifier="" |
XML attributes can be differentiated from leaf elements. By setting this option to a non-empty string, the XML reader will append a prefix to the attributes in the leaf elements. |
所有选项在更详细的示例和说明FME读/写器手动:XML(可扩展标记语言)读/写。
暴露属性
![关闭](http://www.baooytra.com/docs/fme/2017.0/html/FME_Desktop_Documentation/FME_Transformers/Skins/Default/Stylesheets/Images/transparent.gif)
公开任何属性,使他们能够通过其它变压器使用。直接在文本框中键入或单击浏览按钮来显示编辑和添加属性那里。
Editing Transformer Parameters
使用一组菜单选项,变压器参数可以通过引用在工作区中的其它元件来分配。更先进的功能,如高级编辑,算术编辑,也是一些变压器可用。要访问这些选项的菜单,点击适用的参数旁边。欲了解更多信息,请参阅Transformer Parameter Menu Options。
Transformer Categories
搜索FME知识中心
搜索样品和有关该变压器的FME知识中心。