June 2000
Intermediate to advanced
556 pages
8h 45m
English
You may have noticed that we have an AttributeValues dictionary in the xElement class but the PYX2xTree methods currently do not process them. Let us rectify that. The first thing we need to do is change PYXTree to process the PYX notation for attributes.
CD-ROM reference=9027.txt
elif L[0] == 'A':
i = string.index (L," ")
aName = L[1:i]
aValue = L[i+1:]
self.CurPos.AttributeValues[aName] =
aValue
The __repr__ method of xElement also needs to change in order to output (name,value) pairs for attributes when re-creating XML.
CD-ROM reference=9028.txt def __repr__(self): if len(self.AttributeValues) == 0: res = '<%s>' % self.ElementTypeName else: res = '<%s' % self.ElementTypeName for (aName,aValue) in self.Attribute ...
Read now
Unlock full access