XML格式化程序
Provides various options for formatting and cleaning up XML documents.
Input Ports
Input features that contain the XML document information.
输出端口
如果一个功能被成功格式化,它将通过这个端口输出。
If a feature does not have a well-formed XML document, it will be output through this port.
参数
选择from the list enables that selection's corresponding parameter:
- Attribute with XML Text: Choose the attribute that contains XML Text.
- XML Filename: Browse to the XML file.
格式化选项
选择所需的XML输入格式:
- None:No formatting is performed
- 漂亮的打印XML:XML元素将通过添加缩进和新行进行格式化,以提高可读性。开始标记和结束标记之间的任何空格都将保留。
- Linearize:All XML contents will be put on a single line.
为XML格式选择所需的空白处理:
保留所有空白:all whitespace are considered significant and will be preserved as much as possible
删除多余的空白:excess whitespace will be removed, lines containing only whitespace characters, from the start tag to the first non-whitespace character and from the last non-whitespace character to the end tag.
As defined by xsi:schemaLocation:whitespace in the XML document is either significant or insignificant as defined by the schema in thexsi:schemaLocation属性。
由外部模式定义:whitespace in the XML document is either significant or insignificant as defined by an external schema file.
When enabled, pick an external schema file to be used to determine the significance of whitespace in the XML document.
Specifies the indentation size. The valid values are the numbers 0 to 9, with 1 being the default.
By default the Tab character is used to pretty-print the indentations; set this toYessubstitutes the Tab character with a Space. The size of a single indentation is controlled by the缩进大小parameter.
By default, the text within a tag is left untouched. If this parameter is set toYes, the text will be pretty printed. If a tag contains both a text value element and another nested tag element, the second of either the text value or nested tag will not be pretty printed. The example below shows a block of XML code on the left along with its pretty printed output on the right.
例子 | 漂亮的印刷品 |
---|---|
text value |
text value#text value is the first element |
some value |
some value |
XML Clean-up
When set toYes, this parameter removes all comments within the XML input.
When set toYes, this parameter removes elements that have no attributes and contain no content between the Start and End Tag.
For example,
但会被移除
不会,因为它包含属性。
When set toYes,此参数为在开始标记和结束标记之间没有内容的元素创建空标记。
For example,
will be collapsed into
Remove redundant and extraneous namespace declarations. For example, the following XML document that has redundant namespace declarations:
<根>
选择Yes对于此参数,将返回以下结果:
<根>
When set toYes, this parameter removes all embeddedxsi:schemalocationattribute from all elements that are not the root element.
XML Output
The XML features that have been successfully processed can be output to a feature attribute by specifying an attribute name in theAttribute to contain XML outputparameter, or to a file by specifying the path to the file in theXML输出文件parameter.
指定XML输出的编码。如果未指定,则使用UTF-8。
至少有一个警告或错误的功能将通过失败port with a new list attribute added to the features.
如果默认_xml\u错误是列表名称,列表属性的元素包含以下内容:
Elements of List Attribute | Description |
---|---|
_xml错误{}.type | 警告、错误或致命错误 |
_xml\u错误{}.file | the file where the warning or error occurs |
_xml\错误{}.line | 发生警告或错误的行 |
_xml\u错误{}.col | the column where the warning or error occurs |
_xml\错误{}.desc | the details about the warning or error |
Note:List attributesare not accessible from the output schema in Workbench unless they are first processed using a transformer that operates on them, such asListExploderor列表串联器. 所有列表属性变换器都显示在“变换器帮助”的“内容”窗格中Lists. 或者,AttributeExposer可以使用。
Editing Transformer Parameters
Using a set of menu options, transformer parameters can be assigned by referencing other elements in the workspace. More advanced functions, such as an advanced editor and an arithmetic editor, are also available in some transformers. To access a menu of these options, clickbeside the applicable parameter. For more information, seeTransformer Parameter Menu Options.
Transformer Categories
Search FME Knowledge Center
Search for samples and information about this transformer on theFME知识中心.