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

Module objectify


Version: 1.3.6-48216

Functions [hide private]
 
DataElement(...)
Create a new element with a Python value and XML attributes taken from keyword arguments or a dictionary passed as second argument.
 
Element(...)
Objectify specific version of the lxml.etree Element() factory that always creates a structural (tree) element.
 
XML(...)
Objectify specific version of the lxml.etree fromstring() function.
 
__add_text(...)
 
__checkBool(...)
 
annotate(...)
Recursively annotates the elements of an XML tree with 'pytype' attributes.
 
deannotate(...)
Recursively de-annotate the elements of an XML tree by removing 'pytype' and/or 'type' attributes.
 
dump(...)
Return a recursively generated string representation of an element.
 
enableRecursiveStr(...)
Enable a recursively generated tree representation for str(element), based on objectify.dump(element).
 
fromstring(...)
Objectify specific version of the lxml.etree fromstring() function.
 
getRegisteredTypes(...)
Returns a list of the currently registered PyType objects.
 
parse(...)
 
setDefaultParser(...)
 
setPytypeAttributeTag(...)
Changes name and namespace of the XML attribute that holds Python type information.
 
set_default_parser(...)
Replace the default parser used by objectify's Element() and fromstring() functions.
Variables [hide private]
  E = <objectify.ElementMaker object at 0x86a634c>
  PYTYPE_ATTRIBUTE = '{http://codespeak.net/lxml/objectify/pytyp...
Function Details [hide private]

DataElement(...)

 

Create a new element with a Python value and XML attributes taken from keyword arguments or a dictionary passed as second argument.

Automatically adds a 'pytype' attribute for the Python type of the value, if the type can be identified. If '_pytype' or '_xsi' are among the keyword arguments, they will be used instead.

Element(...)

 

Objectify specific version of the lxml.etree Element() factory that always creates a structural (tree) element.

NOTE: requires parser based element class lookup activated in lxml.etree!

XML(...)

 

Objectify specific version of the lxml.etree fromstring() function.

NOTE: requires parser based element class lookup activated in lxml.etree!

annotate(...)

 

Recursively annotates the elements of an XML tree with 'pytype' attributes.

If the 'ignore_old' keyword argument is True (the default), current 'pytype' attributes will be ignored and replaced. Otherwise, they will be checked and only replaced if they no longer fit the current text value.

deannotate(...)

 

Recursively de-annotate the elements of an XML tree by removing 'pytype' and/or 'type' attributes.

If the 'pytype' keyword argument is True (the default), 'pytype' attributes will be removed. If the 'xsi' keyword argument is True (the default), 'xsi:type' attributes will be removed.

fromstring(...)

 

Objectify specific version of the lxml.etree fromstring() function.

NOTE: requires parser based element class lookup activated in lxml.etree!

getRegisteredTypes(...)

 

Returns a list of the currently registered PyType objects.

To add a new type, retrieve this list and call unregister() for all entries. Then add the new type at a suitable position (possibly replacing an existing one) and call register() for all entries.

This is necessary if the new type interferes with the type check functions of existing ones (normally only int/float/bool) and must the tried before other types. To add a type that is not yet parsable by the current type check functions, you can simply register() it, which will append it to the end of the type list.

setPytypeAttributeTag(...)

 

Changes name and namespace of the XML attribute that holds Python type information.

Reset by calling without argument.

Default: "{http://codespeak.net/lxml/objectify/pytype}pytype"

set_default_parser(...)

 

Replace the default parser used by objectify's Element() and fromstring() functions.

The new parser must be an etree.XMLParser.

Call without arguments to reset to the original parser.


Variables Details [hide private]

PYTYPE_ATTRIBUTE

Value:
'{http://codespeak.net/lxml/objectify/pytype}pytype'