Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yaml parser can't parse yaml. #9

Open
Gaalidas opened this issue Apr 29, 2020 · 2 comments
Open

Yaml parser can't parse yaml. #9

Gaalidas opened this issue Apr 29, 2020 · 2 comments

Comments

@Gaalidas
Copy link

I'm really starting to wonder if I'm just stupid here. I've been trying for hours to get this thing to load a simple Yaml file and save it as an Xml. It won't do it. complains constantly about badly formed lines or not having the right number of items in it's array or some other crud. It obviously had to idea what a comment is in the format, and it doesn't recognize two spaces as proper indentation, which is proper indentation for a yaml item in a node. Is this thing meant to parse some form of yaml that came before the current yaml? As it is I'm back to square one in trying to figure out how to parse each line of a test file for expected YAML syntax. I got excited for nothing.

In fact, all I've got here is a good example of how to set up some methods for doing conversions of this sort. Functionally, though....well... it's not.

@Relfos
Copy link
Owner

Relfos commented Apr 29, 2020

Hi, this lib was battle tested with JSON and XML, however YAML support it is mostly experimental. Some users already helped in the past to improve a bit, but YAML is a really weird format with many edge cases. Can you provide a simple example of YAML syntax that is not parsed correctly?

@Gaalidas
Copy link
Author

Gaalidas commented Apr 30, 2020

True enough. While my original issue was with my own in-house collections I made that were acting faulty, I tried again this morning and sure enough I had to add a case for the "#" being used as a comment character, and now it won't recognize the "- " set as being the start of a new item in a list of items. I think I can use your code as a template, but I'm going to have to rewrite the majority of it. I wouldn't use YAML, but I'm trying to aid myself in editing some game configs in which the developers, in their obvious insanity, decided to use YAML to handle it.

I've moved on from testing with those configs, however, and am now trying something from an example found on a website that does, I think, interactive children's books? I dunno actually, I barely payed attention to the subject matter. their example isn't even related to their stuff anyway.

Here's the YAML I'm testing with:
(dunno why the top line is parsing as needing to be huge in the comment though)

`

An employee record

name: Martin D'vloper
job: Developer
skill: Elite
employed: True
foods:
- Apple
- Orange
- Strawberry
- Mango
languages:
perl: Elite
python: Elite
pascal: Lame
education: |
4 GCSEs
3 A-Levels
BSc in the Internet of Things
`

Anyway... I'll update further if I come up with anything good. I'm also experimenting with getting this thing to interact with the built-in XmlDocument class so that you can export or read from those. That would simplify things in my other classes that edit those formats. This would all be so much easier if the online yaml tools were available in C# sources... or any sources for that matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants