liangzimei / yamlmatlab

Automatically exported from code.google.com/p/yamlmatlab

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot read multi-document stream

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?
1. ReadYaml('MultiDoc.yaml');

I expected either a structured array or a cell array of yaml documents.


I am using YAMLMatlab 0.4.3 on Ubuntu 14.04 in Matlab 2015a.


My error is:
Error using ReadYamlRaw>load_yaml (line 78)
Java exception occurred:
expected a single document in the stream
 in "<string>", line 2, column 1:
    Gtype: L1L2
    ^
but found another document
 in "<string>", line 15, column 1:
    ---
    ^

    at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:111)
    at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:121)
    at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:480)
    at org.yaml.snakeyaml.Yaml.load(Yaml.java:399)

Error in ReadYamlRaw (line 42)
    result = load_yaml(filename, nosuchfileaction, treatasdata);


Error in ReadYaml (line 48)
    ry = ReadYamlRaw(filename, 0, nosuchfileaction, treatasdata);

-----
I noticed in the source code that documents are read with yaml.load() and not 
yaml.loadAll(). If I change that to loadAll, I get:

Error using ReadYamlRaw>scan (line 169)
Unknown data type: org.yaml.snakeyaml.Yaml$YamlIterable

Error in ReadYamlRaw>loadAll_yaml (line 128)
            result = scan(yaml.loadAll(fileread([filename, fileext])));

My attempts to handle the iterator before passing to scan have failed, but 
admittedly I don't know what I am doing. I'm attaching the yaml that is causing 
the error.


Original issue reported on code.google.com by cox....@gmail.com on 15 May 2015 at 4:50

Attachments: