I am studying the use of YAML for a somewhat complex metadata language. This would help make documents more compact and less complex if we could use YAML anchors and links . I wrote some test codes that seem to show that the Jackson YAML implementation does not support this function (and / or does not support SnakeYAML support for this function).
Here is my test YAML file:
set_one:
bass: tama rockstar 22x16
snare: &ludwig ludwig supralight 6.5x15
tom1: tama rockstar 12x11
tom2: tama rockstar 16x16
set_two:
snare: *ludwig
I parse this file as follows:
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
FileInputStream fis = null;
try
{
fis = new FileInputStream(file);
JsonNode nodeTree = mapper.readTree(fis);
examineObject(nodeTree, 0);
}
...
Here is from my surveyObject () method (you can probably guess what it does):
key = "set_one", type = OBJECT
key = "bass", type = STRING, value = "tama rockstar 22x16"
key = "snare", type = STRING, value = "ludwig supralight 6.5x15"
key = "tom1", type = STRING, value = "tama rockstar 12x11"
key = "tom2", type = STRING, value = "tama rockstar 16x16"
key = "set_two", type = OBJECT
key = "snare", type = STRING, value = "ludwig"
, - , "set_one.snare", JsonNode . , "set_two.snare" - "ludwig". ('*') , , , .
Jackson 2.8.3 SnakeYaml 1.17. , , Jackson JSON.
, . , "set_two.snare" "ludwig supralight 6.5x15".
, , , , node . , , "set_two.snare" "ludwig", node "& ludwig" node.
, , , , com.fasterxml.jackson.dataformat.yaml.YAMLParser.Feature. , ( ), .