Pyyaml nested objects

Viewed 1984

I want to interpret following YAML string with PyYaml:

      - !Table
        header:
          - !Column
            - !Paragraph
              text: 'header1'
          - !Column 
            - !Paragraph
              text: 'header2'

I have Table and Paragraph classes that are inherited from yaml.YAMLObject class. But I don't know what to do about !Column tag? This tag should be treated only as a named array tag.

When I want to build objects from yaml.load() function, I got following error:

yaml.constructor.ConstructorError: could not determine a constructor 
for the tag '!Column'
in "<unicode string>", line 19, column 17:
              - !Column
                ^
1 Answers
Related