views:

460

answers:

1
+1  Q: 

C# Yaml Processing

Hi,
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.

Any help is appreciated.

Many Thanks

+1  A: 

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

Anand