Module PyXMLUtils
[show private | hide private]
[frames | no frames]

Module PyXMLUtils

Essentially, a wrapper around an Element Node of the DOM, that helps in making the usage of DOM a bit simpler... nothing complicated, just a set of 'macros'

The system tries to use the expat parser whenever it can, because it is faster. However, not all distributions may have it, so it falls back on a Sax2 parser which is slower but written in Python (afaik), ie, it is available everywhere.

You should install PyXML for this set of tools. (One of the features (essential in my view) that is implemented in the full version is XPath that is not part of the 'basic' distribution of Python.)

Author: Ivan Herman

License: This software is available for use under the W3C Software License

Classes
ElementNode Wrapper around an Element Node to make programs a bit easier to develop.

Function Summary
ElementNode createDocument(element, publicId, systemId, entities, notations)
Create a new DOM with a root element.
ElementNode parse(inp)
Parse a file and return the first element Node child as a 'root' of the document.

Variable Summary
str svgns = 'http://www.w3.org/2000/svg'
str XHTML_frameset = 'frameset'
str XHTML_strict = 'strict'
str XHTML_transitional = 'transitional'
str xhtmlns = 'http://www.w3.org/1999/xhtml'
dict XHTMLVersions = {'frameset': ('-//W3C//DTD XHTML 1.0 Fra...
str xlinkns = 'http://www.w3.org/1999/xlink'

Function Details

createDocument(element, publicId=None, systemId=None, entities=[], notations=[])

Create a new DOM with a root element. Returns the first child element as a 'root' of the document
Parameters:
element - name of the root element
publicId - Public ID for the document DTD
systemId - System ID for the document DTD
entities - entities for this document (see the PyXML documentation for further details)
notations - notations for this document (see the PyXML documentation for further details)
Returns:
top level node in the document
           (type=ElementNode)

parse(inp)

Parse a file and return the first element Node child as a 'root' of the document.
Parameters:
inp - a file object, a StringIO object, or a string/unicode; in the last case a file is opened with that name.
Returns:
top level node in the document
           (type=ElementNode)

Variable Details

svgns

Type:
str
Value:
'http://www.w3.org/2000/svg'                                           

XHTML_frameset

Type:
str
Value:
'frameset'                                                             

XHTML_strict

Type:
str
Value:
'strict'                                                               

XHTML_transitional

Type:
str
Value:
'transitional'                                                         

xhtmlns

Type:
str
Value:
'http://www.w3.org/1999/xhtml'                                         

XHTMLVersions

Type:
dict
Value:
{'Frameset': ('-//W3C//DTD XHTML 1.0 Frameset//EN',
              'http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd'),
 'Strict': ('-//W3C//DTD XHTML 1.0 Strict//EN',
            'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'),
 'Transitional': ('-//W3C//DTD XHTML 1.0 Transitional//EN',
                  'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional\
.dtd'),
 'frameset': ('-//W3C//DTD XHTML 1.0 Frameset//EN',
...                                                                    

xlinkns

Type:
str
Value:
'http://www.w3.org/1999/xlink'                                         

Generated by Epydoc 2.1 on Sat Dec 31 16:29:28 2005 http://epydoc.sf.net