RussellSpitzer / snakeyaml

Automatically exported from code.google.com/p/snakeyaml
Apache License 2.0
0 stars 1 forks source link

Troubles loading a .yml file #185

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Thanks for this incredible library. I am trying to load a yml file in Java. Is 
it possible to read it, without defining its characteristics like json files?? 
Also which is the proper way to load it??

Original issue reported on code.google.com by snake__p...@hotmail.com on 15 Jan 2014 at 2:20

GoogleCodeExporter commented 9 years ago
What are the troubles ?

this is how you can load:
http://code.google.com/p/snakeyaml/wiki/Documentation#Loading_YAML

Yaml yaml = new Yaml();
String document = "\n- Hesperiidae\n- Papilionidae\n- Apatelodidae\n- 
Epiplemidae";
List<String> list = (List<String>) yaml.load(document);
System.out.println(list);

['Hesperiidae', 'Papilionidae', 'Apatelodidae', 'Epiplemidae']

Original comment by py4fun@gmail.com on 15 Jan 2014 at 10:31

GoogleCodeExporter commented 9 years ago
I am actually already created from opencv face recognizer. I want to read the 4 
elements of the file into arraylists. I ve dublicate this post in stackoverflow 
since its important for me to find a solution. 
http://stackoverflow.com/questions/21141120/load-yml-file-into-arraylists-using-
snakeyaml

Original comment by snake__p...@hotmail.com on 16 Jan 2014 at 7:51

GoogleCodeExporter commented 9 years ago
EDIT:Basically when I tried to read the simple files suggested in documentation 
it works. But When I am trying to read the face recognition model created from 
opencv code .yml file. I am using the following code

        InputStream input = new FileInputStream(new File("test.yml"));
        Yaml yaml = new Yaml();
        Object data = yaml.loadAll(input);
        System.out.println(data); 

I am getting as a result of println 
org.yaml.snakeyaml.Yaml$YamlIterable@996cca, how can I println the whole .yml 
file.

Original comment by snake__p...@hotmail.com on 16 Jan 2014 at 7:57

GoogleCodeExporter commented 9 years ago
Where can I find assertEquals function. Netbeans claims that it cant find 
assertEquals function.

Original comment by snake__p...@hotmail.com on 16 Jan 2014 at 8:05

GoogleCodeExporter commented 9 years ago
Don't get me wrong. But this is not not an "issue" for the issue-tracker.
This is "Forum"-type discussion.

Please start a thread about your problem here: 
https://groups.google.com/forum/#!forum/snakeyaml-core 
and people may help you.

If/when you find a bug during that discussion - that will be appropriate time 
to create an issue here.

Original comment by alexande...@gmail.com on 16 Jan 2014 at 8:58

GoogleCodeExporter commented 9 years ago
Ok I found what is my problem. However I cant solve it. I am having issues 
importing junit library. 

Original comment by snake__p...@hotmail.com on 16 Jan 2014 at 9:04

GoogleCodeExporter commented 9 years ago
Since importing JUnit library is not related to SnakeYAML, the issue will be 
closed as invalid.

Original comment by py4fun@gmail.com on 16 Jan 2014 at 6:15