Re: Possible bug with null document in libyaml
Osamu TAKEUCHI <[email protected]>
| Newsgroups | gmane.text.yaml.general |
|---|---|
| Message-ID | <[email protected]> |
Bill and Ingy, Thanks Ingy. I finally understood the importance of providing a way to serialize zero objects by reading your post. Before that, I was thinking as the same as Bill. Then, according to the spec, a YAML serializer can encode an empty string (in YAML 1.1 document) or a null object (in YAML 1.2 document) as an empty node in all the cases except for the one where the whole YAML stream becomes empty. I think an explicit warning should be given in the spec to clarify this point with some explanation of the importance of providing a way to serialize zero objects. It will be very much helpful. In addition, I point out that any empty string should not be encoded into empty nodes in YAML 1.1 document in any sense because it will not be compatible with YAML 1.2. In YAML 1.2 spec, an empty node represents a null object. So, anyways, all the YAML 1.1 serializers should be patched to encode all the empty strings in quoted styles "" or ''. BTW, I do not think a YAML 1.1 library will accept "x" as a valid YAML stream if the library strictly implements the specification. In YAML 1.1, a plain scalar node must be followed by s-l-comments that contains at least one line break. So, "x\n" is a valid document but "x" is not. This is the same problem pointed out for YAML 1.2 spec, first by Joshua Choi, http://sourceforge.net/mailarchive/forum.php?thread_name=200e06280904252219i1da33755h200bdac14058ba36%40mail.gmail.com&forum_name=yaml-core and then by me. http://sourceforge.net/mailarchive/forum.php?thread_name=1254356424.5043.224.camel%40nero&forum_name=yaml-core Probably, most of the real implementations ignore the spec to be compatible with hand-written documents possibly without a line break at the end. But, at least, a YAML serializer should not output a YAML document without a line break at the end. Best, Osamu Takeuchi ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july