XML#
使用 XML 节点将数据转换为 XML,并将数据转换为其他格式。
¥Use the XML node to convert data from and to XML.
Binary files
如果你的 XML 位于二进制文件中,请先使用 从文件提取 节点将其转换为文本。
¥If your XML is within a binary file, use the Extract from File node to convert it to text first.
节点参数#
¥Node parameters
- 模式:数据转换的源格式和目标格式。
¥Mode: The format the data should be converted from and to.
-
JSON 转 XML:将数据从 JSON 转换为 XML
¥JSON to XML: Converts data from JSON to XML.
-
XML 转 JSON:将 XML 数据转换为 JSON。
¥XML to JSON: Converts data from XML to JSON.
-
属性名称:输入包含要转换的数据的属性名称。
¥Property Name: Enter the name of the property which contains the data to convert.
节点选项#
¥Node options
无论你选择哪种模式,这些选项都可用:
¥These options are available regardless of the Mode you select:
- 属性键:输入用于访问属性的前缀。默认为
$。
¥Attribute Key: Enter the prefix used to access the attributes. Default is $.
- 字符键:输入用于访问字符内容的前缀。默认为
_。
¥Character Key: Enter the prefix used to access the character content. Default is _.
所有其他选项取决于所选模式。
¥All other options depend on the selected Mode.
JSON 转 XML 选项#
¥JSON to XML options
这些选项仅在你选择“JSON 转 XML”模式时显示:
¥These options only appear if you select JSON to XML as the Mode:
- 允许代理字符:设置是否允许使用 Unicode 代理块中的字符(已开启)或不允许(已关闭)。
¥Allow Surrogate Chars: Set whether to allow using characters from the Unicode surrogate blocks (turned on) or not (turned off).
- 单元格数据:设置是否在需要时将文本节点用
<![CDATA[ ... ]]>封装而不是转义(开启)或不使用(关闭)。
¥Cdata: Set whether to wrap text nodes in <![CDATA[ ... ]]> instead of escaping when it's required (turned on) or not (turned off).
-
如果不需要,启用此选项将不会添加
<![CDATA[ ... ]]>。¥Turning this option on doesn't add
<![CDATA[ ... ]]>if it's not required. -
无头:设置是否省略 XML 标头(启用)或包含 XML 标头(禁用)。
¥Headless: Set whether to omit the XML header (turned on) or include it (turned off).
- 根名称:输入要使用的根元素名称。
¥Root Name: Enter the root element name to use.
XML 转 JSON 选项#
¥XML to JSON options
这些选项仅在你选择“XML 转 JSON”模式时显示:
¥These options only appear if you select XML to JSON as the Mode:
- 显式数组:设置是否将子节点放入数组(启用)或仅当子节点数量超过一个时才创建数组(禁用)。
¥Explicit Array: Set whether to put child nodes in an array (turned on) or create an array only if there's more than one child node (turned off).
- 显式根:设置是否获取结果对象中的根节点(已开启)或不获取(已关闭)。
¥Explicit Root: Set whether to get the root node in the resulting object (turned on) or not (turned off).
- 忽略属性:设置是否忽略所有 XML 属性,仅创建文本节点(已启用)或不忽略(已禁用)。
¥Ignore Attributes: Set whether to ignore all XML attributes and only create text nodes (turned on) or not (turned off).
- 合并属性:设置是否将属性和子元素合并为父元素的属性(已启用)或合并为子属性对象的键属性(已禁用)。如果启用了“忽略属性”,则此选项将被忽略。
¥Merge Attributes: Set whether to merge attributes and child elements as properties of the parent (turned on) or key attributes off a child attribute object (turned off). This option is ignored if Ignore Attribute is turned on.
- 规范化:设置是否去除文本节点内的空格(开启)或不去除(关闭)。
¥Normalize: Set whether to trim whitespaces inside the text nodes (turned on) or not to trim them (turned off).
- 规范化标签:设置是否将所有标签名称规范化为小写(已启用)或保持标签名称不变(已禁用)。
¥Normalize Tags: Set whether to normalize all tag names to lowercase (turned on) or keep tag names as-is (turned off).
- 修剪:设置是否去除文本节点开头和结尾的空格(启用)或保留空格(禁用)。
¥Trim: Set whether to trim the whitespace at the beginning and end of text nodes (turned on) or to leave the whitespace as-is (turned off).
模板和示例#
¥Templates and examples