Functions
|
|
|
|
__hyphen_replacement
|
__hyphen_replacement ( match )
|
|
child_tag_predicate
|
child_tag_predicate ( child_tag )
Return a predicate function for finding element nodes by tag.
- returns
- A predicate function that takes a node as its argument
and returns true if the node is an element node whose tag is
child_tag .
|
|
create_dom_document
|
create_dom_document ( public_id, document_element_tag )
Create a DOM document.
-
public_id
- The (partial) public ID for the DTD.
-
document_element_tag
- The tag of the main document element.
- returns
- A DOM document node.
|
|
create_dom_text_element
|
create_dom_text_element (
document,
tag,
text,
)
Return a DOM element containing a single text node.
-
document
- The containing DOM document.
-
tag
- The element tag.
-
text
- The text contents of the text node.
|
|
get_child
|
get_child ( node, child_tag )
Return the child element node of node whose tag is child_tag .
-
node
- A DOM node. It must have exactly one element child with
the tag
child_tag .
-
child_tag
- The desired element tag.
- returns
- A child DOM node of
node .
- raises
KeyError if node has no element child with tag
child_tag , or more than one..
|
|
get_child_text
|
get_child_text (
node,
child_tag,
default=None,
)
Return the text contained in a child of DOM node .
-
child_tag
- The tag of the child node whose text is to be
retrieved.
-
default
- If
node has no child element with tag child_tag ,
returns default , unless default is None .
- raises
KeyError if default is None and node has no child
element with tag child_tag .
|
|
get_child_texts
|
get_child_texts ( node, child_tag )
Return a sequence of text contents of children.
-
node
- A DOM node.
- returns
- The list containing all child nodes of
node which have
tag child_tag . Each child must have exactly one child of its own,
which must be a text node.
|
|
get_dom_text
|
get_dom_text ( node )
Return the text contained in DOM node .
-
node
- A DOM element node.
- prerequisites
node is an element node with exactly one child,
which is a text node.
|
|
load_xml
|
load_xml ( file )
Return a DOM document loaded from the XML file object file .
-
file
- A file object, opened for reading.
- returns
- The DOM document contained in
file .
This function closes file , whether or not reading the document was
successful.
|
|
load_xml_file
|
load_xml_file ( path )
Return a DOM document loaded from the XML file path .
|
|
make_public_id
|
make_public_id ( name )
Return a public ID for the DTD with the given name .
-
name
- The name of the DTD.
- returns
- A public ID for the DTD.
|
|
make_system_id
|
make_system_id ( name )
Return a system ID for the DTD with the given name .
-
name
- The name of the DTD, as a relative UNIX path.
- returns
- A URL for the DTD.
|
|
sanitize_text_for_comment
|
sanitize_text_for_comment ( text )
Return text modified so that it is valid for an XML comment.
|