Q:

How can I control yaml indentation using SnakeYaml during dumping?

I am using snakeyaml library to parse yaml files, and dump it later from xml. I was wondering if there is any way to control final yaml indentation. For example, list in final file will look like this:
list:
- "first item"
- "second item"

I would like add some spaces before items of list. Final result should like like:
list:
   - "first item"
   - "second item"

I see there is possibility to add custom resolvers and representers. But neither let me to add extra spaces. I've seen that in ScalarNode class, there are marks which contain info about starting column and ending column, but those are used only for logging purpose. Does anyone know solution for such scenario?

A:

DumperOptions.setIndicatorIndent() will do what you need.

