Changes between Version 10 and Version 11 of PyYAMLDocumentation


Ignore:
Timestamp:
05/06/06 12:13:30 (8 years ago)
Author:
xi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PyYAMLDocumentation

    v10 v11  
    908908=== Nodes === 
    909909 
     910Nodes are entities in the YAML informational model. There are three kinds of nodes: 
     911''scalar'', ''sequence'', and ''mapping''. In PyYAML, nodes are produced by Composer 
     912and can be serialized to a YAML stream by Serializer. 
     913 
     914{{{ 
     915#!python 
     916ScalarNode(tag, value, style, start_mark, end_mark) 
     917SequenceNode(tag, value, flow_style, start_mark, end_mark) 
     918MappingNode(tag, value, flow_style, start_mark, end_mark) 
     919}}} 
     920 
     921The '''`style`''' and '''`flow_style`''' flags have the same meaning as for events. 
     922The value of a scalar node must be a unicode string. The value of a sequence node is 
     923a list of nodes. The value of a mapping node is a dictionary which keys and values 
     924are nodes. 
     925 
     926Example: 
     927{{{ 
     928#!python 
     929>>> print yaml.compose(""" 
     930... kinds: 
     931... - scalar 
     932... - sequence 
     933... - mapping 
     934... """) 
     935 
     936MappingNode(tag=u'tag:yaml.org,2002:map', value={ 
     937    ScalarNode(tag=u'tag:yaml.org,2002:str', value=u'kinds'): SequenceNode(tag=u'tag:yaml.org,2002:seq', value=[ 
     938        ScalarNode(tag=u'tag:yaml.org,2002:str', value=u'scalar'), 
     939        ScalarNode(tag=u'tag:yaml.org,2002:str', value=u'sequence'), 
     940        ScalarNode(tag=u'tag:yaml.org,2002:str', value=u'mapping')])}) 
     941 
     942>>> print yaml.serialize(yaml.SequenceNode(tag=u'tag:yaml.org,2002:seq', value=[ 
     943...     yaml.ScalarNode(tag=u'tag:yaml.org,2002:str', value=u'scalar'), 
     944...     yaml.ScalarNode(tag=u'tag:yaml.org,2002:str', value=u'sequence'), 
     945...     yaml.ScalarNode(tag=u'tag:yaml.org,2002:str', value=u'mapping')])) 
     946 
     947- scalar 
     948- sequence 
     949- mapping 
     950}}} 
    910951 
    911952