c14n
index
/home/groups/p/py/pywebsvcs/src/wstools/c14n.py

XML Canonicalization
 
Patches Applied to xml.dom.ext.c14n:
    http://sourceforge.net/projects/pyxml/
 
    [ 1444526 ] c14n.py: http://www.w3.org/TR/xml-exc-c14n/ fix
        -- includes [ 829905 ] c14n.py fix for bug #825115, 
           Date Submitted: 2003-10-24 23:43
        -- include dependent namespace declarations declared in ancestor nodes 
           (checking attributes and tags), 
        -- handle InclusiveNamespaces PrefixList parameter
 
This module generates canonical XML of a document or element.
    http://www.w3.org/TR/2001/REC-xml-c14n-20010315
and includes a prototype of exclusive canonicalization
    http://www.w3.org/Signature/Drafts/xml-exc-c14n
 
Requires PyXML 0.7.0 or later.
 
Known issues if using Ft.Lib.pDomlette:
    1. Unicode
    2. does not white space normalize attributes of type NMTOKEN and ID?
    3. seems to be include "
" after importing external entities?
 
Note, this version processes a DOM tree, and consequently it processes
namespace nodes as attributes, not from a node's namespace axis. This
permits simple document and element canonicalization without
XPath. When XPath is used, the XPath result node list is passed and used to
determine if the node is in the XPath result list, but little else.
 
Authors:
    "Joseph M. Reagle Jr." <reagle@w3.org>
    "Rich Salz" <rsalz@zolera.com>
 
$Date: 2006-03-30 15:47:16 -0800 (Thu, 30 Mar 2006) $ by $Author: boverhof $

 
Modules
       
cStringIO
cStringIO
string

 
Classes
       
XMLNS

 
class XMLNS
     Data and other attributes defined here:
BASE = 'http://www.w3.org/2000/xmlns/'
XML = 'http://www.w3.org/XML/1998/namespace'

 
Functions
       
Canonicalize(node, output=None, **kw)
Canonicalize(node, output=None, **kw) -> UTF-8
 
Canonicalize a DOM document/element node and all descendents.
Return the text; if output is specified then output.write will
be called to output the text and None will be returned
Keyword parameters:
    nsdict: a dictionary of prefix:uri namespace entries
            assumed to exist in the surrounding context
    comments: keep comments if non-zero (default is 0)
    subset: Canonical XML subsetting resulting from XPath
            (default is [])
    unsuppressedPrefixes: do exclusive C14N, and this specifies the
            prefixes that should be inherited.