lxml.objectify.ObjectPath
Package lxml :: Module objectify :: Class ObjectPath
[hide private]
[frames] | no frames]

Class ObjectPath

object --+
         |
        ObjectPath

ObjectPath(path) Immutable object that represents a compiled object path.

Example for a path: 'root.child[1].{other}child[25]'

Instance Methods [hide private]
 
__call__(...)
Follow the attribute path in the object structure and return the target attribute value.
 
__init__(path)
x.__init__(...) initializes x; see help(type(x)) for signature
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__str__(x)
str(x)
 
addattr(self, root, value)
Append a value to the target element in a subtree.
 
hasattr(self, root)
 
setattr(self, root, value)
Set the value of the target element in a subtree.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]
  find

Inherited from object: __class__

Method Details [hide private]

__call__(...)
(Call operator)

 

Follow the attribute path in the object structure and return the target attribute value.

If it it not found, either returns a default value (if one was passed as second argument) or raises AttributeError.

__init__(path)
(Constructor)

 
x.__init__(...) initializes x; see help(type(x)) for signature
Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

__str__(x)
(Informal representation operator)

 
str(x)
Overrides: object.__str__

addattr(self, root, value)

 

Append a value to the target element in a subtree.

If any of the children on the path does not exist, it is created.

setattr(self, root, value)

 

Set the value of the target element in a subtree.

If any of the children on the path does not exist, it is created.