Anand Shah
Anand Shah

Reputation: 14913

C# Yaml Processing

I am using the C# Yaml Parser mentioned on Code Project Site

If my Yaml looks like the following

- id: tagid
  tag:
  - name: tagname
    value: tagvalue

After it has been successfully parsed, how do I access the Data Items so that I can do some further processing. For example if I need to get the value of "name" what code would I need to write, the document says use doc.Root but can't find any examples on how to use it.

Upvotes: 6

Views: 2683

Answers (1)

Anand Shah
Anand Shah

Reputation: 14913

I figured out how to use doc.Root

The doc.Root returns a Mapping after it has parsed the YAML input. I recursively parse that Mapping to check if any of the Data Items are Mapping or Sequence and then act accordingly.

It's a bit naive method but so long as it works.

Many Thanks

Upvotes: 3

Related Questions