gpt4 book ai didi

org.milyn.yaml.YamlReader类的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 09:21:31 26 4
gpt4 key购买 nike

本文整理了Java中org.milyn.yaml.YamlReader类的一些代码示例,展示了YamlReader类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlReader类的具体详情如下:
包路径:org.milyn.yaml.YamlReader
类名称:YamlReader

YamlReader介绍

[英]YAML to SAX event reader.

This YAML Reader can be plugged into Smooks in order to convert a YAML based message stream into a stream of SAX events to be consumed by the other Smooks resources.

Configuration

<resource-config selector="org.xml.sax.driver"> 
<resource>org.milyn.yaml.YamlReader</resource> 
<!-- 
(Optional) The element name of the SAX document root. Default of 'yaml'. 
--> 
<param name="rootName"><root-name></param> 
<!-- 
(Optional) The element name of a array element. Default of 'element'. 
--> 
<param name="arrayElementName"><array-element-name></param> 
<!-- 
(Optional) The replacement string for YAML NULL values. Default is an empty string. 
--> 
<param name="nullValueReplacement"><null-value-replacement></param> 
<!-- 
(Optional) The replacement character for whitespaces in a YAML map key. By default this not defined, so that the reader doesn't search for whitespaces. 
--> 
<param name="keyWhitspaceReplacement"><key-whitspace-replacement></param> 
<!-- 
(Optional) The prefix character to add if the YAML node name starts with a number. By default this is not defined, so that the reader doesn't search for element names that start with a number. 
--> 
<param name="keyPrefixOnNumeric"><key-prefix-on-numeric></param> 
<!-- 
(Optional) If illegal characters are encountered in a YAML element name then they are replaced with this value. By default this is not defined, so that the reader doesn't doesn't search for illegal characters. 
--> 
<param name="illegalElementNameCharReplacement"><illegal-element-name-char-replacement></param> 
<!-- 
(Optional) Defines a map of keys and there replacement. The from key will be replaced with the to key or the contents of the element. 
--> 
<param name="keyMap"> 
<key from="fromKey" to="toKey" /> 
<key from="fromKey"><to></key> 
</param> 
<!-- 
(Optional) The strategy how to handle YAML anchors and aliases. Possible values: 
- REFER: Adds a 'id' attribute to the element with the anchor and the 'ref' attribute to the elements with the alias. 
The value of these attributes is the name of the anchor. The reference needs to be handled within the Smooks config. 
The attribute names can be set via the 'anchorAttributeName' and 'aliasAttributeName' properties 
- RESOLVE: The elements or value from the anchor are resolved (copied) under the element with the alias. 
Smooks doesn't see that there was a reference. 
- REFER_RESOLVE: A combination of REFER and RESOLVE. The element of the anchor are resolved and the attributes are set. 
You should use this if you want to resolve the element but also need the alias name because it has a 
business meaning. 
Default: 'REFER' 
--> 
<param name="aliasStrategy"><alias-strategy></param> 
<!-- 
(Optional) The name of the anchor attribute when the aliasStrategy is REFER or REFER_RESOLVER. Default of 'id' 
--> 
<param name="anchorAttributeName"><anchor-attribute-name></param> 
<!-- 
(Optional) The name of the alias attribute when the aliasStrategy is REFER or REFER_RESOLVER. Default of 'ref' 
--> 
<param name="aliasAttributeName"><alias-attribute-name></param> 
</resource-config>

[中]YAML到SAX事件读取器。
这个YAML读取器可以插入Smooks,以便将基于YAML的消息流转换为SAX事件流,供其他Smooks资源使用。
####配置

