You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by sc...@apache.org on 2017/12/14 00:11:29 UTC
svn commit: r1818084 - in /santuario/xml-security-cpp/trunk/xsec: dsig/
tools/siginf/ tools/xtest/ transformers/
Author: scantor
Date: Thu Dec 14 00:11:29 2017
New Revision: 1818084
URL: http://svn.apache.org/viewvc?rev=1818084&view=rev
Log:
Move XPath filter enum into related class.
Modified:
santuario/xml-security-cpp/trunk/xsec/dsig/DSIGConstants.hpp
santuario/xml-security-cpp/trunk/xsec/dsig/DSIGTransformXPathFilter.cpp
santuario/xml-security-cpp/trunk/xsec/dsig/DSIGTransformXPathFilter.hpp
santuario/xml-security-cpp/trunk/xsec/dsig/DSIGXPathFilterExpr.cpp
santuario/xml-security-cpp/trunk/xsec/dsig/DSIGXPathFilterExpr.hpp
santuario/xml-security-cpp/trunk/xsec/tools/siginf/siginf.cpp
santuario/xml-security-cpp/trunk/xsec/tools/xtest/xtest.cpp
santuario/xml-security-cpp/trunk/xsec/transformers/TXFMXPathFilter.cpp
santuario/xml-security-cpp/trunk/xsec/transformers/TXFMXPathFilter.hpp
Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGConstants.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGConstants.hpp?rev=1818084&r1=1818083&r2=1818084&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGConstants.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGConstants.hpp Thu Dec 14 00:11:29 2017
@@ -168,13 +168,6 @@ enum signatureMethod {
SIGNATURE_ECDSA = 4 // ECDSA
};
-enum xpathFilterType {
-
- FILTER_UNION = 0, /** Results should be added to previous nodeset */
- FILTER_INTERSECT = 1, /** Results should be included if in prev nodeset */
- FILTER_SUBTRACT = 2 /** Results should be subtracted from prev nodeset */
-
-};
// --------------------------------------------------------------------------------
// Constant Strings Class
Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGTransformXPathFilter.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGTransformXPathFilter.cpp?rev=1818084&r1=1818083&r2=1818084&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGTransformXPathFilter.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGTransformXPathFilter.cpp Thu Dec 14 00:11:29 2017
@@ -49,7 +49,6 @@ DSIGTransformXPathFilter::DSIGTransformX
DSIGTransform(env, node),
m_loaded(false) {
-
}
@@ -58,47 +57,37 @@ DSIGTransform(env),
m_loaded(false) {
}
-
-
-DSIGTransformXPathFilter::~DSIGTransformXPathFilter() {
-
- exprVectorType::iterator i;
- for (i = m_exprs.begin(); i != m_exprs.end(); ++i) {
- delete (*i);
-
- }
+DSIGTransformXPathFilter::~DSIGTransformXPathFilter() {
+ for (exprVectorType::iterator i = m_exprs.begin(); i != m_exprs.end(); ++i) {
+ delete (*i);
+ }
}
void DSIGTransformXPathFilter::appendTransformer(TXFMChain * input) {
- if (m_loaded == false) {
-
- throw XSECException(XSECException::XPathFilterError,
- "DSIGTransformXPathFilter::appendTransform - load not yet called");
-
- }
+ if (m_loaded == false) {
+ throw XSECException(XSECException::XPathFilterError,
+ "DSIGTransformXPathFilter::appendTransform - load not yet called");
+ }
#ifndef XSEC_HAVE_XPATH
-
- throw XSECException(XSECException::UnsupportedFunction,
- "XPath transforms are not supported in this compilation of the XSEC library");
-
+ throw XSECException(XSECException::UnsupportedFunction,
+ "XPath transforms are not supported in this build of the XSEC library");
#else
+ TXFMXPathFilter *xpf;
+ // XPath transform
+ XSECnew(xpf, TXFMXPathFilter(mp_txfmNode->getOwnerDocument()));
+ input->appendTxfm(xpf);
- TXFMXPathFilter *xpf;
- // XPath transform
- XSECnew(xpf, TXFMXPathFilter(mp_txfmNode->getOwnerDocument()));
- input->appendTxfm(xpf);
+ // These can throw, but the TXFMXPathFilter is now owned by the chain, so will
+ // be cleaned up down the calling stack.
- // These can throw, but the TXFMXPathFilter is now owned by the chain, so will
- // be cleaned up down the calling stack.
+ xpf->evaluateExprs(&m_exprs);
- xpf->evaluateExprs(&m_exprs);
-
#endif /* NO_XPATH */
}
@@ -108,43 +97,42 @@ void DSIGTransformXPathFilter::appendTra
// --------------------------------------------------------------------------------
-DOMElement * DSIGTransformXPathFilter::createBlankTransform(DOMDocument * parentDoc) {
+DOMElement * DSIGTransformXPathFilter::createBlankTransform(DOMDocument* parentDoc) {
- safeBuffer str;
- const XMLCh * prefix;
- DOMElement *ret;
- DOMDocument *doc = mp_env->getParentDocument();
+ safeBuffer str;
+ const XMLCh * prefix;
+ DOMElement *ret;
+ DOMDocument *doc = mp_env->getParentDocument();
- prefix = mp_env->getDSIGNSPrefix();
-
- // Create the transform node
- makeQName(str, prefix, "Transform");
- ret = doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.rawXMLChBuffer());
- ret->setAttributeNS(NULL,DSIGConstants::s_unicodeStrAlgorithm, DSIGConstants::s_unicodeStrURIXPF);
-
- mp_txfmNode = ret;
+ prefix = mp_env->getDSIGNSPrefix();
- m_loaded = true;
+ // Create the transform node
+ makeQName(str, prefix, "Transform");
+ ret = doc->createElementNS(DSIGConstants::s_unicodeStrURIDSIG, str.rawXMLChBuffer());
+ ret->setAttributeNS(NULL,DSIGConstants::s_unicodeStrAlgorithm, DSIGConstants::s_unicodeStrURIXPF);
- return ret;
+ mp_txfmNode = ret;
+ m_loaded = true;
+ return ret;
}
-DSIGXPathFilterExpr * DSIGTransformXPathFilter::appendFilter(xpathFilterType filterType,
- const XMLCh * filterExpr) {
+DSIGXPathFilterExpr* DSIGTransformXPathFilter::appendFilter(
+ DSIGXPathFilterExpr::XPathFilterType filterType,
+ const XMLCh* filterExpr) {
- DSIGXPathFilterExpr * e;
+ DSIGXPathFilterExpr * e;
- XSECnew(e, DSIGXPathFilterExpr(mp_env));
+ XSECnew(e, DSIGXPathFilterExpr(mp_env));
- DOMNode * elt = e->setFilter(filterType, filterExpr);
- m_exprs.push_back(e);
+ DOMNode * elt = e->setFilter(filterType, filterExpr);
+ m_exprs.push_back(e);
- mp_txfmNode->appendChild(elt);
- mp_env->doPrettyPrint(mp_txfmNode);
+ mp_txfmNode->appendChild(elt);
+ mp_env->doPrettyPrint(mp_txfmNode);
- return e;
+ return e;
}
@@ -152,43 +140,37 @@ DSIGXPathFilterExpr * DSIGTransformXPath
// Load from XML
// --------------------------------------------------------------------------------
-void DSIGTransformXPathFilter::load(void) {
+void DSIGTransformXPathFilter::load() {
- if (mp_txfmNode == NULL) {
+ if (mp_txfmNode == NULL) {
+ throw XSECException(XSECException::XPathFilterError,
+ "DSIGTransformXPathFilter::load called on NULL node");
+ }
- throw XSECException(XSECException::XPathFilterError,
- "DSIGTransformXPathFilter::load called on NULL node");
-
- }
+ // Very simple - go through each child. If it's an XPath child
+ // Create the DSIGXPathFilterExpr object
- // Very simple - go through each child. If it's an XPath child
- // Create the DSIGXPathFilterExpr object
+ DOMNode * n = mp_txfmNode->getFirstChild();
- DOMNode * n = mp_txfmNode->getFirstChild();
+ while (n != NULL) {
+ if (n->getNodeType() == DOMNode::ELEMENT_NODE &&
+ strEquals(getXPFLocalName(n), "XPath")) {
- while (n != NULL) {
+ DSIGXPathFilterExpr * xpf;
+ XSECnew(xpf, DSIGXPathFilterExpr(mp_env, n));
- if (n->getNodeType() == DOMNode::ELEMENT_NODE &&
- strEquals(getXPFLocalName(n), "XPath")) {
+ // Add it to the vector prior to load to ensure deleted if
+ // anything throws an exception
- DSIGXPathFilterExpr * xpf;
- XSECnew(xpf, DSIGXPathFilterExpr(mp_env, n));
+ m_exprs.push_back(xpf);
- // Add it to the vector prior to load to ensure deleted if
- // anything throws an exception
+ xpf->load();
+ }
- m_exprs.push_back(xpf);
-
- xpf->load();
-
- }
-
- n = n->getNextSibling();
-
- }
-
- m_loaded = true;
+ n = n->getNextSibling();
+ }
+ m_loaded = true;
}
// --------------------------------------------------------------------------------
@@ -196,17 +178,14 @@ void DSIGTransformXPathFilter::load(void
// --------------------------------------------------------------------------------
unsigned int DSIGTransformXPathFilter::getExprNum() const {
-
- return (unsigned int) m_exprs.size();
-
+ return (unsigned int) m_exprs.size();
}
DSIGXPathFilterExpr* DSIGTransformXPathFilter::expr(unsigned int n) const {
- if (n < m_exprs.size())
- return m_exprs[n];
-
- return NULL;
+ if (n < m_exprs.size())
+ return m_exprs[n];
+ return NULL;
}
Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGTransformXPathFilter.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGTransformXPathFilter.hpp?rev=1818084&r1=1818083&r2=1818084&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGTransformXPathFilter.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGTransformXPathFilter.hpp Thu Dec 14 00:11:29 2017
@@ -32,6 +32,7 @@
#include <xsec/dsig/DSIGTransform.hpp>
#include <xsec/utils/XSECSafeBuffer.hpp>
+#include <xsec/dsig/DSIGXPathFilterExpr.hpp>
XSEC_DECLARE_XERCES_CLASS(DOMNamedNodeMap);
@@ -39,8 +40,6 @@ XSEC_DECLARE_XERCES_CLASS(DOMNode);
#include <vector>
-class DSIGXPathFilterExpr;
-
/**
* @ingroup pubsig
*/
@@ -57,147 +56,142 @@ class DSIGXPathFilterExpr;
*/
class XSEC_EXPORT DSIGTransformXPathFilter : public DSIGTransform {
+public:
+ /**
+ * \brief Vector used to pass the actual expressions into the transformer
+ */
-public:
+ typedef std::vector<DSIGXPathFilterExpr*> exprVectorType;
+
+ /** @name Constructors and Destructors */
+ //@{
+
+ /**
+ * \brief Contructor used for existing XML signatures.
+ *
+ * The Node structure already exists, so read the nodes in.
+ *
+ * @param env The operating environment
+ * @param node The DOM node (within doc) that is to be used as the base of the Transform.
+ * @see #load
+ */
+
+ DSIGTransformXPathFilter(const XSECEnv* env, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node);
- /**
- * \brief Vector used to pass the actual expressions into the transformer
- */
+ /**
+ * \brief Contructor used for new signatures.
+ *
+ * The Node structure will have to be created.
+ *
+ * @note DSIGTransform structures should only ever be created via calls to a
+ * DSIGTransformList object.
+ *
+ * @param env The operating environment
+ * @see createBlankTransform
+ */
+
+ DSIGTransformXPathFilter(const XSECEnv* env);
+
+ /**
+ * \brief Destructor.
+ *
+ * Destroy the DSIGSignature elements.
+ *
+ * Does not destroy any associated DOM Nodes
+ */
+
+ virtual ~DSIGTransformXPathFilter();
- typedef std::vector<DSIGXPathFilterExpr *> exprVectorType;
+ //@}
+
+ /** @name Interface Methods */
- /** @name Constructors and Destructors */
//@{
-
+
/**
- * \brief Contructor used for existing XML signatures.
- *
- * The Node structure already exists, so read the nodes in.
- *
- * @param env The operating environment
- * @param node The DOM node (within doc) that is to be used as the base of the Transform.
- * @see #load
- */
-
- DSIGTransformXPathFilter(const XSECEnv * env, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * node);
-
- /**
- * \brief Contructor used for new signatures.
- *
- * The Node structure will have to be created.
- *
- * @note DSIGTransform structures should only ever be created via calls to a
- * DSIGTransformList object.
- *
- * @param env The operating environment
- * @see createBlankTransform
- */
-
- DSIGTransformXPathFilter(const XSECEnv * env);
-
- /**
- * \brief Destructor.
- *
- * Destroy the DSIGSignature elements.
- *
- * Does not destroy any associated DOM Nodes
- */
-
- virtual ~DSIGTransformXPathFilter();
-
- //@}
-
- /** @name Interface Methods */
-
- //@{
-
- /**
- * \brief Create the XPath Filter Transformer class.
- *
- * Create the transformer associated with this XPath transform.
- * Will set the expression and Namespaces as appropriate
- *
- * @returns The TXFMXPath transformer associated with this Transform
- */
-
- virtual void appendTransformer(TXFMChain * input);
-
- /**
- * \brief Construct blank XPath Transform element.
- *
- * Instruct the implementation to create the required
- * transform and return the newly constructed DOMNode structure
- */
-
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement *
- createBlankTransform(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument * parentDoc);
-
- /**
- * \brief Load a DOM structure
- *
- * Load the expression and Namespaces.
- *
- */
-
- virtual void load(void);
-
- //@}
-
- /** @name XPathFilter specific methods */
-
- //@{
-
- /**
- * \brief Append a new filter to the transform
- *
- * Appends the indicated filter (of given type) to the list of
- * filters in the transform.
- *
- * @param filterType The type of this filter
- * @param filterExpr The XPath expression to use
- * @returns The filter expression
- */
-
- DSIGXPathFilterExpr * appendFilter(xpathFilterType filterType,
- const XMLCh * filterExpr);
-
- /**
- * \brief Retrieve number of expressions
- *
- * Allows callers to determine how many expressions there are in
- * this filter
- *
- * @returns The number of expressions
- */
-
- unsigned int getExprNum() const;
-
- /**
- * \brief Get expression.
- *
- * Allows the caller to retrieve the specified expression from the
- * XPath Filter object
- *
- * @param n The index of the expression to retrieve
- * @returns The indicated expression
- */
+ * \brief Create the XPath Filter Transformer class.
+ *
+ * Create the transformer associated with this XPath transform.
+ * Will set the expression and Namespaces as appropriate
+ *
+ * @returns The TXFMXPath transformer associated with this Transform
+ */
- DSIGXPathFilterExpr * expr(unsigned int n) const;
+ virtual void appendTransformer(TXFMChain* input);
- //@}
-
-private:
+ /**
+ * \brief Construct blank XPath Transform element.
+ *
+ * Instruct the implementation to create the required
+ * transform and return the newly constructed DOMNode structure
+ */
- DSIGTransformXPathFilter();
- DSIGTransformXPathFilter(const DSIGTransformXPathFilter & theOther);
+ virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMElement*
+ createBlankTransform(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* parentDoc);
- bool m_loaded;
+ /**
+ * \brief Load a DOM structure
+ *
+ * Load the expression and Namespaces.
+ *
+ */
+
+ virtual void load();
+
+ //@}
+
+ /** @name XPathFilter specific methods */
+
+ //@{
+
+ /**
+ * \brief Append a new filter to the transform
+ *
+ * Appends the indicated filter (of given type) to the list of
+ * filters in the transform.
+ *
+ * @param filterType The type of this filter
+ * @param filterExpr The XPath expression to use
+ * @returns The filter expression
+ */
+
+ DSIGXPathFilterExpr* appendFilter(DSIGXPathFilterExpr::XPathFilterType filterType,
+ const XMLCh * filterExpr);
- // The expressions
- exprVectorType m_exprs;
+ /**
+ * \brief Retrieve number of expressions
+ *
+ * Allows callers to determine how many expressions there are in
+ * this filter
+ *
+ * @returns The number of expressions
+ */
+
+ unsigned int getExprNum() const;
+
+ /**
+ * \brief Get expression.
+ *
+ * Allows the caller to retrieve the specified expression from the
+ * XPath Filter object
+ *
+ * @param n The index of the expression to retrieve
+ * @returns The indicated expression
+ */
+
+ DSIGXPathFilterExpr* expr(unsigned int n) const;
+
+ //@}
+
+private:
+ DSIGTransformXPathFilter();
+ DSIGTransformXPathFilter(const DSIGTransformXPathFilter& theOther);
+ bool m_loaded;
+ // The expressions
+ exprVectorType m_exprs;
};
#endif /* DSIGTRANSFORMXPATHFILTER_INCLUDE */
Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGXPathFilterExpr.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGXPathFilterExpr.cpp?rev=1818084&r1=1818083&r2=1818084&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGXPathFilterExpr.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGXPathFilterExpr.cpp Thu Dec 14 00:11:29 2017
@@ -43,15 +43,13 @@
XERCES_CPP_NAMESPACE_USE
XMLCh filterStr[] = {
-
- chLatin_F,
- chLatin_i,
- chLatin_l,
- chLatin_t,
- chLatin_e,
- chLatin_r,
- chNull
-
+ chLatin_F,
+ chLatin_i,
+ chLatin_l,
+ chLatin_t,
+ chLatin_e,
+ chLatin_r,
+ chNull
};
@@ -59,7 +57,7 @@ XMLCh filterStr[] = {
// Constructors and Destructors
// --------------------------------------------------------------------------------
-DSIGXPathFilterExpr::DSIGXPathFilterExpr(const XSECEnv * env, DOMNode * node) :
+DSIGXPathFilterExpr::DSIGXPathFilterExpr(const XSECEnv* env, DOMNode* node) :
mp_env(env),
mp_xpathFilterNode(node),
mp_exprTextNode(NULL),
@@ -69,7 +67,7 @@ m_loaded(false) {
}
-DSIGXPathFilterExpr::DSIGXPathFilterExpr(const XSECEnv * env) :
+DSIGXPathFilterExpr::DSIGXPathFilterExpr(const XSECEnv* env) :
mp_env(env),
mp_xpathFilterNode(NULL),
mp_exprTextNode(NULL),
@@ -80,154 +78,138 @@ m_loaded(false) {
}
-DSIGXPathFilterExpr::~DSIGXPathFilterExpr() {
-
- // Nothing to do at the moment
-
-}
+DSIGXPathFilterExpr::~DSIGXPathFilterExpr() {}
// --------------------------------------------------------------------------------
// Load existing DOM structure
// --------------------------------------------------------------------------------
-
-void DSIGXPathFilterExpr::load(void) {
-
- // Find the XPath expression
-
- if (mp_xpathFilterNode == NULL ||
- !strEquals(getXPFLocalName(mp_xpathFilterNode), "XPath")) {
-
- throw XSECException(XSECException::ExpectedDSIGChildNotFound,
- "Expected <XPath> as first node in DSIGXPathFilterExpr::load");
-
- }
-
-
- // Check for attributes - in particular any namespaces
-
- mp_NSMap = mp_xpathFilterNode->getAttributes();
-
- // Find the filter type
- DOMNode * a;
- if (mp_NSMap == NULL ||
- ((a = mp_NSMap->getNamedItem(filterStr)) == NULL)) {
-
- throw XSECException(XSECException::ExpectedDSIGChildNotFound,
- "Expected Filter attribute of <XPath> node in in DSIGXPathFilterExpr::load");
- }
+void DSIGXPathFilterExpr::load() {
- const XMLCh * f = a->getNodeValue();
- if (strEquals(f, "intersect")) {
- m_filterType = FILTER_INTERSECT;
- }
- else if (strEquals(f, "union")) {
- m_filterType = FILTER_UNION;
- }
- else if (strEquals(f, "subtract")) {
- m_filterType = FILTER_SUBTRACT;
- }
- else {
+ // Find the XPath expression
- throw XSECException(XSECException::ExpectedDSIGChildNotFound,
- "DSIGXPathFilterExpr::load Expected on of intersect, union or subtract as filter type");
- }
+ if (mp_xpathFilterNode == NULL ||
+ !strEquals(getXPFLocalName(mp_xpathFilterNode), "XPath")) {
- // Find the text node
- mp_exprTextNode = findFirstChildOfType(mp_xpathFilterNode, DOMNode::TEXT_NODE);
+ throw XSECException(XSECException::ExpectedDSIGChildNotFound,
+ "Expected <XPath> as first node in DSIGXPathFilterExpr::load");
+ }
+
+
+ // Check for attributes - in particular any namespaces
+
+ mp_NSMap = mp_xpathFilterNode->getAttributes();
+
+ // Find the filter type
+ DOMNode * a;
+ if (mp_NSMap == NULL ||
+ ((a = mp_NSMap->getNamedItem(filterStr)) == NULL)) {
+
+ throw XSECException(XSECException::ExpectedDSIGChildNotFound,
+ "Expected Filter attribute of <XPath> node in in DSIGXPathFilterExpr::load");
+ }
+
+ const XMLCh * f = a->getNodeValue();
+ if (strEquals(f, "intersect")) {
+ m_filterType = FILTER_INTERSECT;
+ }
+ else if (strEquals(f, "union")) {
+ m_filterType = FILTER_UNION;
+ }
+ else if (strEquals(f, "subtract")) {
+ m_filterType = FILTER_SUBTRACT;
+ }
+ else {
+ throw XSECException(XSECException::ExpectedDSIGChildNotFound,
+ "DSIGXPathFilterExpr::load Expected on of intersect, union or subtract as filter type");
+ }
+
+ // Find the text node
+ mp_exprTextNode = findFirstChildOfType(mp_xpathFilterNode, DOMNode::TEXT_NODE);
+
+ if (mp_exprTextNode == NULL) {
+ throw XSECException(XSECException::ExpectedDSIGChildNotFound,
+ "Expected Text Node in beneath <XPath> in DSIGXPathFilterExpr::load");
+ }
- if (mp_exprTextNode == NULL) {
- throw XSECException(XSECException::ExpectedDSIGChildNotFound,
- "Expected Text Node in beneath <XPath> in DSIGXPathFilterExpr::load");
- }
-
- // Gather the text - hold it in UTF16 format
- gatherChildrenText(mp_xpathFilterNode, m_expr);
-
- m_loaded = true;
+ // Gather the text - hold it in UTF16 format
+ gatherChildrenText(mp_xpathFilterNode, m_expr);
+ m_loaded = true;
}
// --------------------------------------------------------------------------------
// Create a new filter
// --------------------------------------------------------------------------------
-DOMElement * DSIGXPathFilterExpr::setFilter(xpathFilterType filterType,
- const XMLCh * filterExpr) {
-
- if (m_loaded == true) {
-
- throw XSECException(XSECException::XPathFilterError,
- "DSIGXPathFilterExpr::setFilter - called when already loaded");
-
- }
-
- safeBuffer str;
- const XMLCh * prefix;
- DOMDocument *doc = mp_env->getParentDocument();
- DOMElement * xe;
-
- // Create the XPath element
- prefix = mp_env->getXPFNSPrefix();
- makeQName(str, prefix, "XPath");
- xe = doc->createElementNS(DSIGConstants::s_unicodeStrURIXPF, str.rawXMLChBuffer());
- mp_xpathFilterNode = xe;
-
- // Put in correct namespace
- prefix = mp_env->getXPFNSPrefix();
-
- // Set the namespace attribute
- if (prefix[0] == '\0') {
- str.sbTranscodeIn("xmlns");
- }
- else {
- str.sbTranscodeIn("xmlns:");
- str.sbXMLChCat(prefix);
- }
-
- xe->setAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
- str.rawXMLChBuffer(),
- DSIGConstants::s_unicodeStrURIXPF);
-
- // Set the filter type
- m_filterType = filterType;
-
- switch (filterType) {
-
- case FILTER_INTERSECT :
-
- xe->setAttributeNS(NULL,MAKE_UNICODE_STRING("Filter"), MAKE_UNICODE_STRING("intersect"));
- break;
-
- case FILTER_SUBTRACT :
-
- xe->setAttributeNS(NULL,MAKE_UNICODE_STRING("Filter"), MAKE_UNICODE_STRING("subtract"));
- break;
-
- case FILTER_UNION :
-
- xe->setAttributeNS(NULL,MAKE_UNICODE_STRING("Filter"), MAKE_UNICODE_STRING("union"));
- break;
-
- default :
-
- mp_xpathFilterNode->release();
- throw XSECException(XSECException::XPathFilterError,
- "DSIGXPathFilterExpr::appendFilter - Unexpected Filter Type");
-
- }
-
- // Now add the actual filter
-
- mp_exprTextNode = doc->createTextNode(filterExpr);
- mp_xpathFilterNode->appendChild(mp_exprTextNode);
-
- mp_NSMap = mp_xpathFilterNode->getAttributes();
-
- m_expr.sbXMLChIn(filterExpr);
- m_loaded = true;
- return xe;
+DOMElement* DSIGXPathFilterExpr::setFilter(DSIGXPathFilterExpr::XPathFilterType filterType,
+ const XMLCh * filterExpr) {
+ if (m_loaded == true) {
+ throw XSECException(XSECException::XPathFilterError,
+ "DSIGXPathFilterExpr::setFilter - called when already loaded");
+ }
+
+ safeBuffer str;
+ const XMLCh * prefix;
+ DOMDocument *doc = mp_env->getParentDocument();
+ DOMElement * xe;
+
+ // Create the XPath element
+ prefix = mp_env->getXPFNSPrefix();
+ makeQName(str, prefix, "XPath");
+ xe = doc->createElementNS(DSIGConstants::s_unicodeStrURIXPF, str.rawXMLChBuffer());
+ mp_xpathFilterNode = xe;
+
+ // Put in correct namespace
+ prefix = mp_env->getXPFNSPrefix();
+
+ // Set the namespace attribute
+ if (prefix[0] == '\0') {
+ str.sbTranscodeIn("xmlns");
+ }
+ else {
+ str.sbTranscodeIn("xmlns:");
+ str.sbXMLChCat(prefix);
+ }
+
+ xe->setAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
+ str.rawXMLChBuffer(),
+ DSIGConstants::s_unicodeStrURIXPF);
+
+ // Set the filter type
+ m_filterType = filterType;
+
+ switch (filterType) {
+
+ case FILTER_INTERSECT :
+ xe->setAttributeNS(NULL,MAKE_UNICODE_STRING("Filter"), MAKE_UNICODE_STRING("intersect"));
+ break;
+
+ case FILTER_SUBTRACT :
+ xe->setAttributeNS(NULL,MAKE_UNICODE_STRING("Filter"), MAKE_UNICODE_STRING("subtract"));
+ break;
+
+ case FILTER_UNION :
+ xe->setAttributeNS(NULL,MAKE_UNICODE_STRING("Filter"), MAKE_UNICODE_STRING("union"));
+ break;
+
+ default :
+ mp_xpathFilterNode->release();
+ throw XSECException(XSECException::XPathFilterError,
+ "DSIGXPathFilterExpr::appendFilter - Unexpected Filter Type");
+ }
+
+ // Now add the actual filter
+
+ mp_exprTextNode = doc->createTextNode(filterExpr);
+ mp_xpathFilterNode->appendChild(mp_exprTextNode);
+
+ mp_NSMap = mp_xpathFilterNode->getAttributes();
+
+ m_expr.sbXMLChIn(filterExpr);
+ m_loaded = true;
+ return xe;
}
@@ -235,103 +217,49 @@ DOMElement * DSIGXPathFilterExpr::setFil
// Find the type
// --------------------------------------------------------------------------------
-xpathFilterType DSIGXPathFilterExpr::getFilterType(void) const {
-
- if (m_loaded == false) {
- throw XSECException(XSECException::LoadEmptyXPathFilter,
- "DSIGXPathFilterExpr::Element node loaded");
- }
+DSIGXPathFilterExpr::XPathFilterType DSIGXPathFilterExpr::getFilterType() const {
- return m_filterType;
+ if (m_loaded == false) {
+ throw XSECException(XSECException::LoadEmptyXPathFilter,
+ "DSIGXPathFilterExpr::Element node loaded");
+ }
+ return m_filterType;
}
// --------------------------------------------------------------------------------
// Set and clear namespaces
// --------------------------------------------------------------------------------
-void DSIGXPathFilterExpr::setNamespace(const XMLCh * prefix, const XMLCh * value) {
+void DSIGXPathFilterExpr::setNamespace(const XMLCh* prefix, const XMLCh* value) {
- if (mp_xpathFilterNode == NULL) {
+ if (mp_xpathFilterNode == NULL) {
+ throw XSECException(XSECException::XPathFilterError,
+ "DSIGXPathFilterExpr::setNamespace - load not called");
+ }
- throw XSECException(XSECException::XPathFilterError,
- "DSIGXPathFilterExpr::setNamespace - load not called");
+ safeBuffer str;
- }
-
- safeBuffer str;
+ str.sbTranscodeIn("xmlns:");
+ str.sbXMLChCat(prefix);
- str.sbTranscodeIn("xmlns:");
- str.sbXMLChCat(prefix);
-
- DOMElement *x;
-
- x = static_cast <DOMElement *> (mp_xpathFilterNode);
-
- x->setAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
- str.rawXMLChBuffer(),
- value);
-
- mp_NSMap = mp_xpathFilterNode->getAttributes();
+ DOMElement* x = static_cast <DOMElement *> (mp_xpathFilterNode);
+ x->setAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
+ str.rawXMLChBuffer(),
+ value);
+ mp_NSMap = mp_xpathFilterNode->getAttributes();
}
-void DSIGXPathFilterExpr::deleteNamespace(const XMLCh * prefix) {
-
- if (mp_xpathFilterNode == NULL) {
-
- throw XSECException(XSECException::XPathFilterError,
- "DSIGXPathFilterExpr::deleteNamespace - load not called");
-
- }
+void DSIGXPathFilterExpr::deleteNamespace(const XMLCh* prefix) {
- DOMElement *x;
+ if (mp_xpathFilterNode == NULL) {
+ throw XSECException(XSECException::XPathFilterError,
+ "DSIGXPathFilterExpr::deleteNamespace - load not called");
+ }
- x = static_cast <DOMElement *> (mp_xpathFilterNode);
-
- x->removeAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS,
- prefix);
+ DOMElement* x = static_cast <DOMElement *> (mp_xpathFilterNode);
+ x->removeAttributeNS(DSIGConstants::s_unicodeStrURIXMLNS, prefix);
}
-
-
-
- /**
- * \brief Add a new namespace to the list to be used
- *
- * Add a new namespace to the XPath Element.
- *
- * @param prefix NCName of the Namespace to set
- * @param value The string with the URI to set
- */
-
-// void setNamespace(const char * prefix, const char * value);
-
- /**
- * \brief Get the list of namespaces.
- *
- * Returns the DOMNamedNodeMap of the attributes of the XPath transform
- * node. This <em>should</em> only contain namespaces.
- *
- * @returns A pointer to the NamedNodeMap
- */
-
-// DOMNamedNodeMap * getNamespaces(void) {
-// return mp_NSMap;
-// }
-
- /**
- * \brief Delete a namespace to the list to be used
- *
- * Delete a namespace from the XPath Element.
- *
- * @param prefix NCName of the Namespace to delete
- * @throws XSECException if the NCName does not exist
- *
- */
-
-// void deleteNamespace(const char * prefix);
-
- //@}
-
Modified: santuario/xml-security-cpp/trunk/xsec/dsig/DSIGXPathFilterExpr.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/dsig/DSIGXPathFilterExpr.hpp?rev=1818084&r1=1818083&r2=1818084&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/dsig/DSIGXPathFilterExpr.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/dsig/DSIGXPathFilterExpr.hpp Thu Dec 14 00:11:29 2017
@@ -57,148 +57,153 @@ class XSEC_EXPORT DSIGXPathFilterExpr {
public:
- /** @name Constructors and Destructors */
- //@{
+ /**
+ * \brief Enumeration of XPath Filter types
+ */
+
+ enum XPathFilterType {
+ FILTER_UNION = 0, /** Results should be added to previous nodeset */
+ FILTER_INTERSECT = 1, /** Results should be included if in previous nodeset */
+ FILTER_SUBTRACT = 2 /** Results should be subtracted from previous nodeset */
+ };
+
+ /** @name Constructors and Destructors */
+ //@{
+
+ /**
+ * \brief Constructor used for existing XML signatures
+ *
+ * Node already exists and is part of an existing XPathFilter tree
+ *
+ * @param env The operating environment
+ * @param node The node that will be used to read the expression in
+ */
+
+ DSIGXPathFilterExpr(const XSECEnv* env, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* node);
+
+ /**
+ * \brief Builder constructor
+ *
+ * Used to create the DOM structure and DSIGSignature elements
+ *
+ * @param env The operating Environment
+ */
+
+ DSIGXPathFilterExpr(const XSECEnv* env);
+
+ /**
+ * \brief Destructor.
+ *
+ * Destroy the DSIGSignature elements.
+ *
+ * Does not destroy any associated DOM Nodes
+ */
+
+ virtual ~DSIGXPathFilterExpr();
+
+ //@}
+
+ /** @name Set and get Information */
+
+ //@{
+
+ /**
+ * \brief Read in existing structure
+ *
+ * Reads DOM structure of the XPath expression
+ */
+
+ void load();
+
+ /**
+ * \brief Get the filter type
+ *
+ * Returns the type of this particular XPath filter
+ *
+ * @returns The filter type of this expression
+ */
+
+ XPathFilterType getFilterType() const;
+
+ /**
+ * \brief create from blank
+ *
+ * Given the filter type and XPath expression, setup the
+ * DOMNodes and variables to allow signing and validation
+ *
+ * @param filterType Type of this filter to add
+ * @param filterExpr The XPath expression
+ */
+
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMElement* setFilter(XPathFilterType filterType,
+ const XMLCh* filterExpr);
+
+ /**
+ * \brief Get the filter expression
+ *
+ * Returns an XMLCh string containing the filter expression
+ *
+ * @returns The filter expression
+ */
+
+ const XMLCh* getFilter() const {return m_expr.rawXMLChBuffer();}
+
+ /**
+ * \brief Add a new namespace to the list to be used
+ *
+ * Add a new namespace to the XPath Element.
+ *
+ * @param prefix NCName of the Namespace to set
+ * @param value The string with the URI to set
+ */
+
+ void setNamespace(const XMLCh* prefix, const XMLCh* value);
+
+ /**
+ * \brief Get the list of namespaces.
+ *
+ * Returns the DOMNamedNodeMap of the attributes of the XPath transform
+ * node.
+ *
+ * @note This will also contain the Filter attribute
+ *
+ * @returns A pointer to the NamedNodeMap
+ */
+
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap* getNamespaces() const {
+ return mp_NSMap;
+ }
+
+ /**
+ * \brief Delete a namespace to the list to be used
+ *
+ * Delete a namespace from the XPath Element.
+ *
+ * @param prefix NCName of the Namespace to delete
+ * @throws XSECException if the NCName does not exist
+ *
+ */
- /**
- * \brief Constructor used for existing XML signatures
- *
- * Node already exists and is part of an existing XPathFilter tree
- *
- * @param env The operating environment
- * @param node The node that will be used to read the expression in
- */
-
- DSIGXPathFilterExpr(const XSECEnv * env, XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * node);
-
- /**
- * \brief Builder constructor
- *
- * Used to create the DOM structure and DSIGSignature elements
- *
- * @param env The operating Environment
- */
-
- DSIGXPathFilterExpr(const XSECEnv * env);
-
- /**
- * \brief Destructor.
- *
- * Destroy the DSIGSignature elements.
- *
- * Does not destroy any associated DOM Nodes
- */
-
- ~DSIGXPathFilterExpr();
-
- //@}
-
- /** @name Set and get Information */
-
- //@{
-
- /**
- * \brief Read in existing structure
- *
- * Reads DOM structure of the XPath expression
- */
-
- void load(void);
-
- /**
- * \brief Get the filter type
- *
- * Returns the type of this particular XPath filter
- *
- * @returns The filter type of this expression
- */
-
- xpathFilterType getFilterType(void) const;
-
- /**
- * \brief create from blank
- *
- * Given the filter type and XPath expression, setup the
- * DOMNodes and variables to allow signing and validation
- *
- * @param filterType Type of this filter to add
- * @param filterExpr The XPath expression
- */
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMElement * setFilter(xpathFilterType filterType,
- const XMLCh * filterExpr);
-
- /**
- * \brief Get the filter expression
- *
- * Returns an XMLCh string containing the filter expression
- *
- * @returns The filter expression
- */
-
- const XMLCh * getFilter(void) const {return m_expr.rawXMLChBuffer();}
-
- /**
- * \brief Add a new namespace to the list to be used
- *
- * Add a new namespace to the XPath Element.
- *
- * @param prefix NCName of the Namespace to set
- * @param value The string with the URI to set
- */
-
- void setNamespace(const XMLCh * prefix, const XMLCh * value);
-
- /**
- * \brief Get the list of namespaces.
- *
- * Returns the DOMNamedNodeMap of the attributes of the XPath transform
- * node.
- *
- * @note This will also contain the Filter attribute
- *
- * @returns A pointer to the NamedNodeMap
- */
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap * getNamespaces(void) const {
- return mp_NSMap;
- }
-
- /**
- * \brief Delete a namespace to the list to be used
- *
- * Delete a namespace from the XPath Element.
- *
- * @param prefix NCName of the Namespace to delete
- * @throws XSECException if the NCName does not exist
- *
- */
+ void deleteNamespace(const XMLCh* prefix);
- void deleteNamespace(const XMLCh * prefix);
+ //@}
- //@}
-
private:
- // Just let the TXFM read directly
+ // Just let the TXFM read directly
- friend class TXFMXPathFilter;
-
- DSIGXPathFilterExpr();
- DSIGXPathFilterExpr(const DSIGXPathFilterExpr& theOther);
-
- const XSECEnv * mp_env;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * mp_xpathFilterNode;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * mp_exprTextNode;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap
- * mp_NSMap;
- safeBuffer m_expr;
- xpathFilterType m_filterType;
- bool m_loaded;
+ friend class TXFMXPathFilter;
+ DSIGXPathFilterExpr();
+ DSIGXPathFilterExpr(const DSIGXPathFilterExpr& theOther);
+ const XSECEnv* mp_env;
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* mp_xpathFilterNode;
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* mp_exprTextNode;
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap* mp_NSMap;
+ safeBuffer m_expr;
+ XPathFilterType m_filterType;
+ bool m_loaded;
};
#endif /* DSIGXPATHFILTEREXPR_INCLUDE */
Modified: santuario/xml-security-cpp/trunk/xsec/tools/siginf/siginf.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/tools/siginf/siginf.cpp?rev=1818084&r1=1818083&r2=1818084&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/tools/siginf/siginf.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/tools/siginf/siginf.cpp Thu Dec 14 00:11:29 2017
@@ -212,10 +212,10 @@ void outputTransform(const DSIGTransform
switch (e->getFilterType()) {
- case FILTER_UNION :
+ case DSIGXPathFilterExpr::FILTER_UNION :
cout << "union : \"";
break;
- case FILTER_INTERSECT :
+ case DSIGXPathFilterExpr::FILTER_INTERSECT :
cout << "intersect : \"";
break;
default :
Modified: santuario/xml-security-cpp/trunk/xsec/tools/xtest/xtest.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/tools/xtest/xtest.cpp?rev=1818084&r1=1818083&r2=1818084&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/tools/xtest/xtest.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/tools/xtest/xtest.cpp Thu Dec 14 00:11:29 2017
@@ -1261,7 +1261,7 @@ void testSignature(DOMImplementation *im
DSIGConstants::s_unicodeStrURISHA1);
sig->setXPFNSPrefix(MAKE_UNICODE_STRING("xpf"));
DSIGTransformXPathFilter * xpf = ref[7]->appendXPathFilterTransform();
- xpf->appendFilter(FILTER_INTERSECT, MAKE_UNICODE_STRING("//ADoc/category"));
+ xpf->appendFilter(DSIGXPathFilterExpr::FILTER_INTERSECT, MAKE_UNICODE_STRING("//ADoc/category"));
ref[8] = sig->createReference(MAKE_UNICODE_STRING(""),
DSIGConstants::s_unicodeStrURISHA1);
Modified: santuario/xml-security-cpp/trunk/xsec/transformers/TXFMXPathFilter.cpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/transformers/TXFMXPathFilter.cpp?rev=1818084&r1=1818083&r2=1818084&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/transformers/TXFMXPathFilter.cpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/transformers/TXFMXPathFilter.cpp Thu Dec 14 00:11:29 2017
@@ -42,7 +42,7 @@ XERCES_CPP_NAMESPACE_USE
#ifdef XSEC_HAVE_XALAN
#if defined(_MSC_VER)
-# pragma warning(disable: 4267)
+# pragma warning(disable: 4267)
#endif
#include <xalanc/XalanDOM/XalanDocument.hpp>
@@ -62,7 +62,7 @@ XERCES_CPP_NAMESPACE_USE
#include <xalanc/XSLT/XSLTResultTarget.hpp>
#if defined(_MSC_VER)
-# pragma warning(default: 4267)
+# pragma warning(default: 4267)
#endif
// Xalan namespace usage
@@ -98,638 +98,552 @@ XALAN_USING_XALAN(XSLException)
// Helper functions - come from DSIGXPath
-void setXPathNS(DOMDocument *d,
- DOMNamedNodeMap *xAtts,
- XSECXPathNodeList &addedNodes,
- XSECSafeBufferFormatter *formatter,
- XSECNameSpaceExpander * nse);
-
-void clearXPathNS(DOMDocument *d,
- XSECXPathNodeList &toRemove,
- XSECSafeBufferFormatter *formatter,
- XSECNameSpaceExpander * nse);
+void setXPathNS(DOMDocument* d,
+ DOMNamedNodeMap* xAtts,
+ XSECXPathNodeList& addedNodes,
+ XSECSafeBufferFormatter* formatter,
+ XSECNameSpaceExpander* nse);
+
+void clearXPathNS(DOMDocument*d,
+ XSECXPathNodeList& toRemove,
+ XSECSafeBufferFormatter* formatter,
+ XSECNameSpaceExpander* nse);
bool separator(unsigned char c);
-XalanNode * findHereNodeFromXalan(XercesWrapperNavigator * xwn, XalanNode * n, DOMNode *h);
+XalanNode* findHereNodeFromXalan(XercesWrapperNavigator* xwn, XalanNode* n, DOMNode* h);
+TXFMXPathFilter::TXFMXPathFilter(DOMDocument* doc) :
+ TXFMBase(doc) {
-TXFMXPathFilter::TXFMXPathFilter(DOMDocument *doc) :
- TXFMBase(doc) {
-
- document = NULL;
- XSECnew(mp_formatter, XSECSafeBufferFormatter("UTF-8",XMLFormatter::NoEscapes,
- XMLFormatter::UnRep_CharRef));
-
+ document = NULL;
+ XSECnew(mp_formatter, XSECSafeBufferFormatter("UTF-8",XMLFormatter::NoEscapes,
+ XMLFormatter::UnRep_CharRef));
}
TXFMXPathFilter::~TXFMXPathFilter() {
- lstsVectorType::iterator i;
-
- for (i = m_lsts.begin(); i != m_lsts.end(); ++i) {
-
- if ((*i)->lst != NULL)
- delete ((*i)->lst);
+ lstsVectorType::iterator i;
- delete (*i);
+ for (i = m_lsts.begin(); i != m_lsts.end(); ++i) {
- }
+ if ((*i)->lst != NULL)
+ delete ((*i)->lst);
- if (mp_formatter != NULL)
- delete mp_formatter;
+ delete (*i);
+ }
-
+ if (mp_formatter != NULL)
+ delete mp_formatter;
}
// Methods to set the inputs
-void TXFMXPathFilter::setInput(TXFMBase *newInput) {
+void TXFMXPathFilter::setInput(TXFMBase* newInput) {
- if (newInput->getOutputType() == TXFMBase::BYTE_STREAM) {
+ if (newInput->getOutputType() == TXFMBase::BYTE_STREAM) {
- // Need to parse into DOM_NODES
+ // Need to parse into DOM_NODES
- TXFMParser * parser;
- XSECnew(parser, TXFMParser(mp_expansionDoc));
- try{
- parser->setInput(newInput);
- }
- catch (...) {
- delete parser;
- input = newInput;
- throw;
- }
+ TXFMParser * parser;
+ XSECnew(parser, TXFMParser(mp_expansionDoc));
+ try{
+ parser->setInput(newInput);
+ }
+ catch (...) {
+ delete parser;
+ input = newInput;
+ throw;
+ }
- input = parser;
- parser->expandNameSpaces();
- }
- else
- input = newInput;
+ input = parser;
+ parser->expandNameSpaces();
+ }
+ else {
+ input = newInput;
+ }
- // Set up for the new document
- document = input->getDocument();
+ // Set up for the new document
+ document = input->getDocument();
- // Expand if necessary
- this->expandNameSpaces();
-
- keepComments = input->getCommentsStatus();
+ // Expand if necessary
+ this->expandNameSpaces();
+ keepComments = input->getCommentsStatus();
}
-XSECXPathNodeList * TXFMXPathFilter::evaluateSingleExpr(DSIGXPathFilterExpr *expr) {
-
- // Have a single expression that we wish to find the resultant nodeset
- // for
-
- XSECXPathNodeList addedNodes;
- setXPathNS(document, expr->mp_NSMap, addedNodes, mp_formatter, mp_nse);
+XSECXPathNodeList* TXFMXPathFilter::evaluateSingleExpr(DSIGXPathFilterExpr* expr) {
- XPathProcessorImpl xppi; // The processor
- XercesParserLiaison xpl;
- XercesDOMSupport xds(xpl);
- XPathEvaluator xpe;
- XPathFactoryDefault xpf;
- XPathConstructionContextDefault xpcc;
+ // Have a single expression that we wish to find the resultant nodeset for
- XalanDocument * xd;
- XalanNode * contextNode;
+ XSECXPathNodeList addedNodes;
+ setXPathNS(document, expr->mp_NSMap, addedNodes, mp_formatter, mp_nse);
- // Xalan can throw exceptions in all functions, so do one broad catch point.
+ XPathProcessorImpl xppi; // The processor
+ XercesParserLiaison xpl;
+ XercesDOMSupport xds(xpl);
+ XPathEvaluator xpe;
+ XPathFactoryDefault xpf;
+ XPathConstructionContextDefault xpcc;
- try {
-
- // Map to Xalan
- xd = xpl.createDocument(document);
+ XalanDocument * xd;
+ XalanNode * contextNode;
- // For performing mapping
- XercesDocumentWrapper *xdw = xpl.mapDocumentToWrapper(xd);
- XercesWrapperNavigator xwn(xdw);
+ // Xalan can throw exceptions in all functions, so do one broad catch point.
- // Map the "here" node
+ try {
- XalanNode * hereNode = NULL;
+ // Map to Xalan
+ xd = xpl.createDocument(document);
- hereNode = xwn.mapNode(expr->mp_xpathFilterNode);
+ // For performing mapping
+ XercesDocumentWrapper *xdw = xpl.mapDocumentToWrapper(xd);
+ XercesWrapperNavigator xwn(xdw);
- if (hereNode == NULL) {
+ // Map the "here" node
- hereNode = findHereNodeFromXalan(&xwn, xd, expr->mp_exprTextNode);
+ XalanNode * hereNode = NULL;
- if (hereNode == NULL) {
+ hereNode = xwn.mapNode(expr->mp_xpathFilterNode);
- throw XSECException(XSECException::XPathFilterError,
- "Unable to find here node in Xalan Wrapper map");
- }
+ if (hereNode == NULL) {
- }
+ hereNode = findHereNodeFromXalan(&xwn, xd, expr->mp_exprTextNode);
- // Now work out what we have to set up in the new processing
+ if (hereNode == NULL) {
+ throw XSECException(XSECException::XPathFilterError,
+ "Unable to find here node in Xalan Wrapper map");
+ }
+ }
- XalanDOMString cd; // For XPath Filter, the root is always the context node
+ // Now work out what we have to set up in the new processing
- cd = XalanDOMString("/"); // Root node
+ XalanDOMString cd; // For XPath Filter, the root is always the context node
- // The context node is the "root" node
- contextNode =
- xpe.selectSingleNode(
- xds,
- xd,
- cd.c_str(),
- xd->getDocumentElement());
+ cd = XalanDOMString("/"); // Root node
- XPathEnvSupportDefault xpesd;
- XObjectFactoryDefault xof;
- XPathExecutionContextDefault xpec(xpesd, xds, xof);
+ // The context node is the "root" node
+ contextNode =
+ xpe.selectSingleNode(
+ xds,
+ xd,
+ cd.c_str(),
+ xd->getDocumentElement());
- ElementPrefixResolverProxy pr(xd->getDocumentElement(), xpesd, xds);
+ XPathEnvSupportDefault xpesd;
+ XObjectFactoryDefault xof;
+ XPathExecutionContextDefault xpec(xpesd, xds, xof);
- // Work around the fact that the XPath implementation is designed for XSLT, so does
- // not allow here() as a NCName.
+ ElementPrefixResolverProxy pr(xd->getDocumentElement(), xpesd, xds);
- // THIS IS A KLUDGE AND SHOULD BE DONE BETTER
+ // Work around the fact that the XPath implementation is designed for XSLT, so does
+ // not allow here() as a NCName.
- safeBuffer k(KLUDGE_PREFIX);
- k.sbStrcatIn(":");
+ // THIS IS A KLUDGE AND SHOULD BE DONE BETTER
- // Map the expression into a local code page string (silly - should be XMLCh)
- safeBuffer exprSB;
- exprSB << (*mp_formatter << expr->m_expr.rawXMLChBuffer());
+ safeBuffer k(KLUDGE_PREFIX);
+ k.sbStrcatIn(":");
- XMLSSize_t offset = exprSB.sbStrstr("here()");
+ // Map the expression into a local code page string (silly - should be XMLCh)
+ safeBuffer exprSB;
+ exprSB << (*mp_formatter << expr->m_expr.rawXMLChBuffer());
- while (offset >= 0) {
+ XMLSSize_t offset = exprSB.sbStrstr("here()");
- if (offset == 0 || offset == 1 ||
- (!(exprSB[offset - 1] == ':' && exprSB[offset - 2] != ':') &&
- separator(exprSB[offset - 1]))) {
+ while (offset >= 0) {
- exprSB.sbStrinsIn(k.rawCharBuffer(), offset);
+ if (offset == 0 || offset == 1 ||
+ (!(exprSB[offset - 1] == ':' && exprSB[offset - 2] != ':') &&
+ separator(exprSB[offset - 1]))) {
- }
+ exprSB.sbStrinsIn(k.rawCharBuffer(), offset);
+ }
- offset = exprSB.sbOffsetStrstr("here()", offset + 11);
+ offset = exprSB.sbOffsetStrstr("here()", offset + 11);
+ }
- }
+ // Install the External function in the Environment handler
- // Install the External function in the Environment handler
+ if (hereNode != NULL) {
+ xpesd.installExternalFunctionLocal(XalanDOMString(URI_ID_DSIG), XalanDOMString("here"), DSIGXPathHere(hereNode));
+ }
- if (hereNode != NULL) {
+ XPath * xp = xpf.create();
- xpesd.installExternalFunctionLocal(XalanDOMString(URI_ID_DSIG), XalanDOMString("here"), DSIGXPathHere(hereNode));
+ XalanDOMString Xexpr((char *) exprSB.rawBuffer());
+ xppi.initXPath(*xp, xpcc, Xexpr, pr);
- }
+ // Now resolve
- XPath * xp = xpf.create();
+ XObjectPtr xObj = xp->execute(contextNode, pr, xpec);
- XalanDOMString Xexpr((char *) exprSB.rawBuffer());
- xppi.initXPath(*xp, xpcc, Xexpr, pr);
-
- // Now resolve
+ // Now map to a list that others can use (naieve list at this time)
- XObjectPtr xObj = xp->execute(contextNode, pr, xpec);
+ const NodeRefListBase& lst = xObj->nodeset();
- // Now map to a list that others can use (naieve list at this time)
+ int size = (int) lst.getLength();
+ const DOMNode *item;
- const NodeRefListBase& lst = xObj->nodeset();
-
- int size = (int) lst.getLength();
- const DOMNode *item;
-
- XSECXPathNodeList * ret;
- XSECnew(ret, XSECXPathNodeList);
- Janitor<XSECXPathNodeList> j_ret(ret);
+ XSECXPathNodeList * ret;
+ XSECnew(ret, XSECXPathNodeList);
+ Janitor<XSECXPathNodeList> j_ret(ret);
- for (int i = 0; i < size; ++ i) {
+ for (int i = 0; i < size; ++ i) {
- if (lst.item(i) == xd)
- ret->addNode(document);
- else {
- item = xwn.mapNode(lst.item(i));
- ret->addNode(item);
- }
- }
+ if (lst.item(i) == xd)
+ ret->addNode(document);
+ else {
+ item = xwn.mapNode(lst.item(i));
+ ret->addNode(item);
+ }
+ }
- xpesd.uninstallExternalFunctionGlobal(XalanDOMString(URI_ID_DSIG), XalanDOMString("here"));
+ xpesd.uninstallExternalFunctionGlobal(XalanDOMString(URI_ID_DSIG), XalanDOMString("here"));
- clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
+ clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
- j_ret.release();
- return ret;
+ j_ret.release();
+ return ret;
+ }
+ catch (const XSLException &e) {
- }
+ safeBuffer msg;
- catch (const XSLException &e) {
+ // Whatever happens - fix any changes to the original document
+ clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
- safeBuffer msg;
+ // Collate the exception message into an XSEC message.
+ msg.sbTranscodeIn("Xalan Exception : ");
+ msg.sbXMLChCat(e.getType());
+ msg.sbXMLChCat(" caught. Message : ");
+ msg.sbXMLChCat(e.getMessage().c_str());
- // Whatever happens - fix any changes to the original document
- clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
-
- // Collate the exception message into an XSEC message.
- msg.sbTranscodeIn("Xalan Exception : ");
- msg.sbXMLChCat(e.getType());
- msg.sbXMLChCat(" caught. Message : ");
- msg.sbXMLChCat(e.getMessage().c_str());
+ throw XSECException(XSECException::XPathFilterError,
+ msg.rawXMLChBuffer());
+ }
+ catch (...) {
+ clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
+ throw;
+ }
- throw XSECException(XSECException::XPathFilterError,
- msg.rawXMLChBuffer());
-
- }
-
- catch (...) {
- clearXPathNS(document, addedNodes, mp_formatter, mp_nse);
- throw;
- }
-
- return NULL;
+ return NULL;
}
-bool TXFMXPathFilter::checkNodeInInput(DOMNode * n, DOMNode * attParent) {
+bool TXFMXPathFilter::checkNodeInInput(DOMNode* n, DOMNode* attParent) {
- if (mp_fragment != NULL) {
+ if (mp_fragment != NULL) {
- DOMNode * p = n;
+ DOMNode * p = n;
- /* Check attParent here to reduce cycles */
- if (attParent != NULL) {
- if (p == mp_fragment)
- return true;
- p = attParent;
- }
+ /* Check attParent here to reduce cycles */
+ if (attParent != NULL) {
+ if (p == mp_fragment)
+ return true;
+ p = attParent;
+ }
- while (p != NULL) {
+ while (p != NULL) {
- if (p == mp_fragment)
- return true;
-
- p = p->getParentNode();
+ if (p == mp_fragment)
+ return true;
- }
+ p = p->getParentNode();
+ }
- return false;
-
- }
-
- return mp_inputList->hasNode(n);
+ return false;
+ }
+ return mp_inputList->hasNode(n);
}
-bool TXFMXPathFilter::checkNodeInScope(DOMNode * n) {
-
- // Walk backwards through the lists
- lstsVectorType::iterator lstsIter;
+bool TXFMXPathFilter::checkNodeInScope(DOMNode* n) {
- lstsIter = m_lsts.end();
- filterSetHolder *sh;
+ // Walk backwards through the lists
+ lstsVectorType::iterator lstsIter;
- while (lstsIter != m_lsts.begin()) {
+ lstsIter = m_lsts.end();
+ filterSetHolder *sh;
- lstsIter--;
- sh = *lstsIter;
- if (sh->ancestorInScope != NULL) {
+ while (lstsIter != m_lsts.begin()) {
- // Have an ancestor in scope, so this node is in this list
- if (sh->type == FILTER_UNION)
- // Got this far, must be OK!
- return true;
- if (sh->type == FILTER_SUBTRACT)
- return false;
+ lstsIter--;
+ sh = *lstsIter;
+ if (sh->ancestorInScope != NULL) {
- }
- else {
-
- if (sh->type == FILTER_INTERSECT)
- return false;
-
- }
-
- }
-
- return true;
+ // Have an ancestor in scope, so this node is in this list
+ if (sh->type == DSIGXPathFilterExpr::FILTER_UNION)
+ // Got this far, must be OK!
+ return true;
+ if (sh->type == DSIGXPathFilterExpr::FILTER_SUBTRACT)
+ return false;
+ }
+ else {
+ if (sh->type == DSIGXPathFilterExpr::FILTER_INTERSECT)
+ return false;
+ }
+ }
+ return true;
}
-#if 1
-void TXFMXPathFilter::walkDocument(DOMNode * n) {
-
- // Non-recursive version
-
- DOMNode * current = n;
- DOMNode * next;
- DOMNode * attParent = NULL; /* Assign NULL to remove spurious Forte warning */
- bool done = false;
- bool treeUp = false;
- DOMNamedNodeMap * atts = n->getAttributes();
- int attsSize = -1;
- int currentAtt = -1;
- lstsVectorType::iterator lstsIter;
-
- while (done == false && current != NULL) {
-
- if (treeUp == true) {
-
- if (current == n) {
-
- // We are complete.
- done = true;
-
- }
-
- else {
-
- // Remove this node from the ancestor lists
- for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
-
- if ((*lstsIter)->ancestorInScope == current) {
- (*lstsIter)->ancestorInScope = NULL;
- }
- }
-
-
- // Check for another sibling
- next = current->getNextSibling();
-
- if (next == NULL) {
-
- current = current->getParentNode();
- treeUp = true;
- }
-
- else {
-
- current = next;
- treeUp = false;
-
- }
-
- }
-
- } /* treeUp == true */
-
- else {
-
- // Check if the current node is in the result set. The walk the children
-
- // First check if this node is in any lists, and if so,
- // set the appropriate ancestor nodes (if necessary)
-
- for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
-
- if ((*lstsIter)->ancestorInScope == NULL &&
- (*lstsIter)->lst->hasNode(current)) {
-
- (*lstsIter)->ancestorInScope = current;
-
- }
-
- //
- }
-
- // Now that the ancestor setup is done, check to see if this node is
- // in scope.
-
- if (checkNodeInScope(current) &&
- checkNodeInInput(current, (atts != NULL ? attParent : NULL))) {
-
- m_xpathFilterMap.addNode(current);
-
- }
-
- // Now find the next node!
- if (atts != NULL) {
-
- // Working on an attribute list
- currentAtt++;
-
- if (currentAtt == attsSize) {
-
- // Attribute list complete
- atts = NULL;
- current = attParent;
- next = current->getFirstChild();
- if (next == NULL)
- treeUp = true;
- else {
- current = next;
- treeUp = false;
- }
-
- }
-
- else {
-
- current = atts->item(currentAtt);
-
- }
-
- }
-
- else {
- // Working on an element or other non-attribute node
- atts = current->getAttributes();
-
- if (atts != NULL && ((attsSize = atts->getLength()) > 0)) {
-
- currentAtt = 0;
- attParent = current;
- current = atts->item(0);
- treeUp = false;
-
- }
-
- else {
-
- atts = NULL;
-
- next = current->getFirstChild();
-
- if (next != NULL) {
- current = next;
- treeUp = false;
- }
-
- else {
+#if 1
- treeUp = true;
+void TXFMXPathFilter::walkDocument(DOMNode* n) {
- }
+ // Non-recursive version
- }
- } /* ! atts == NULL */
- }
- } /* while */
+ DOMNode * current = n;
+ DOMNode * next;
+ DOMNode * attParent = NULL; /* Assign NULL to remove spurious Forte warning */
+ bool done = false;
+ bool treeUp = false;
+ DOMNamedNodeMap * atts = n->getAttributes();
+ int attsSize = -1;
+ int currentAtt = -1;
+ lstsVectorType::iterator lstsIter;
+
+ while (done == false && current != NULL) {
+
+ if (treeUp == true) {
+
+ if (current == n) {
+ // We are complete.
+ done = true;
+ }
+ else {
+ // Remove this node from the ancestor lists
+ for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
+
+ if ((*lstsIter)->ancestorInScope == current) {
+ (*lstsIter)->ancestorInScope = NULL;
+ }
+ }
+
+ // Check for another sibling
+ next = current->getNextSibling();
+
+ if (next == NULL) {
+ current = current->getParentNode();
+ treeUp = true;
+ }
+ else {
+ current = next;
+ treeUp = false;
+ }
+ }
+ } /* treeUp == true */
+ else {
+ // Check if the current node is in the result set. The walk the children
+
+ // First check if this node is in any lists, and if so,
+ // set the appropriate ancestor nodes (if necessary)
+
+ for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
+
+ if ((*lstsIter)->ancestorInScope == NULL &&
+ (*lstsIter)->lst->hasNode(current)) {
+
+ (*lstsIter)->ancestorInScope = current;
+ }
+ }
+
+ // Now that the ancestor setup is done, check to see if this node is
+ // in scope.
+
+ if (checkNodeInScope(current) &&
+ checkNodeInInput(current, (atts != NULL ? attParent : NULL))) {
+
+ m_xpathFilterMap.addNode(current);
+ }
+
+ // Now find the next node!
+
+ if (atts != NULL) {
+
+ // Working on an attribute list
+ currentAtt++;
+
+ if (currentAtt == attsSize) {
+
+ // Attribute list complete
+ atts = NULL;
+ current = attParent;
+ next = current->getFirstChild();
+ if (next == NULL)
+ treeUp = true;
+ else {
+ current = next;
+ treeUp = false;
+ }
+ }
+ else {
+ current = atts->item(currentAtt);
+ }
+ }
+ else {
+ // Working on an element or other non-attribute node
+ atts = current->getAttributes();
+
+ if (atts != NULL && ((attsSize = atts->getLength()) > 0)) {
+ currentAtt = 0;
+ attParent = current;
+ current = atts->item(0);
+ treeUp = false;
+ }
+ else {
+ atts = NULL;
+
+ next = current->getFirstChild();
+
+ if (next != NULL) {
+ current = next;
+ treeUp = false;
+ }
+ else {
+ treeUp = true;
+ }
+ }
+ } /* ! atts == NULL */
+ }
+ } /* while */
}
#endif
+
#if 0
void TXFMXPathFilter::walkDocument(DOMNode * n) {
- // Check if the current node is in the result set. The walk the children
- lstsVectorType::iterator lstsIter;
-
- // First check if this node is in any lists, and if so,
- // set the appropriate ancestor nodes (if necessary)
-
- for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
-
- if ((*lstsIter)->ancestorInScope == NULL &&
- (*lstsIter)->lst->hasNode(n)) {
-
- (*lstsIter)->ancestorInScope = n;
-
- }
- }
-
- // Now that the ancestor setup is done, check to see if this node is
- // in scope.
-
- if (checkNodeInScope(n) && checkNodeInInput(n)) {
+ // Check if the current node is in the result set. The walk the children
+ lstsVectorType::iterator lstsIter;
- m_xpathFilterMap.addNode(n);
+ // First check if this node is in any lists, and if so,
+ // set the appropriate ancestor nodes (if necessary)
- }
+ for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
- // Do any attributes
+ if ((*lstsIter)->ancestorInScope == NULL && (*lstsIter)->lst->hasNode(n)) {
+ (*lstsIter)->ancestorInScope = n;
+ }
+ }
- DOMNamedNodeMap * atts = n->getAttributes();
-
- if (atts != NULL) {
+ // Now that the ancestor setup is done, check to see if this node is
+ // in scope.
- unsigned int s = atts->getLength();
- for (unsigned int i = 0; i < s; ++i) {
+ if (checkNodeInScope(n) && checkNodeInInput(n)) {
+ m_xpathFilterMap.addNode(n);
+ }
- walkDocument(atts->item(i));
+ // Do any attributes
- }
+ DOMNamedNodeMap * atts = n->getAttributes();
+ if (atts != NULL) {
+ unsigned int s = atts->getLength();
+ for (unsigned int i = 0; i < s; ++i) {
+ walkDocument(atts->item(i));
+ }
+ }
- }
+ // Do any childeren
- // Do any childeren
+ DOMNode * c = n->getFirstChild();
- DOMNode * c = n->getFirstChild();
+ while (c != NULL) {
+ walkDocument(c);
+ c = c->getNextSibling();
+ }
- while (c != NULL) {
-
- walkDocument(c);
- c = c->getNextSibling();
-
- }
-
- // Now remove from ancestor lists if we are that ancestor
- for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
-
- if ((*lstsIter)->ancestorInScope == n) {
- (*lstsIter)->ancestorInScope = NULL;
- }
- }
+ // Now remove from ancestor lists if we are that ancestor
+ for (lstsIter = m_lsts.begin(); lstsIter != m_lsts.end(); ++lstsIter) {
+ if ((*lstsIter)->ancestorInScope == n) {
+ (*lstsIter)->ancestorInScope = NULL;
+ }
+ }
}
#endif
-void TXFMXPathFilter::evaluateExprs(DSIGTransformXPathFilter::exprVectorType * exprs) {
-
- if (exprs == NULL || exprs->size() < 1) {
-
- throw XSECException(XSECException::XPathFilterError,
- "TXFMXPathFilter::evaluateExpr - no expression list set");
-
- }
-
- DSIGTransformXPathFilter::exprVectorType::iterator i;
-
- for (i = exprs->begin(); i != exprs->end(); ++i) {
-
- XSECXPathNodeList * lst = evaluateSingleExpr(*i);
- filterSetHolder * sh;
- XSECnew(sh, filterSetHolder);
-
- sh->lst = lst;
- sh->type = (*i)->m_filterType;
- sh->ancestorInScope = NULL;
-
- if (lst != NULL) {
-
- m_lsts.push_back(sh);
- }
+void TXFMXPathFilter::evaluateExprs(DSIGTransformXPathFilter::exprVectorType* exprs) {
- }
+ if (exprs == NULL || exprs->size() < 1) {
+ throw XSECException(XSECException::XPathFilterError,
+ "TXFMXPathFilter::evaluateExpr - no expression list set");
+ }
- // Well we appear to have successfully run through all the nodelists!
+ DSIGTransformXPathFilter::exprVectorType::iterator i;
- mp_fragment = NULL;
- mp_inputList = NULL;
+ for (i = exprs->begin(); i != exprs->end(); ++i) {
- // Find the input nodeset
- TXFMBase::nodeType inputType = input->getNodeType();
- switch (inputType) {
+ XSECXPathNodeList * lst = evaluateSingleExpr(*i);
+ filterSetHolder * sh;
+ XSECnew(sh, filterSetHolder);
- case DOM_NODE_DOCUMENT :
+ sh->lst = lst;
+ sh->type = (*i)->m_filterType;
+ sh->ancestorInScope = NULL;
- mp_fragment = document;
- break;
+ if (lst != NULL) {
+ m_lsts.push_back(sh);
+ }
+ }
- case DOM_NODE_DOCUMENT_FRAGMENT :
+ // Well we appear to have successfully run through all the nodelists!
- mp_fragment = input->getFragmentNode();
- break;
+ mp_fragment = NULL;
+ mp_inputList = NULL;
- case DOM_NODE_XPATH_NODESET :
+ // Find the input nodeset
+ TXFMBase::nodeType inputType = input->getNodeType();
+ switch (inputType) {
- mp_inputList = &(input->getXPathNodeList());
- break;
+ case DOM_NODE_DOCUMENT :
+ mp_fragment = document;
+ break;
- default :
+ case DOM_NODE_DOCUMENT_FRAGMENT :
+ mp_fragment = input->getFragmentNode();
+ break;
- throw XSECException(XSECException::XPathFilterError,
- "TXFMXPathFilter::evaluateExprs - unknown input type");
+ case DOM_NODE_XPATH_NODESET :
+ mp_inputList = &(input->getXPathNodeList());
+ break;
- }
-
- // Now just recurse through each node in the document
- walkDocument(document);
+ default :
+ throw XSECException(XSECException::XPathFilterError,
+ "TXFMXPathFilter::evaluateExprs - unknown input type");
+ }
+ // Now just recurse through each node in the document
+ walkDocument(document);
}
-
-
-// Methods to get tranform output type and input requirement
-TXFMBase::ioType TXFMXPathFilter::getInputType(void) const {
- return TXFMBase::DOM_NODES;
+// Methods to get tranform output type and input requirement
+TXFMBase::ioType TXFMXPathFilter::getInputType() const {
+ return TXFMBase::DOM_NODES;
}
-TXFMBase::ioType TXFMXPathFilter::getOutputType(void) const {
-
- return TXFMBase::DOM_NODES;
+TXFMBase::ioType TXFMXPathFilter::getOutputType() const {
+ return TXFMBase::DOM_NODES;
}
-TXFMBase::nodeType TXFMXPathFilter::getNodeType(void) const {
-
- return TXFMBase::DOM_NODE_XPATH_NODESET;
-
+TXFMBase::nodeType TXFMXPathFilter::getNodeType() const {
+ return TXFMBase::DOM_NODE_XPATH_NODESET;
}
// Methods to get output data
-unsigned int TXFMXPathFilter::readBytes(XMLByte * const toFill, unsigned int maxToFill) {
-
- return 0;
-
+unsigned int TXFMXPathFilter::readBytes(XMLByte* const toFill, unsigned int maxToFill) {
+ return 0;
}
-DOMDocument *TXFMXPathFilter::getDocument() const {
-
- return document;
-
+DOMDocument* TXFMXPathFilter::getDocument() const {
+ return document;
}
-XSECXPathNodeList & TXFMXPathFilter::getXPathNodeList() {
-
- return m_xpathFilterMap;
-
+XSECXPathNodeList& TXFMXPathFilter::getXPathNodeList() {
+ return m_xpathFilterMap;
}
#endif /* XSEC_HAVE_XPATH */
Modified: santuario/xml-security-cpp/trunk/xsec/transformers/TXFMXPathFilter.hpp
URL: http://svn.apache.org/viewvc/santuario/xml-security-cpp/trunk/xsec/transformers/TXFMXPathFilter.hpp?rev=1818084&r1=1818083&r2=1818084&view=diff
==============================================================================
--- santuario/xml-security-cpp/trunk/xsec/transformers/TXFMXPathFilter.hpp (original)
+++ santuario/xml-security-cpp/trunk/xsec/transformers/TXFMXPathFilter.hpp Thu Dec 14 00:11:29 2017
@@ -43,12 +43,9 @@ class TXFMXPathFilterExpr;
class XSECSafeBufferFormatter;
struct filterSetHolder {
-
- XSECXPathNodeList * lst;
- xpathFilterType type;
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * ancestorInScope;
-
+ XSECXPathNodeList* lst;
+ DSIGXPathFilterExpr::XPathFilterType type;
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* ancestorInScope;
};
@@ -64,52 +61,48 @@ class XSEC_EXPORT TXFMXPathFilter : publ
public:
- TXFMXPathFilter(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc);
- virtual ~TXFMXPathFilter();
+ TXFMXPathFilter(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* doc);
+ virtual ~TXFMXPathFilter();
- // Methods to set the inputs
+ // Methods to set the inputs
- void setInput(TXFMBase *newInput);
-
- // Methods to get tranform output type and input requirement
+ void setInput(TXFMBase* newInput);
- virtual TXFMBase::ioType getInputType(void) const;
- virtual TXFMBase::ioType getOutputType(void) const;
- virtual TXFMBase::nodeType getNodeType(void) const;
+ // Methods to get tranform output type and input requirement
- // XPathFilter unique
+ virtual TXFMBase::ioType getInputType() const;
+ virtual TXFMBase::ioType getOutputType() const;
+ virtual TXFMBase::nodeType getNodeType() const;
- void evaluateExprs(DSIGTransformXPathFilter::exprVectorType * exprs);
- XSECXPathNodeList * evaluateSingleExpr(DSIGXPathFilterExpr *expr);
+ // XPathFilter unique
- // Methods to get output data
+ void evaluateExprs(DSIGTransformXPathFilter::exprVectorType* exprs);
+ XSECXPathNodeList* evaluateSingleExpr(DSIGXPathFilterExpr* expr);
- virtual unsigned int readBytes(XMLByte * const toFill, const unsigned int maxToFill);
- virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *getDocument() const;
- virtual XSECXPathNodeList & getXPathNodeList();
+ // Methods to get output data
-private:
-
- typedef std::vector<filterSetHolder *> lstsVectorType;
- TXFMXPathFilter();
- void walkDocument(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * n);
- bool checkNodeInScope(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * n);
- bool checkNodeInInput(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * n,
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode * attParent);
-
-
- XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument
- * document;
- XSECXPathNodeList m_xpathFilterMap;
- lstsVectorType m_lsts;
-
- XSECSafeBufferFormatter * mp_formatter;
-
- /* Used to hold details during tree-walk */
- XERCES_CPP_NAMESPACE_QUALIFIER DOMNode
- * mp_fragment;
- XSECXPathNodeList * mp_inputList;
+ virtual unsigned int readBytes(XMLByte* const toFill, const unsigned int maxToFill);
+ virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* getDocument() const;
+ virtual XSECXPathNodeList& getXPathNodeList();
+private:
+ typedef std::vector<filterSetHolder*> lstsVectorType;
+ TXFMXPathFilter();
+ void walkDocument(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* n);
+ bool checkNodeInScope(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* n);
+ bool checkNodeInInput(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* n,
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* attParent);
+
+
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* document;
+ XSECXPathNodeList m_xpathFilterMap;
+ lstsVectorType m_lsts;
+
+ XSECSafeBufferFormatter* mp_formatter;
+
+ /* Used to hold details during tree-walk */
+ XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* mp_fragment;
+ XSECXPathNodeList* mp_inputList;
};
#endif