You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by bl...@apache.org on 2006/10/15 02:03:35 UTC

svn commit: r464075 - /xml/security/trunk/c/src/transformers/TXFMEnvelope.cpp

Author: blautenb
Date: Sat Oct 14 17:03:34 2006
New Revision: 464075

URL: http://svn.apache.org/viewvc?view=rev&rev=464075
Log:
Fix problem in Envelope transforms when intersected with a document fragment

Modified:
    xml/security/trunk/c/src/transformers/TXFMEnvelope.cpp

Modified: xml/security/trunk/c/src/transformers/TXFMEnvelope.cpp
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/src/transformers/TXFMEnvelope.cpp?view=diff&rev=464075&r1=464074&r2=464075
==============================================================================
--- xml/security/trunk/c/src/transformers/TXFMEnvelope.cpp (original)
+++ xml/security/trunk/c/src/transformers/TXFMEnvelope.cpp Sat Oct 14 17:03:34 2006
@@ -27,8 +27,12 @@
 #include <xsec/framework/XSECException.hpp>
 #include <xsec/utils/XSECDOMUtils.hpp>
 
+#include <xercesc/util/XMLString.hpp>
+#include <xercesc/util/XMLUniDefs.hpp>
+
 XERCES_CPP_NAMESPACE_USE
 
+
 TXFMEnvelope::TXFMEnvelope(DOMDocument *doc) :
 TXFMBase(doc) {
 
@@ -152,6 +156,40 @@
 	}
 }
 
+void addEnvelopeParentNSNodes(DOMNode *startNode, XSECXPathNodeList & XPathMap) {
+
+	XSEC_USING_XERCES(DOMNamedNodeMap);
+	
+	DOMNode *tmp;
+	DOMNamedNodeMap *atts;
+	int attsSize, i;
+	
+	if (startNode == NULL)
+		return;
+
+	if (startNode->getNodeType() == DOMNode::ELEMENT_NODE) {
+
+		atts = startNode->getAttributes();
+		if (atts != NULL)
+			attsSize = atts->getLength();
+		else
+			attsSize = 0;
+
+		for (i = 0; i < attsSize; ++i) {
+
+			tmp = atts->item(i);
+			if (XMLString::compareNString(tmp->getNodeName(), DSIGConstants::s_unicodeStrXmlns, 5) == 0 &&
+				(tmp->getNodeName()[5] == chNull || tmp->getNodeName()[5] == chColon))
+				XPathMap.addNode(tmp);
+
+		}
+
+	}
+
+	// Now do parent
+	addEnvelopeParentNSNodes(startNode->getParentNode(), XPathMap);
+	
+}
 
 void TXFMEnvelope::evaluateEnvelope(DOMNode *t) {
 
@@ -182,6 +220,7 @@
 	}
 
 	addEnvelopeNode(mp_startNode, m_XPathMap, sigNode);
+	addEnvelopeParentNSNodes(mp_startNode->getParentNode(), m_XPathMap);
 
 }