<resource-config selector="org.xml.sax.driver"> 
<resource>org.milyn.yaml.YamlReader</resource> 
<!-- 
(Optional) The element name of the SAX document root. Default of 'yaml'. 
--> 
<param name="rootName"><root-name></param> 
<!-- 
(Optional) The element name of a array element. Default of 'element'. 
--> 
<param name="arrayElementName"><array-element-name></param> 
<!-- 
(Optional) The replacement string for YAML NULL values. Default is an empty string. 
--> 
<param name="nullValueReplacement"><null-value-replacement></param> 
<!-- 
(Optional) The replacement character for whitespaces in a YAML map key. By default this not defined, so that the reader doesn't search for whitespaces. 
--> 
<param name="keyWhitspaceReplacement"><key-whitspace-replacement></param> 
<!-- 
(Optional) The prefix character to add if the YAML node name starts with a number. By default this is not defined, so that the reader doesn't search for element names that start with a number. 
--> 
<param name="keyPrefixOnNumeric"><key-prefix-on-numeric></param> 
<!-- 
(Optional) If illegal characters are encountered in a YAML element name then they are replaced with this value. By default this is not defined, so that the reader doesn't doesn't search for illegal characters. 
--> 
<param name="illegalElementNameCharReplacement"><illegal-element-name-char-replacement></param> 
<!-- 
(Optional) Defines a map of keys and there replacement. The from key will be replaced with the to key or the contents of the element. 
--> 
<param name="keyMap"> 
<key from="fromKey" to="toKey" /> 
<key from="fromKey"><to></key> 
</param> 
<!-- 
(Optional) The strategy how to handle YAML anchors and aliases. Possible values: 
- REFER: Adds a 'id' attribute to the element with the anchor and the 'ref' attribute to the elements with the alias. 
The value of these attributes is the name of the anchor. The reference needs to be handled within the Smooks config. 
The attribute names can be set via the 'anchorAttributeName' and 'aliasAttributeName' properties 
- RESOLVE: The elements or value from the anchor are resolved (copied) under the element with the alias. 
Smooks doesn't see that there was a reference. 
- REFER_RESOLVE: A combination of REFER and RESOLVE. The element of the anchor are resolved and the attributes are set. 
You should use this if you want to resolve the element but also need the alias name because it has a 
business meaning. 
Default: 'REFER' 
--> 
<param name="aliasStrategy"><alias-strategy></param> 
<!-- 
(Optional) The name of the anchor attribute when the aliasStrategy is REFER or REFER_RESOLVER. Default of 'id' 
--> 
<param name="anchorAttributeName"><anchor-attribute-name></param> 
<!-- 
(Optional) The name of the alias attribute when the aliasStrategy is REFER or REFER_RESOLVER. Default of 'ref' 
--> 
<param name="aliasAttributeName"><alias-attribute-name></param> 
</resource-config>

代码示例

代码示例来源:origin: org.milyn/milyn-smooks-yaml

@Initialize
public void initialize() {
  ElementNameFormatter elementNameFormatter = new ElementNameFormatter(initKeyMap(), keyWhitspaceReplacement, keyPrefixOnNumeric, illegalElementNameCharReplacement);
  yamlEventStreamParser = new YamlEventStreamHandler(elementNameFormatter, documentName, arrayElementName);
}
/*

代码示例来源:origin: smooks/smooks

@Initialize
public void initialize() {
  ElementNameFormatter elementNameFormatter = new ElementNameFormatter(initKeyMap(), keyWhitspaceReplacement, keyPrefixOnNumeric, illegalElementNameCharReplacement);
  yamlEventStreamParser = new YamlEventStreamHandler(elementNameFormatter, documentName, arrayElementName);
}
/*

代码示例来源:origin: org.virtuslab/milyn-smooks-yaml

@Initialize
public void initialize() {
  ElementNameFormatter elementNameFormatter = new ElementNameFormatter(initKeyMap(), keyWhitspaceReplacement, keyPrefixOnNumeric, illegalElementNameCharReplacement);
  yamlEventStreamParser = new YamlEventStreamHandler(elementNameFormatter, documentName, arrayElementName);
}
/*

代码示例来源:origin: org.milyn/milyn-smooks-all

@Initialize
public void initialize() {
  ElementNameFormatter elementNameFormatter = new ElementNameFormatter(initKeyMap(), keyWhitspaceReplacement, keyPrefixOnNumeric, illegalElementNameCharReplacement);
  yamlEventStreamParser = new YamlEventStreamHandler(elementNameFormatter, documentName, arrayElementName);
}
/*

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com