5

I'm trying to parse an xml file with using python-amara.

doc = amara.parse('h.xml')

assert doc.xml_type == tree.entity.xml_type
m = doc.xml_children[0]

print m

When I do this it gives

amara.tree.element at 0x94c864c: name u'HOP', 0 namespaces, 0 attributes, 93 children

However when I try this :

print doc.HOP.A.D

it says:

AttributeError: 'amara.tree.entity' object has no attribute 'HOP'

Any idea?

iva123
  • 3,395
  • 10
  • 47
  • 68

1 Answers1

1

To access elements in a way you are trying to do it, you must use

from amara import bindery
doc = bindery.parse('h.xml')

instead of

doc = amara.parse('h.xml')
utapyngo
  • 6,946
  • 3
  • 44
  • 65