�
�/$ZL@ � � � d Z dZddlZddlmZ ddlmZ n# G d� d� � ZY nxY w ddlZeZn# e $ r ddlZY nw xY wd� Z
d � Zd
� Zd� Z
ed� � \ ZZZd
� Zd� Zd� Zd� Zd� Z G d� d� � Zdd�ZdS )a� 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 23:47:16 +0000 (Thu, 30 Mar 2006) $ by $Author: boverhof $
a* Copyright 2001, Zolera Systems Inc. All Rights Reserved.
Copyright 2001, MIT. All Rights Reserved.
Distributed under the terms of:
Python 2.0 License or later.
http://www.python.org/2.0.1/license.html
or
W3C Software License
http://www.w3.org/Consortium/Legal/copyright-software-19980720
� N)�Node)�XMLNSc � � e Zd ZdZdZdS )r zhttp://www.w3.org/2000/xmlns/�$http://www.w3.org/XML/1998/namespaceN)�__name__�
__module__�__qualname__�BASE�XML� � �3/usr/lib/python3/dist-packages/pysimplesoap/c14n.pyr r 7 s � � � � � �.��4���r
r c �F � | j r| j � � � pg S �N)�
attributes�values��Es r �<lambda>r @ s � �A�L�:�Q�\�%8�%8�%:�%:�A�r� r
c � � | j pg S r )�
childNodesr s r r r A s
� �a�l�(�b� r
c �6 � | j � d� � S )N�xmlns)�name�
startswith��ns r r r B s � �q�v�(�(��1�1� r
c � � | j d k S r )�unsuppressedPrefixesr s r r r C s � �q�-��5� r
� c �r � t | j |j � � }|r|S t | j |j � � S )zB_sorter(n1,n2) -> int
Sorting predicate for non-NS attributes.)�cmp�namespaceURI� localName)�n1�n2�is r �_sorterr( J s4 � � �B�O�R�_�-�-�A��N��(��r�|�R�\�*�*�*r
c �r � | d dk rdS |d dk rdS t | d |d � � S )zY_sorter_ns((n,v),(n,v)) -> int
"(an empty namespace URI is lexicographically least)."r r ���� )r" |