public class YamlReader extends Object implements SmooksXMLReader
<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>
Modifier and Type | Field and Description |
---|---|
static String |
CONFIG_PARAM_KEY_MAP |
static String |
DEFAULT_ALIAS_NAME |
static String |
DEFAULT_ANCHOR_NAME |
static String |
XML_ARRAY_ELEMENT_NAME |
static String |
XML_DOCUMENT |
static String |
XML_ROOT |
Constructor and Description |
---|
YamlReader() |
public static final String CONFIG_PARAM_KEY_MAP
public static final String XML_ROOT
public static final String XML_DOCUMENT
public static final String XML_ARRAY_ELEMENT_NAME
public static final String DEFAULT_ANCHOR_NAME
public static final String DEFAULT_ALIAS_NAME
@Initialize public void initialize()
public void setExecutionContext(ExecutionContext request)
SmooksXMLReader
ExecutionContext
on the implementing class.setExecutionContext
in interface SmooksXMLReader
request
- The Smooks ExecutionContext
.public void parse(InputSource yamlInputSource) throws IOException, SAXException
parse
in interface XMLReader
IOException
SAXException
public void setContentHandler(ContentHandler contentHandler)
setContentHandler
in interface XMLReader
public ContentHandler getContentHandler()
getContentHandler
in interface XMLReader
public String getRootName()
public void setRootName(String rootName)
rootName
- the rootName to setpublic String getArrayElementName()
public void setArrayElementName(String arrayElementName)
arrayElementName
- the arrayElementName to setpublic String getKeyWhitspaceReplacement()
public void setKeyWhitspaceReplacement(String keyWhitspaceReplacement)
keyWhitspaceReplacement
- the keyWhitspaceReplacement to setpublic String getKeyPrefixOnNumeric()
public void setKeyPrefixOnNumeric(String keyPrefixOnNumeric)
keyPrefixOnNumeric
- the keyPrefixOnNumeric to setpublic String getIllegalElementNameCharReplacement()
public void setIllegalElementNameCharReplacement(String illegalElementNameCharReplacement)
illegalElementNameCharReplacement
- the illegalElementNameCharReplacement to setpublic void setIndent(boolean indent)
public void parse(String systemId) throws IOException, SAXException
parse
in interface XMLReader
IOException
SAXException
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getFeature
in interface XMLReader
SAXNotRecognizedException
SAXNotSupportedException
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException
setFeature
in interface XMLReader
SAXNotRecognizedException
SAXNotSupportedException
public DTDHandler getDTDHandler()
getDTDHandler
in interface XMLReader
public void setDTDHandler(DTDHandler arg0)
setDTDHandler
in interface XMLReader
public EntityResolver getEntityResolver()
getEntityResolver
in interface XMLReader
public void setEntityResolver(EntityResolver arg0)
setEntityResolver
in interface XMLReader
public ErrorHandler getErrorHandler()
getErrorHandler
in interface XMLReader
public void setErrorHandler(ErrorHandler arg0)
setErrorHandler
in interface XMLReader
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException
getProperty
in interface XMLReader
SAXNotRecognizedException
SAXNotSupportedException
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException
setProperty
in interface XMLReader
SAXNotRecognizedException
SAXNotSupportedException
Copyright © 2020. All rights reserved.