<p>So for my text parsing in C# <a href="https://stackoverflow.com/questions/13963/best-method-of-textfile-parsing-in-c">question</a>, I got directed at YAML. I'm hitting a wall with this library I was recommended, so this is a quickie.</p>

<pre><code>heading:
 name: A name
 taco: Yes
 age: 32

heading:
 name: Another name
 taco: No
 age: 27
</code></pre>

<p>And so on. Is that valid?</p>

[{'answer_id': 15723, 'author': 'eplawless', 'author_id': 1370, 'author_profile': 'https://Stackoverflow.com/users/1370', 'pm_score': 2, 'selected': False, 'text': '<p>There appears to be a YAML validator called <a href="http://www.kuwata-lab.com/kwalify/" rel="nofollow noreferrer">Kwalify</a> which should give you the answer. You shoulda just gone with the String tokenizing, man. Writing parsers is fun :)</p>\n'}, {'answer_id': 15726, 'author': 'Grey Panther', 'author_id': 1265, 'author_profile': 'https://Stackoverflow.com/users/1265', 'pm_score': 4, 'selected': False, 'text': '<p>Partially. YAML supports the notion of multiple consecutive "documents". If this is what you are trying to do here, then yes, it is correct - you have two documents (or document fragments). To make it more explicit, you should separate them with three dashes, like this:</p>\n\n<pre><code>---\nheading:\n name: A name\n taco: Yes\n age: 32\n---\nheading:\n name: Another name\n taco: No\n age: 27\n</code></pre>\n\n<p>On the other hand if you wish to make them part of the same document (so that deserializing them would result in a list with two elements), you should write it like the following. Take extra care with the indentation level:</p>\n\n<pre><code>- heading:\n  name: A name\n  taco: Yes\n  age: 32\n- heading:\n  name: Another name\n  taco: No\n  age: 27\n</code></pre>\n\n<p>In general YAML is concise and human readable / editable, but not really human writable, so you should always use libraries to generate it. Also, take care that there exists some breaking changes between different versions of YAML, which can bite you if you are using libraries in different languages which conform to different versions of the standard.</p>\n'}, {'answer_id': 15742, 'author': 'Bernard', 'author_id': 61, 'author_profile': 'https://Stackoverflow.com/users/61', 'pm_score': 2, 'selected': False, 'text': "<p>Well, it appears YAML is gone out the window then. I want something both human writable <em>and</em> readable. Plus, this C# implementation...I have no idea <em>if</em> it's working or not, the documentation consists of a few one line code examples. It barfs on their own YAML files, and is an old student project. The only other C# YAML parser I've found uses the MS-PL which I'm not really comfortable using.</p>\n\n<p>I might just end up rolling my own format. Best practices be damned, all I want to do is associate a key with a value.   </p>\n"}, {'answer_id': 29200, 'author': 'Antoine Aubry', 'author_id': 2680, 'author_profile': 'https://Stackoverflow.com/users/2680', 'pm_score': 2, 'selected': False, 'text': '<p>There is <a href="http://yamldotnet.wiki.sourceforge.net/" rel="nofollow noreferrer">another YAML library for .NET</a> which is under development. Right now it supports reading YAML streams. It has been tested on Windows and Mono. Write support is currently being implemented.</p>\n'}, {'answer_id': 361574, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': '<p>CodeProject has one at:</p>\n\n<p><a href="http://www.codeproject.com/KB/recipes/yamlparser.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/recipes/yamlparser.aspx</a></p>\n\n<p>I haven\'t tried it too much, but it\'s worth a look.</p>\n'}, {'answer_id': 1298847, 'author': 'Paul Tarjan', 'author_id': 90025, 'author_profile': 'https://Stackoverflow.com/users/90025', 'pm_score': 1, 'selected': False, 'text': '<p>You can see the output in the online yaml parser :</p>\n\n<p><a href="http://yaml-online-parser.appspot.com/?yaml=heading%3A%0D%0A+name%3A+A+name%0D%0A+taco%3A+Yes%0D%0A+age%3A+32%0D%0A%0D%0Aheading%3A%0D%0A+name%3A+Another+name%0D%0A+taco%3A+No%0D%0A+age%3A+27%0D%0A&amp;type=json" rel="nofollow noreferrer">http://yaml-online-parser.appspot.com/?yaml=heading%3A%0D%0A+name%3A+A+name%0D%0A+taco%3A+Yes%0D%0A+age%3A+32%0D%0A%0D%0Aheading%3A%0D%0A+name%3A+Another+name%0D%0A+taco%3A+No%0D%0A+age%3A+27%0D%0A&amp;type=json</a></p>\n\n<p>As you can see, there is only one heading node created.</p>\n'}, {'answer_id': 5098143, 'author': 'SeniorLee', 'author_id': 197018, 'author_profile': 'https://Stackoverflow.com/users/197018', 'pm_score': 2, 'selected': False, 'text': '<p>Try <a href="http://yaml-online-parser.appspot.com/" rel="nofollow">this(Online YAML parser)</a>.</p>\n\n<p>You don\'t have to download anything or do something. Just go there, and copy &amp; paste. That\'s it.</p>\n'}, {'answer_id': 18981813, 'author': 'MrBackend', 'author_id': 2791256, 'author_profile': 'https://Stackoverflow.com/users/2791256', 'pm_score': 0, 'selected': False, 'text': '<p>Just to make an explicit comment about it: You have a duplicate mapping key issue. A YAML processor will resolve this as a !!map, which prohibits duplicate keys. Not all processors enforce this constraint, though, so you might get an incorrect result if you pass an incorrect YAML stream to a processor.</p>\n'}]
['https://Stackoverflow.com/questions/15709', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/61/']