Python lxml etree and binding



I'm not an expert on python and i know about the functions or methods same as @XMLElementRef ,@XMLElementRefs, @XmlAnyElement, @XmlAccessType, @XmlAccessorTye in Java.


The code below is what i want in python as same function.



@XmlElementRefs({
@XmlElementRef(name = "setMeterSub", namespace = "http://ift.tt/1pvq3wj", type = SetMeterSub.class),
@XmlElementRef(name = "getMeterInfo", namespace = "http://ift.tt/1pvq3wj", type = GetMeterInfo.class),
}


And this is the python code that i've wrote down.



class meter() :
def __init__(self) :
pass

meters = etree.Element("meters")
element = etree.SubElement(meters,'{http://ift.tt/1qeuJqG')
command = etree.QName(element)
print (command.localname)
element = etree.SubElement(meters,'{http://ift.tt/1tzTqys' )
command = etree.QName(element)
print (command.localname)


uhm..what i want to know is how can i bind with those elements with classes in python like java. Do i have to use python descriptor? Does anyone have an idea?


No comments:

Post a Comment