From: <ti...@ds...> - 2004-02-24 08:41:43
|
> > --- > > ? : value of nothing > > ... > > correct? > > This actually is invalid YAML. When the explicit key indicator '?' is > used, the ':' must be on a separate line and in the same column. > > --- > ? > : value of nothing > ... > oh, right, i missed this one. > The answer you are seeking is a little bit tricky, but is key to > understanding the essence of YAML. An empty string is not really a null > per se. It is an empty "scalar" that also has an empty "tag". YAML's > type repository encourages this combination to be loaded into memory as > a Python None or a Ruby null or a Perl undef. But (in the absence of a > schema) a YAML loader can load it as anything. In fact, loaders are > also encouraged to load all untagged scalars as strings. So how can they > be encouraged to do both? It depends on how the application using YAML > would like empty values served up. > > In other words, if there is no "schema" or "contract", two different > loaders will probably load the same document in different ways. And this > is perfectly OK. It all depends on the application that is using YAML. > On the specific use case. > > You cannot take a random YAML document from Perl, pass it through Ruby, > and expect it (beyond a shadow of a doubt) to come back intact. *Unless* > there is a schema associated with the document. Or unless the classes in > Perl and in Python have been designed to work with each other. Which is > really a different form of a "schema" or "contract". > > Hope this helps. > yes, this helps a lot. thank you. i found several schema proposals at http://yaml.freepan.org/index.cgi?SchemaProposals, but is there any plans to have standard way to attach schema to document? or is this again application specific? > Cheers, Brian > kventin (who like yaml more every day) |