Skip to content

YAML to XML

This command takes a YAML snippet and converts it into XML.

This is useful for validating and troubleshooting your YAML code.

Usage

The yaml-to-xml command takes two parameters -input and -output

  • --input is the YAML document to transform

  • --output is the XML document to be created

  • --output full path is created if it does not exist (like mkdir -p)

You may omit the --input or --output flags to read or write from stdin or stdout

Examples

Below are a few examples for using the yaml-to-xml command.

From a file

Reading input redirected from a file

apigee-go-gen transform yaml-to-xml < ./examples/snippets/ducks.yaml

From stdin

Reading input from stdin directly

apigee-go-gen transform yaml-to-xml << EOF
Parent:
  - Child: Fizz
  - Child: Buzz
EOF

From a process

Reading input piped from another process

echo '
Parent:
  - Child: Fizz
  - Child: Buzz' | apigee-go-gen transform yaml-to-xml