Ce contenu n'est pas disponible dans la langue sélectionnée.
2.32. Configuring YAML Streams
Procedure 2.1. Task
- Configure your reader to process YAML files as shown:
<?xml version="1.0"?> <smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:yaml="http://www.milyn.org/xsd/smooks/yaml-1.4.xsd"> <yaml:reader/> </smooks-resource-list>
- Configure the YAML stream to contain multiple documents. The reader handles this by adding a document element as a child of the root element. An XML-serialized YAML stream with one empty YAML document looks like this:
<yaml> <document> </document> </yaml>
- Configure Smooks programmatically to read a YAML configuration by exploiting the
YamlReaderConfigurator
class:Smooks smooks = new Smooks(); smooks.setReaderConfig(new YamlReaderConfigurator() .setRootName("root") .setDocumentName("doc") .setArrayElementName("e")) .setAliasStrategy(AliasStrategy.REFER_RESOLVE) .setAnchorAttributeName("anchor") .setAliasAttributeName("alias"); // Use Smooks as normal...