00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef XSECC14n20010315_INCLUDE
00030 #define XSECC14n20010315_INCLUDE
00031
00032
00033 #include <xsec/framework/XSECDefs.hpp>
00034 #include <xsec/utils/XSECSafeBuffer.hpp>
00035 #include <xsec/utils/XSECXPathNodeList.hpp>
00036 #include <xsec/canon/XSECCanon.hpp>
00037 #include <xsec/canon/XSECXMLNSStack.hpp>
00038
00039 #include <xercesc/framework/XMLFormatter.hpp>
00040
00041
00042 #include <memory.h>
00043 #include <vector>
00044
00045 XSEC_USING_XERCES(XMLFormatter);
00046 XSEC_USING_XERCES(XMLFormatTarget);
00047
00048 class XSECSafeBufferFormatter;
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 struct XSECNodeListElt {
00060
00061 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *element;
00062 safeBuffer sortString;
00063
00064 XSECNodeListElt *next,
00065 *last;
00066
00067 };
00068
00069
00070
00071 #define XMLNS_PREFIX "a"
00072 #define ATTRIBUTE_PREFIX "b"
00073
00074 #define NOURI_PREFIX "a"
00075 #define HAVEURI_PREFIX "b"
00076
00077
00078
00079
00080
00081 class CANON_EXPORT XSECC14n20010315 : public XSECCanon {
00082
00083 #if defined(XALAN_NO_NAMESPACES)
00084 typedef vector<char *> CharListVectorType;
00085 #else
00086 typedef std::vector<char *> CharListVectorType;
00087 #endif
00088
00089 #if defined(XALAN_SIZE_T_IN_NAMESPACE_STD)
00090 typedef std::size_t size_type;
00091 #else
00092 typedef size_t size_type;
00093 #endif
00094
00095
00096 public:
00097
00098
00099 XSECC14n20010315();
00100 XSECC14n20010315(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *newDoc);
00101 XSECC14n20010315(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *newDoc,
00102 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *newStartNode);
00103 virtual ~XSECC14n20010315();
00104
00105
00106
00107 int XPathSelectNodes(const char * XPathExpr);
00108 void setXPathMap(const XSECXPathNodeList & map);
00109
00110
00111 void setCommentsProcessing(bool onoff);
00112 bool getCommentsProcessing(void);
00113
00114
00115 void setExclusive(void);
00116 void setExclusive(char * xmlnsList);
00117
00118
00119 void setUseNamespaceStack(bool flag) {m_useNamespaceStack = flag;}
00120
00121 protected:
00122
00123
00124 int processNextNode();
00125
00126
00127 bool inNonExclNSList(safeBuffer &ns);
00128
00129 private:
00130
00131 void init();
00132 bool checkRenderNameSpaceNode(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *e,
00133 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *a);
00134 void stackInit(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * n);
00135
00136
00137 XSECSafeBufferFormatter * mp_formatter;
00138 safeBuffer m_formatBuffer;
00139
00140
00141 XSECNodeListElt * mp_attributes,
00142 * mp_currentAttribute,
00143 * mp_firstNonNsAttribute;
00144 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * mp_attributeParent;
00145 bool m_returnedFromChild;
00146 XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * mp_firstElementNode;
00147 bool m_firstElementProcessed;
00148 unsigned char * mp_charBuffer;
00149
00150
00151 bool m_XPathSelection;
00152 XSECXPathNodeList m_XPathMap;
00153
00154
00155 bool m_processComments;
00156
00157
00158 CharListVectorType m_exclNSList;
00159 bool m_exclusive;
00160 bool m_exclusiveDefault;
00161
00162
00163
00164
00165
00166
00167 bool m_useNamespaceStack;
00168 XSECXMLNSStack m_nsStack;
00169
00170
00171
00172 };
00173
00174
00175 #endif
00176
00177