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 2009/06/09 18:58:46 UTC
svn commit: r783065 - /xml/security/trunk/c/src/tools/c14n/c14n.cpp
Author: scantor
Date: Tue Jun 9 16:58:45 2009
New Revision: 783065
URL: http://svn.apache.org/viewvc?rev=783065&view=rev
Log:
Add options for enabling 1.1 and exclusive c14n modes.
Modified:
xml/security/trunk/c/src/tools/c14n/c14n.cpp
Modified: xml/security/trunk/c/src/tools/c14n/c14n.cpp
URL: http://svn.apache.org/viewvc/xml/security/trunk/c/src/tools/c14n/c14n.cpp?rev=783065&r1=783064&r2=783065&view=diff
==============================================================================
--- xml/security/trunk/c/src/tools/c14n/c14n.cpp (original)
+++ xml/security/trunk/c/src/tools/c14n/c14n.cpp Tue Jun 9 16:58:45 2009
@@ -56,8 +56,10 @@
void printUsage(void) {
- cerr << "\nUsage: c14n [-n] [-id ID] <input file name>\n";
+ cerr << "\nUsage: c14n [-n] [-x] [-1.1] [-id ID] <input file name>\n";
cerr << " -n = No comments\n";
+ cerr << " -1.1 = Use c14n 1.1\n";
+ cerr << " -x = Use exclusive c14n\n";
cerr << " -id ID = References node to canonicalize by ID\n\n";
}
@@ -65,7 +67,9 @@
int main(int argc, char **argv) {
const char* id = NULL;
- bool printComments = true; // By default print comments
+ bool printComments = true;
+ bool exclusive = false;
+ bool inclusive11 = false;
// Check arguments
@@ -79,6 +83,10 @@
if (!strcmp(argv[i], "-n") || !strcmp(argv[i], "-N"))
printComments = false;
+ else if (!strcmp(argv[i], "-x") || !strcmp(argv[i], "-X"))
+ exclusive = true;
+ else if (!strcmp(argv[i], "-1.1"))
+ inclusive11 = true;
else if (!strcmp(argv[i], "-id") && argc > i + 1)
id = argv[++i];
else {
@@ -175,6 +183,10 @@
canon = new XSECC14n20010315(theDOM);
canon->setCommentsProcessing(printComments);
canon->setUseNamespaceStack(true);
+ if (inclusive11)
+ canon->setInclusive11();
+ else if (exclusive)
+ canon->setExclusive();
// canon->XPathSelectNodes("(/descendant-or-self::node() | /descendant-or-self::node()/attribute::* | /descendant-or-self::node()/namespace::*)[ self::ietf:e1 or (parent::ietf:e1 and not(self::text() or self::e2)) or count (id(\"E3\") | ancestor-or-self::node()) = count (ancestor-or-self::node())]");