You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/05/03 18:00:57 UTC
cvs commit: xml-xerces/c/scripts sanityTest.pl sanityTest_ExpectedResult.log
tng 01/05/03 09:00:55
Modified: c/samples/DOMCount DOMCount.cpp
c/samples/DOMPrint DOMPrint.cpp DOMTreeErrorReporter.cpp
c/samples/MemParse MemParse.cpp
c/samples/PParse PParse.cpp
c/samples/SAX2Count SAX2Count.cpp
c/samples/SAX2Print SAX2PrintHandlers.cpp
c/samples/SAXCount SAXCount.cpp
c/samples/SAXPrint SAXPrint.cpp SAXPrintHandlers.cpp
c/samples/StdInParse StdInParse.cpp
c/scripts sanityTest.pl sanityTest_ExpectedResult.log
Added: c/samples/data personal-schema.xml personal.xsd
Log:
Schema: samples update with schema
Revision Changes Path
1.11 +10 -2 xml-xerces/c/samples/DOMCount/DOMCount.cpp
Index: DOMCount.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/DOMCount/DOMCount.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- DOMCount.cpp 2000/10/20 22:00:34 1.10
+++ DOMCount.cpp 2001/05/03 15:59:20 1.11
@@ -55,7 +55,7 @@
*/
/*
- * $Id: DOMCount.cpp,v 1.10 2000/10/20 22:00:34 andyh Exp $
+ * $Id: DOMCount.cpp,v 1.11 2001/05/03 15:59:20 tng Exp $
*/
// ---------------------------------------------------------------------------
@@ -87,7 +87,8 @@
"found in the input XML file.\n\n"
"Options:\n"
" -v=xxx Validation scheme [always | never | auto*]\n"
- " -n Enable namespace processing. Defaults to off.\n\n"
+ " -n Enable namespace processing. Defaults to off.\n"
+ " -s Enable schema processing. Defaults to off.\n\n"
" * = Default if not provided explicitly\n\n"
<< endl;
}
@@ -118,6 +119,7 @@
const char* xmlFile = 0;
DOMParser::ValSchemes valScheme = DOMParser::Val_Auto;
bool doNamespaces = false;
+ bool doSchema = false;
// See if non validating dom parser configuration is requested.
if ((argC == 2) && !strcmp(argV[1], "-?"))
@@ -155,6 +157,11 @@
{
doNamespaces = true;
}
+ else if (!strcmp(argV[argInd], "-s")
+ || !strcmp(argV[argInd], "-S"))
+ {
+ doSchema = true;
+ }
else
{
cerr << "Unknown option '" << argV[argInd]
@@ -177,6 +184,7 @@
DOMParser parser;
parser.setValidationScheme(valScheme);
parser.setDoNamespaces(doNamespaces);
+ parser.setDoSchema(doSchema);
// And create our error handler and install it
DOMCountErrorHandler errorHandler;
1.28 +46 -35 xml-xerces/c/samples/DOMPrint/DOMPrint.cpp
Index: DOMPrint.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/DOMPrint/DOMPrint.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- DOMPrint.cpp 2000/10/17 19:23:08 1.27
+++ DOMPrint.cpp 2001/05/03 15:59:29 1.28
@@ -55,7 +55,7 @@
*/
/*
- * $Id: DOMPrint.cpp,v 1.27 2000/10/17 19:23:08 andyh Exp $
+ * $Id: DOMPrint.cpp,v 1.28 2001/05/03 15:59:29 tng Exp $
*/
@@ -126,11 +126,11 @@
static const XMLCh gXMLDecl4[] =
{
chDoubleQuote, chQuestion, chCloseAngle
- , chCR, chLF, chNull
+ , chLF, chNull
};
static const XMLCh gStartCDATA[] =
-{
+{
chOpenAngle, chBang, chOpenSquare, chLatin_C, chLatin_D,
chLatin_A, chLatin_T, chLatin_A, chOpenSquare, chNull
};
@@ -140,7 +140,7 @@
chCloseSquare, chCloseSquare, chCloseAngle, chNull
};
static const XMLCh gStartComment[] =
-{
+{
chOpenAngle, chBang, chDash, chDash, chNull
};
@@ -150,27 +150,27 @@
};
static const XMLCh gStartDoctype[] =
-{
+{
chOpenAngle, chBang, chLatin_D, chLatin_O, chLatin_C, chLatin_T,
chLatin_Y, chLatin_P, chLatin_E, chSpace, chNull
};
static const XMLCh gPublic[] =
-{
+{
chLatin_P, chLatin_U, chLatin_B, chLatin_L, chLatin_I,
chLatin_C, chSpace, chDoubleQuote, chNull
};
static const XMLCh gSystem[] =
-{
+{
chLatin_S, chLatin_Y, chLatin_S, chLatin_T, chLatin_E,
chLatin_M, chSpace, chDoubleQuote, chNull
};
static const XMLCh gStartEntity[] =
-{
+{
chOpenAngle, chBang, chLatin_E, chLatin_N, chLatin_T, chLatin_I,
chLatin_T, chLatin_Y, chSpace, chNull
};
static const XMLCh gNotation[] =
-{
+{
chLatin_N, chLatin_D, chLatin_A, chLatin_T, chLatin_A,
chSpace, chDoubleQuote, chNull
};
@@ -222,6 +222,9 @@
// gDoNamespaces
// Indicates whether namespace processing should be done.
//
+// gDoSchema
+// Indicates whether schema processing should be done.
+//
// gDoCreate
// Indicates whether entity reference nodes needs to be created or not
// Defaults to false
@@ -237,6 +240,7 @@
// ---------------------------------------------------------------------------
static char* gXmlFile = 0;
static bool gDoNamespaces = false;
+static bool gDoSchema = false;
static bool gDoCreate = false;
static XMLCh* gEncodingName = 0;
static XMLFormatter::UnRepFlags gUnRepFlags = XMLFormatter::UnRep_CharRef;
@@ -265,13 +269,14 @@
{
cout << "\nUsage: DOMPrint [options] file\n\n"
"This program invokes the Xerces-C DOM parser and builds the DOM\n"
- "tree. It then traverses the DOM tree and prints the contents \n"
+ "tree. It then traverses the DOM tree and prints the contents\n"
"of the tree. Options are NOT case sensitive.\n\n"
"Options:\n"
" -e create entity reference nodes. Default is no expansion.\n"
" -u=xxx Handle unrepresentable chars [fail | rep | ref*]\n"
" -v=xxx Validation scheme [always | never | auto*]\n"
" -n Enable namespace processing. Default is off.\n"
+ " -s Enable schema processing. Default is off.\n"
" -x=XXX Use a particular encoding for output. Default is\n"
" the same encoding as the input XML file. UTF-8 if\n"
" input XML file has not XML declaration.\n"
@@ -354,6 +359,11 @@
{
gDoNamespaces = true;
}
+ else if (!strcmp(argV[parmInd], "-s")
+ || !strcmp(argV[parmInd], "-S"))
+ {
+ gDoSchema = true;
+ }
else if (!strcmp(argV[parmInd], "-e")
|| !strcmp(argV[parmInd], "-E"))
{
@@ -413,6 +423,7 @@
DOMParser *parser = new DOMParser;
parser->setValidationScheme(gValScheme);
parser->setDoNamespaces(gDoNamespaces);
+ parser->setDoSchema(gDoSchema);
ErrorHandler *errReporter = new DOMTreeErrorReporter();
parser->setErrorHandler(errReporter);
parser->setCreateEntityReferenceNodes(gDoCreate);
@@ -434,8 +445,8 @@
<< DOMString(e.getMessage()) << endl;
errorsOccured = true;
}
+
-
catch (const DOM_DOMException& e)
{
cerr << "An error occured during parsing\n Message: "
@@ -477,7 +488,7 @@
try
{
- gFormatter = new XMLFormatter(gEncodingName, formatTarget,
+ gFormatter = new XMLFormatter(gEncodingName, formatTarget,
XMLFormatter::NoEscapes, gUnRepFlags);
cout << doc << endl;
}
@@ -521,7 +532,7 @@
// ---------------------------------------------------------------------------
-// ostream << DOM_Node
+// ostream << DOM_Node
//
// Stream out a DOM node, and, recursively, all of its children. This
// function is the heart of writing a DOM tree out as XML source. Give it
@@ -538,7 +549,7 @@
{
case DOM_Node::TEXT_NODE:
{
- gFormatter->formatBuf(nodeValue.rawBuffer(),
+ gFormatter->formatBuf(nodeValue.rawBuffer(),
lent, XMLFormatter::CharEscapes);
break;
}
@@ -631,8 +642,8 @@
}
break;
}
-
-
+
+
case DOM_Node::ENTITY_REFERENCE_NODE:
{
DOM_Node child;
@@ -645,7 +656,7 @@
}
#else
//
- // Instead of printing the refernece tree
+ // Instead of printing the refernece tree
// we'd output the actual text as it appeared in the xml file.
// This would be the case when -e option was chosen
//
@@ -654,16 +665,16 @@
#endif
break;
}
-
-
+
+
case DOM_Node::CDATA_SECTION_NODE:
{
*gFormatter << XMLFormatter::NoEscapes << gStartCDATA
<< nodeValue << gEndCDATA;
break;
}
+
-
case DOM_Node::COMMENT_NODE:
{
*gFormatter << XMLFormatter::NoEscapes << gStartComment
@@ -671,14 +682,14 @@
break;
}
-
+
case DOM_Node::DOCUMENT_TYPE_NODE:
{
DOM_DocumentType doctype = (DOM_DocumentType &)toWrite;;
*gFormatter << XMLFormatter::NoEscapes << gStartDoctype
<< nodeName;
-
+
DOMString id = doctype.getPublicId();
if (id != 0)
{
@@ -687,7 +698,7 @@
id = doctype.getSystemId();
if (id != 0)
{
- *gFormatter << XMLFormatter::NoEscapes << chSpace
+ *gFormatter << XMLFormatter::NoEscapes << chSpace
<< chDoubleQuote << id << chDoubleQuote;
}
}
@@ -700,8 +711,8 @@
<< id << chDoubleQuote;
}
}
-
- id = doctype.getInternalSubset();
+
+ id = doctype.getInternalSubset();
if (id !=0)
*gFormatter << XMLFormatter::NoEscapes << chOpenSquare
<< id << chCloseSquare;
@@ -709,8 +720,8 @@
*gFormatter << XMLFormatter::NoEscapes << chCloseAngle;
break;
}
-
-
+
+
case DOM_Node::ENTITY_NODE:
{
*gFormatter << XMLFormatter::NoEscapes << gStartEntity
@@ -725,18 +736,18 @@
if (id != 0)
*gFormatter << XMLFormatter::NoEscapes << gSystem
<< id << chDoubleQuote;
-
+
id = ((DOM_Entity &)toWrite).getNotationName();
if (id != 0)
*gFormatter << XMLFormatter::NoEscapes << gNotation
<< id << chDoubleQuote;
- *gFormatter << XMLFormatter::NoEscapes << chCloseAngle << chCR << chLF;
+ *gFormatter << XMLFormatter::NoEscapes << chCloseAngle << chLF;
break;
}
-
-
+
+
case DOM_Node::XML_DECL_NODE:
{
DOMString str;
@@ -744,17 +755,17 @@
*gFormatter << gXMLDecl1 << ((DOM_XMLDecl &)toWrite).getVersion();
*gFormatter << gXMLDecl2 << gEncodingName;
-
+
str = ((DOM_XMLDecl &)toWrite).getStandalone();
if (str != 0)
*gFormatter << gXMLDecl3 << str;
-
+
*gFormatter << gXMLDecl4;
break;
}
-
-
+
+
default:
cerr << "Unrecognized node type = "
<< (long)toWrite.getNodeType() << endl;
1.7 +3 -5 xml-xerces/c/samples/DOMPrint/DOMTreeErrorReporter.cpp
Index: DOMTreeErrorReporter.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/DOMPrint/DOMTreeErrorReporter.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DOMTreeErrorReporter.cpp 2000/08/24 22:36:22 1.6
+++ DOMTreeErrorReporter.cpp 2001/05/03 15:59:32 1.7
@@ -56,6 +56,9 @@
/*
* $Log: DOMTreeErrorReporter.cpp,v $
+ * Revision 1.7 2001/05/03 15:59:32 tng
+ * Schema: samples update with schema
+ *
* Revision 1.6 2000/08/24 22:36:22 andyh
* Fix DOMPrint crash when input xml file is not found.
*
@@ -111,10 +114,6 @@
<< "\", line " << toCatch.getLineNumber()
<< ", column " << toCatch.getColumnNumber()
<< "\n Message: " << DOMString(toCatch.getMessage()) << endl;
- throw SAXParseException(toCatch); // Copy the 'toCatch' object before throwing -
- // otherwise we would be throwing a reference to
- // a local object that gets destroyed before
- // the catch.
}
void DOMTreeErrorReporter::fatalError(const SAXParseException& toCatch)
@@ -123,7 +122,6 @@
<< "\", line " << toCatch.getLineNumber()
<< ", column " << toCatch.getColumnNumber()
<< "\n Message: " << DOMString(toCatch.getMessage()) << endl;
- throw SAXParseException(toCatch);
}
void DOMTreeErrorReporter::resetErrors()
1.8 +33 -11 xml-xerces/c/samples/MemParse/MemParse.cpp
Index: MemParse.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/MemParse/MemParse.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- MemParse.cpp 2000/09/11 18:43:48 1.7
+++ MemParse.cpp 2001/05/03 15:59:40 1.8
@@ -57,6 +57,9 @@
/*
* $Log: MemParse.cpp,v $
+ * Revision 1.8 2001/05/03 15:59:40 tng
+ * Schema: samples update with schema
+ *
* Revision 1.7 2000/09/11 18:43:48 aruna1
* OS390 related updates
*
@@ -177,7 +180,10 @@
<< "containing XML statements, and reports the number of\n"
<< "elements and attributes found.\n"
<< "\nOptions:\n"
- << " -v Do a validating parse. Default is non-validating.\n\n"
+ << " -v=xxx Validation scheme [always | never | auto*]\n"
+ << " -n Enable namespace processing. Defaults to off.\n"
+ << " -s Enable schema processing. Defaults to off.\n\n"
+ << " * = Default if not provided explicitly\n"
<< endl;
}
@@ -199,8 +205,9 @@
return 1;
}
- bool doValidation = false;
+ SAXParser::ValSchemes valScheme = SAXParser::Val_Auto;
bool doNamespaces = false;
+ bool doSchema = false;
if (argC > 1)
{
// See if non validating dom parser configuration is requested.
@@ -213,16 +220,33 @@
int argInd;
for (argInd = 1; argInd < argC; argInd++)
{
- if (!strcmp(argV[argInd], "-v")
- || !strcmp(argV[argInd], "-V"))
+ if (!strncmp(argV[argInd], "-v=", 3)
+ || !strncmp(argV[argInd], "-V=", 3))
{
- doValidation = true;
+ const char* const parm = &argV[argInd][3];
+
+ if (!strcmp(parm, "never"))
+ valScheme = SAXParser::Val_Never;
+ else if (!strcmp(parm, "auto"))
+ valScheme = SAXParser::Val_Auto;
+ else if (!strcmp(parm, "always"))
+ valScheme = SAXParser::Val_Always;
+ else
+ {
+ cerr << "Unknown -v= value: " << parm << endl;
+ return 2;
+ }
}
else if (!strcmp(argV[argInd], "-n")
|| !strcmp(argV[argInd], "-N"))
{
doNamespaces = true;
}
+ else if (!strcmp(argV[argInd], "-s")
+ || !strcmp(argV[argInd], "-S"))
+ {
+ doSchema = true;
+ }
else
{
cerr << "Unknown option '" << argV[argInd]
@@ -236,8 +260,9 @@
// the command line, set it to validate or not.
//
SAXParser parser;
- parser.setDoValidation(doValidation);
+ parser.setValidationScheme(valScheme);
parser.setDoNamespaces(doNamespaces);
+ parser.setDoSchema(doSchema);
//
// Create our SAX handler object and install it on the parser, as the
@@ -296,11 +321,8 @@
<< handler.getSpaceCount() << " spaces, "
<< handler.getCharacterCount() << " characters).\n" << endl;
- if (doValidation == false)
- {
- cout << "You can also invoke it with '-v' parameter to turn "
- << "on validation.\n";
- }
+ // And call the termination method
+ XMLPlatformUtils::Terminate();
return 0;
}
1.8 +54 -25 xml-xerces/c/samples/PParse/PParse.cpp
Index: PParse.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/PParse/PParse.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PParse.cpp 2000/06/20 02:23:08 1.7
+++ PParse.cpp 2001/05/03 15:59:48 1.8
@@ -1,37 +1,37 @@
/*
* The Apache Software License, Version 1.1
- *
+ *
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
+ * notice, this list of conditions and the following disclaimer.
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache\@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -45,7 +45,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
- *
+ *
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
@@ -56,6 +56,9 @@
/*
* $Log: PParse.cpp,v $
+ * Revision 1.8 2001/05/03 15:59:48 tng
+ * Schema: samples update with schema
+ *
* Revision 1.7 2000/06/20 02:23:08 rahulj
* Help message added by Joe Polastre.
*
@@ -99,10 +102,12 @@
// The parameters are:
//
// [-?] - Show usage and exit
-// [-v] - Do validation
+// [-v=xxx] - Validation scheme [always | never | auto*]
// [-n] - Enable namespace processing
+// [-s] - Enable schema processing
// filename - The path to the XML file to parse
//
+// * = Default if not provided explicitly
// These are non-case sensitive
// ---------------------------------------------------------------------------
@@ -125,13 +130,17 @@
// doNamespaces
// Indicates whether namespace processing should be done.
//
-// doValidation
-// Indicates whether validation should be done. The default is not
-// to validate, but -v overrides that.
+// doSchema
+// Indicates whether schema processing should be done.
+//
+// valScheme
+// Indicates what validation scheme to use. It defaults to 'auto', but
+// can be set via the -v= command.
// ---------------------------------------------------------------------------
-static char* xmlFile = 0;
+static char* xmlFile = 0;
static bool doNamespaces = false;
-static bool doValidation = false;
+static bool doSchema = false;
+static SAXParser::ValSchemes valScheme = SAXParser::Val_Auto;
@@ -148,9 +157,11 @@
<< "16 new elements then sets a flag to indicate its found what it wants.\n"
<< "At that point, our progressive parse loop exits.\n\n"
<< "Options:\n"
- << " -v - Do validation [default is off]\n"
+ << " -v=xxx - Validation scheme [always | never | auto*]\n"
<< " -n - Enable namespace processing [default is off]\n"
- << " -? - Show this help (must be the only parameter)\n"
+ << " -s - Enable schema processing [default is off]\n"
+ << " -? - Show this help (must be the only parameter)\n\n"
+ << " * = Default if not provided explicitly\n"
<< endl;
}
@@ -172,7 +183,7 @@
cerr << "Error during initialization! :\n"
<< StrX(toCatch.getMessage()) << endl;
return 1;
- }
+ }
// Check command line and extract arguments.
@@ -197,16 +208,33 @@
if (argV[parmInd][0] != '-')
break;
- if (!strcmp(argV[parmInd], "-v")
- || !strcmp(argV[parmInd], "-V"))
+ if (!strncmp(argV[parmInd], "-v=", 3)
+ || !strncmp(argV[parmInd], "-V=", 3))
{
- doValidation = true;
+ const char* const parm = &argV[parmInd][3];
+
+ if (!strcmp(parm, "never"))
+ valScheme = SAXParser::Val_Never;
+ else if (!strcmp(parm, "auto"))
+ valScheme = SAXParser::Val_Auto;
+ else if (!strcmp(parm, "always"))
+ valScheme = SAXParser::Val_Always;
+ else
+ {
+ cerr << "Unknown -v= value: " << parm << endl;
+ return 2;
+ }
}
else if (!strcmp(argV[parmInd], "-n")
|| !strcmp(argV[parmInd], "-N"))
{
doNamespaces = true;
}
+ else if (!strcmp(argV[parmInd], "-s")
+ || !strcmp(argV[parmInd], "-S"))
+ {
+ doSchema = true;
+ }
else
{
usage();
@@ -234,8 +262,9 @@
PParseHandlers handler;
parser.setDocumentHandler(&handler);
parser.setErrorHandler(&handler);
- parser.setDoValidation(doValidation);
+ parser.setValidationScheme(valScheme);
parser.setDoNamespaces(doNamespaces);
+ parser.setDoSchema(doSchema);
//
// Ok, lets do the progressive parse loop. On each time around the
1.4 +26 -15 xml-xerces/c/samples/SAX2Count/SAX2Count.cpp
Index: SAX2Count.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/SAX2Count/SAX2Count.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SAX2Count.cpp 2000/08/09 22:46:06 1.3
+++ SAX2Count.cpp 2001/05/03 15:59:55 1.4
@@ -56,6 +56,9 @@
/*
* $Log: SAX2Count.cpp,v $
+* Revision 1.4 2001/05/03 15:59:55 tng
+* Schema: samples update with schema
+*
* Revision 1.3 2000/08/09 22:46:06 jpolast
* replace occurences of SAXCount with SAX2Count
*
@@ -86,7 +89,8 @@
" SAX2Count [options] <XML file>\n\n"
"Options:\n"
" -v=xxx Validation scheme [always | never | auto*]\n"
- " -n Disable namespace processing. Defaults to on.\n\n"
+ " -n Disable namespace processing. Defaults to on.\n"
+ " -s Disable schema processing. Defaults to on.\n\n"
"This program prints the number of elements, attributes,\n"
"white spaces and other non-white space characters in the "
"input file.\n\n"
@@ -105,14 +109,14 @@
{
XMLPlatformUtils::Initialize();
}
-
+
catch (const XMLException& toCatch)
{
cerr << "Error during initialization! Message:\n"
<< StrX(toCatch.getMessage()) << endl;
return 1;
}
-
+
// Check command line and extract arguments.
if (argC < 2)
{
@@ -120,11 +124,12 @@
XMLPlatformUtils::Terminate();
return 1;
}
-
+
const char* xmlFile = 0;
SAX2XMLReader::ValSchemes valScheme = SAX2XMLReader::Val_Auto;
bool doNamespaces = true;
-
+ bool doSchema = true;
+
// See if non validating dom parser configuration is requested.
if ((argC == 2) && !strcmp(argV[1], "-?"))
{
@@ -132,14 +137,14 @@
XMLPlatformUtils::Terminate();
return 2;
}
-
+
int argInd;
for (argInd = 1; argInd < argC; argInd++)
{
// Break out on first non-dash parameter
if (argV[argInd][0] != '-')
break;
-
+
if (!strncmp(argV[argInd], "-v=", 3)
|| !strncmp(argV[argInd], "-V=", 3))
{
@@ -162,13 +167,18 @@
{
doNamespaces = false;
}
+ else if (!strcmp(argV[argInd], "-s")
+ || !strcmp(argV[argInd], "-S"))
+ {
+ doSchema = false;
+ }
else
{
cerr << "Unknown option '" << argV[argInd]
<< "', ignoring it\n" << endl;
}
}
-
+
//
// There should be only one and only one parameter left, and that
// should be the file name.
@@ -180,13 +190,14 @@
return 1;
}
xmlFile = argV[argInd];
-
+
//
// Create a SAX parser object. Then, according to what we were told on
// the command line, set it to validate or not.
//
SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
parser->setFeature(XMLString::transcode("http://xml.org/sax/features/namespaces"), doNamespaces);
+ parser->setFeature(XMLString::transcode("http://apache.org/xml/features/validation/schema"), doSchema);
if (valScheme == SAX2XMLReader::Val_Auto)
{
parser->setFeature(XMLString::transcode("http://xml.org/sax/features/validation"), true);
@@ -201,7 +212,7 @@
parser->setFeature(XMLString::transcode("http://xml.org/sax/features/validation"), true);
parser->setFeature(XMLString::transcode("http://apache.org/xml/features/validation/dynamic"), false);
}
-
+
//
// Create our SAX handler object and install it on the parser, as the
// document and error handler.
@@ -209,7 +220,7 @@
SAX2CountHandlers handler;
parser->setContentHandler(&handler);
parser->setErrorHandler(&handler);
-
+
//
// Get the starting time and kick off the parse of the indicated
// file. Catch any exceptions that might propogate out of it.
@@ -222,7 +233,7 @@
const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis();
duration = endMillis - startMillis;
}
-
+
catch (const XMLException& e)
{
cerr << "\nError during parsing: '" << xmlFile << "'\n"
@@ -238,8 +249,8 @@
XMLPlatformUtils::Terminate();
return 4;
}
+
-
// Print out the stats that we collected and time taken
if (!handler.getSawErrors())
{
@@ -249,10 +260,10 @@
<< handler.getSpaceCount() << " spaces, "
<< handler.getCharacterCount() << " chars)" << endl;
}
-
+
// And call the termination method
XMLPlatformUtils::Terminate();
-
+
return 0;
}
1.4 +7 -3 xml-xerces/c/samples/SAX2Print/SAX2PrintHandlers.cpp
Index: SAX2PrintHandlers.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/SAX2Print/SAX2PrintHandlers.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SAX2PrintHandlers.cpp 2000/10/10 23:55:53 1.3
+++ SAX2PrintHandlers.cpp 2001/05/03 16:00:03 1.4
@@ -56,6 +56,9 @@
/*
* $Log: SAX2PrintHandlers.cpp,v $
+ * Revision 1.4 2001/05/03 16:00:03 tng
+ * Schema: samples update with schema
+ *
* Revision 1.3 2000/10/10 23:55:53 andyh
* XMLFormatter patch, contributed by Bill Schindler. Fix problems with
* output to multi-byte encodings.
@@ -102,7 +105,7 @@
static const XMLCh gXMLDecl2[] =
{
chDoubleQuote, chQuestion, chCloseAngle
- , chCR, chLF, chNull
+ , chLF, chNull
};
@@ -222,8 +225,8 @@
}
-void SAX2PrintHandlers::endElement(const XMLCh* const uri,
- const XMLCh* const localname,
+void SAX2PrintHandlers::endElement(const XMLCh* const uri,
+ const XMLCh* const localname,
const XMLCh* const qname)
{
// No escapes are legal here
1.10 +30 -19 xml-xerces/c/samples/SAXCount/SAXCount.cpp
Index: SAXCount.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/SAXCount/SAXCount.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SAXCount.cpp 2000/10/19 23:52:41 1.9
+++ SAXCount.cpp 2001/05/03 16:00:12 1.10
@@ -56,6 +56,9 @@
/*
* $Log: SAXCount.cpp,v $
+* Revision 1.10 2001/05/03 16:00:12 tng
+* Schema: samples update with schema
+*
* Revision 1.9 2000/10/19 23:52:41 andyh
* SAXCount: Allow multiple files on command line
*
@@ -113,7 +116,8 @@
" SAXCount [options] <XML file>\n\n"
"Options:\n"
" -v=xxx Validation scheme [always | never | auto*]\n"
- " -n Enable namespace processing. Defaults to off.\n\n"
+ " -n Enable namespace processing. Defaults to off.\n"
+ " -s Enable schema processing. Defaults to off.\n\n"
"This program prints the number of elements, attributes,\n"
"white spaces and other non-white space characters in the "
"input file.\n\n"
@@ -132,14 +136,14 @@
{
XMLPlatformUtils::Initialize();
}
-
+
catch (const XMLException& toCatch)
{
cerr << "Error during initialization! Message:\n"
<< StrX(toCatch.getMessage()) << endl;
return 1;
}
-
+
// Check command line and extract arguments.
if (argC < 2)
{
@@ -147,11 +151,12 @@
XMLPlatformUtils::Terminate();
return 1;
}
-
+
const char* xmlFile = 0;
SAXParser::ValSchemes valScheme = SAXParser::Val_Auto;
bool doNamespaces = false;
-
+ bool doSchema = false;
+
int argInd;
for (argInd = 1; argInd < argC; argInd++)
@@ -159,7 +164,7 @@
// Break out on first non-dash parameter
if (argV[argInd][0] != '-')
break;
-
+
if (!strncmp(argV[argInd], "-v=", 3)
|| !strncmp(argV[argInd], "-V=", 3))
{
@@ -182,13 +187,18 @@
{
doNamespaces = true;
}
+ else if (!strcmp(argV[argInd], "-s")
+ || !strcmp(argV[argInd], "-S"))
+ {
+ doSchema = true;
+ }
else
{
cerr << "Unknown option '" << argV[argInd]
<< "', ignoring it\n" << endl;
}
}
-
+
//
// There should at least one parameter left, and that
// should be the file name(s).
@@ -200,20 +210,21 @@
return 1;
}
-
+
for (; argInd < argC; argInd++)
{
xmlFile = argV[argInd];
-
+
//
// Create a SAX parser object. Then, according to what we were told on
// the command line, set it to validate or not.
//
SAXParser parser;
-
+
parser.setValidationScheme(valScheme);
parser.setDoNamespaces(doNamespaces);
-
+ parser.setDoSchema(doSchema);
+
//
// Create our SAX handler object and install it on the parser, as the
// document and error handler.
@@ -221,8 +232,8 @@
SAXCountHandlers handler;
parser.setDocumentHandler(&handler);
parser.setErrorHandler(&handler);
-
-
+
+
//
// Get the starting time and kick off the parse of the indicated
// file. Catch any exceptions that might propogate out of it.
@@ -235,7 +246,7 @@
const unsigned long endMillis = XMLPlatformUtils::getCurrentMillis();
duration = endMillis - startMillis;
}
-
+
catch (const XMLException& e)
{
cerr << "\nError during parsing: '" << xmlFile << "'\n"
@@ -244,15 +255,15 @@
XMLPlatformUtils::Terminate();
return 4;
}
-
+
catch (...)
{
cerr << "\nUnexpected exception during parsing: '" << xmlFile << "'\n";
XMLPlatformUtils::Terminate();
return 4;
}
-
-
+
+
// Print out the stats that we collected and time taken
if (!handler.getSawErrors())
{
@@ -263,10 +274,10 @@
<< handler.getCharacterCount() << " chars)" << endl;
}
}
-
+
// And call the termination method
XMLPlatformUtils::Terminate();
-
+
return 0;
}
1.13 +16 -0 xml-xerces/c/samples/SAXPrint/SAXPrint.cpp
Index: SAXPrint.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/SAXPrint/SAXPrint.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SAXPrint.cpp 2000/06/16 20:25:43 1.12
+++ SAXPrint.cpp 2001/05/03 16:00:21 1.13
@@ -56,6 +56,9 @@
/*
* $Log: SAXPrint.cpp,v $
+ * Revision 1.13 2001/05/03 16:00:21 tng
+ * Schema: samples update with schema
+ *
* Revision 1.12 2000/06/16 20:25:43 rahulj
* Add the -v=always option to force validation checking. Need this
* option for running the conformance tests.
@@ -123,6 +126,10 @@
// Indicates whether namespace processing should be enabled or not.
// Defaults to disabled.
//
+// doSchema
+// Indicates whether schema processing should be enabled or not.
+// Defaults to disabled.
+//
// encodingName
// The encoding we are to output in. If not set on the command line,
// then it is defaulted to LATIN1.
@@ -135,6 +142,7 @@
// can be set via the -v= command.
// ---------------------------------------------------------------------------
static bool doNamespaces = false;
+static bool doSchema = false;
static const char* encodingName = "LATIN1";
static XMLFormatter::UnRepFlags unRepFlags = XMLFormatter::UnRep_CharRef;
static char* xmlFile = 0;
@@ -155,6 +163,7 @@
" -u=xxx Handle unrepresentable chars [fail | rep | ref*]\n"
" -v=xxx Validation scheme [always | never | auto*]\n"
" -n Enable namespace processing.\n"
+ " -s Enable schema processing.\n"
" -x=XXX Use a particular encoding for output (LATIN1*).\n"
" -? Show this help\n\n"
" * = Default if not provided explicitly\n\n"
@@ -229,6 +238,11 @@
{
doNamespaces = true;
}
+ else if (!strcmp(argV[parmInd], "-s")
+ || !strcmp(argV[parmInd], "-S"))
+ {
+ doSchema = true;
+ }
else if (!strncmp(argV[parmInd], "-x=", 3)
|| !strncmp(argV[parmInd], "-X=", 3))
{
@@ -277,6 +291,7 @@
SAXParser parser;
parser.setValidationScheme(valScheme);
parser.setDoNamespaces(doNamespaces);
+ parser.setDoSchema(doSchema);
//
// Create the handler object and install it as the document and error
1.13 +5 -1 xml-xerces/c/samples/SAXPrint/SAXPrintHandlers.cpp
Index: SAXPrintHandlers.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/SAXPrint/SAXPrintHandlers.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SAXPrintHandlers.cpp 2000/10/10 23:55:58 1.12
+++ SAXPrintHandlers.cpp 2001/05/03 16:00:25 1.13
@@ -56,6 +56,9 @@
/*
* $Log: SAXPrintHandlers.cpp,v $
+ * Revision 1.13 2001/05/03 16:00:25 tng
+ * Schema: samples update with schema
+ *
* Revision 1.12 2000/10/10 23:55:58 andyh
* XMLFormatter patch, contributed by Bill Schindler. Fix problems with
* output to multi-byte encodings.
@@ -136,7 +139,7 @@
static const XMLCh gXMLDecl2[] =
{
chDoubleQuote, chQuestion, chCloseAngle
- , chCR, chLF, chNull
+ , chLF, chNull
};
1.8 +57 -29 xml-xerces/c/samples/StdInParse/StdInParse.cpp
Index: StdInParse.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/samples/StdInParse/StdInParse.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- StdInParse.cpp 2001/02/22 20:59:57 1.7
+++ StdInParse.cpp 2001/05/03 16:00:32 1.8
@@ -1,37 +1,37 @@
/*
* The Apache Software License, Version 1.1
- *
+ *
* Copyright (c) 1999-2000 The Apache Software Foundation. All rights
* reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
+ * notice, this list of conditions and the following disclaimer.
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
- *
+ *
* 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
- *
+ *
* 4. The names "Xerces" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
- * software without prior written permission. For written
+ * software without prior written permission. For written
* permission, please contact apache\@apache.org.
- *
+ *
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
- *
+ *
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -45,7 +45,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
- *
+ *
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation, and was
* originally based on software copyright (c) 1999, International
@@ -56,6 +56,9 @@
/*
* $Log: StdInParse.cpp,v $
+ * Revision 1.8 2001/05/03 16:00:32 tng
+ * Schema: samples update with schema
+ *
* Revision 1.7 2001/02/22 20:59:57 tng
* [Bug 678] StdInParse doesn't output filename or duration
*
@@ -98,14 +101,19 @@
//
// doNamespaces
// Indicates whether namespace processing should be enabled or not.
-// The default is no, but -ns overrides that.
+// The default is no, but -n overrides that.
//
-// doValidation
-// Indicates whether validation should be done. The default is not
-// to validate, but -v overrides that.
+// doSchema
+// Indicates whether schema processing should be enabled or not.
+// The default is no, but -s overrides that.
+//
+// valScheme
+// Indicates what validation scheme to use. It defaults to 'auto', but
+// can be set via the -v= command.
// ---------------------------------------------------------------------------
static bool doNamespaces = false;
-static bool doValidation = false;
+static bool doSchema = false;
+static SAXParser::ValSchemes valScheme = SAXParser::Val_Auto;
@@ -116,9 +124,11 @@
{
cout << "\nUsage:\n"
<< " StdInParse [options]\n"
- << " -v Do a validating parse. [default is off]\n"
- << " -n Enable namespace processing. [default is off]\n"
- << " -? Show this help\n\n"
+ << " -v=xxx Validation scheme [always | never | auto] \n"
+ << " -n Enable namespace processing. [default is off]\n"
+ << " -s Enable schema processing. [default is off]\n"
+ << " -? Show this help\n\n"
+ << " * = Default if not provided explicitly\n\n"
<< "This program allows you to redirect a file into the program\n"
<< "to be parsed. It will count the elements, characters, and \n"
<< "spaces and display these stats at the end\n"
@@ -147,21 +157,38 @@
int parmInd;
for (parmInd = 1; parmInd < argC; parmInd++)
{
- if (!strcmp(argV[parmInd], "-?"))
- {
- usage();
- return 1;
- }
- if (!strcmp(argV[parmInd], "-v")
- || !strcmp(argV[parmInd], "-V"))
+ if (!strcmp(argV[parmInd], "-?"))
+ {
+ usage();
+ return 1;
+ }
+ if (!strncmp(argV[parmInd], "-v=", 3)
+ || !strncmp(argV[parmInd], "-V=", 3))
{
- doValidation = true;
+ const char* const parm = &argV[parmInd][3];
+
+ if (!strcmp(parm, "never"))
+ valScheme = SAXParser::Val_Never;
+ else if (!strcmp(parm, "auto"))
+ valScheme = SAXParser::Val_Auto;
+ else if (!strcmp(parm, "always"))
+ valScheme = SAXParser::Val_Always;
+ else
+ {
+ cerr << "Unknown -v= value: " << parm << endl;
+ return 2;
+ }
}
else if (!strcmp(argV[parmInd], "-n")
|| !strcmp(argV[parmInd], "-N"))
{
doNamespaces = true;
}
+ else if (!strcmp(argV[parmInd], "-s")
+ || !strcmp(argV[parmInd], "-S"))
+ {
+ doSchema = true;
+ }
else
{
cerr << "Unknown option '" << argV[parmInd]
@@ -174,8 +201,9 @@
// the command line, set the options.
//
SAXParser parser;
- parser.setDoValidation(doValidation);
+ parser.setValidationScheme(valScheme);
parser.setDoNamespaces(doNamespaces);
+ parser.setDoSchema(doSchema);
//
1.1 xml-xerces/c/samples/data/personal-schema.xml
Index: personal-schema.xml
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<personnel xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
xsi:noNamespaceSchemaLocation='personal.xsd'>
<person id="Big.Boss" >
<name><family>Boss</family> <given>Big</given></name>
<email>chief@foo.com</email>
<link subordinates="one.worker two.worker three.worker four.worker five.worker"/>
</person>
<person id="one.worker">
<name><family>Worker</family> <given>One</given></name>
<email>one@foo.com</email>
<link manager="Big.Boss"/>
</person>
<person id="two.worker">
<name><family>Worker</family> <given>Two</given></name>
<email>two@foo.com</email>
<link manager="Big.Boss"/>
</person>
<person id="three.worker">
<name><family>Worker</family> <given>Three</given></name>
<email>three@foo.com</email>
<link manager="Big.Boss"/>
</person>
<person id="four.worker">
<name><family>Worker</family> <given>Four</given></name>
<email>four@foo.com</email>
<link manager="Big.Boss"/>
</person>
<person id="five.worker">
<name><family>Worker</family> <given>Five</given></name>
<email>five@foo.com</email>
<link manager="Big.Boss"/>
</person>
</personnel>
1.1 xml-xerces/c/samples/data/personal.xsd
Index: personal.xsd
===================================================================
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns='http://www.w3.org/2000/10/XMLSchema'>
<element name="personnel">
<complexType>
<sequence>
<element ref="person" minOccurs='1' maxOccurs='unbounded'/>
</sequence>
</complexType>
</element>
<element name="person">
<complexType>
<sequence>
<element ref="name"/>
<element ref="email" minOccurs='0' maxOccurs='unbounded'/>
<element ref="url" minOccurs='0' maxOccurs='unbounded'/>
<element ref="link" minOccurs='0' maxOccurs='1'/>
</sequence>
<attribute name="id" type="ID" use='required'/>
<attribute name="note" type="string"/>
<attribute name="contr" use='default' value="false">
<simpleType>
<restriction base = "string">
<enumeration value="true"/>
<enumeration value="false"/>
</restriction>
</simpleType>
</attribute>
</complexType>
</element>
<element name="name">
<complexType>
<sequence>
<element ref="family"/>
<element ref="given"/>
</sequence>
</complexType>
</element>
<element name="family" type='string'/>
<element name="given" type='string'/>
<element name="email" type='string'/>
<element name="url">
<complexType>
<attribute name="href" type="string" default="http://"/>
</complexType>
</element>
<element name="link">
<complexType>
<attribute name="manager" type="IDREF"/>
<attribute name="subordinates" type="IDREFS"/>
</complexType>
</element>
<notation name='gif' public='-//APP/Photoshop/4.0' system='photoshop.exe'/>
</schema>
1.2 +13 -3 xml-xerces/c/scripts/sanityTest.pl
Index: sanityTest.pl
===================================================================
RCS file: /home/cvs/xml-xerces/c/scripts/sanityTest.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sanityTest.pl 2000/06/12 22:35:01 1.1
+++ sanityTest.pl 2001/05/03 16:00:47 1.2
@@ -56,7 +56,7 @@
#
#
-# $Id: sanityTest.pl,v 1.1 2000/06/12 22:35:01 rahulj Exp $
+# $Id: sanityTest.pl,v 1.2 2001/05/03 16:00:47 tng Exp $
#
@@ -91,9 +91,19 @@
system ("SAXPrint -v=never personal.xml");
system ("SAXPrint personal.xml");
+# Run SAX2Count
+system ("SAX2Count");
+system ("SAX2Count -v=never personal.xml");
+system ("SAX2Count personal.xml");
+
+# Run SAX2Print
+system ("SAX2Print");
+system ("SAX2Print -v=never personal.xml");
+system ("SAX2Print personal.xml");
+
# Run MemParse
system ("MemParse");
-system ("MemParse -v");
+system ("MemParse -v=never");
# Run Redirect
system ("Redirect");
@@ -111,7 +121,7 @@
# Run StdInParse
system ("StdInParse < personal.xml");
-system ("StdInParse -v < personal.xml");
+system ("StdInParse -v=never < personal.xml");
# Run PParse
system ("PParse");
1.2 +129 -10 xml-xerces/c/scripts/sanityTest_ExpectedResult.log
Index: sanityTest_ExpectedResult.log
===================================================================
RCS file: /home/cvs/xml-xerces/c/scripts/sanityTest_ExpectedResult.log,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sanityTest_ExpectedResult.log 2001/04/27 13:36:28 1.1
+++ sanityTest_ExpectedResult.log 2001/05/03 16:00:51 1.2
@@ -5,6 +5,7 @@
Options:
-v=xxx Validation scheme [always | never | auto*]
-n Enable namespace processing. Defaults to off.
+ -s Enable schema processing. Defaults to off.
This program prints the number of elements, attributes,
white spaces and other non-white space characters in the input file.
@@ -23,6 +24,7 @@
-u=xxx Handle unrepresentable chars [fail | rep | ref*]
-v=xxx Validation scheme [always | never | auto*]
-n Enable namespace processing.
+ -s Enable schema processing.
-x=XXX Use a particular encoding for output (LATIN1*).
-? Show this help
@@ -32,7 +34,7 @@
UTF-8, USASCII, ISO8859-1, UTF-16[BL]E, UCS-4[BL]E,
WINDOWS-1252, IBM1140, IBM037
-<?xml version="1.0" encoding="LATIN1"?>
+<?xml version="1.0" encoding="LATIN1"?>
<personnel>
<person id="Big.Boss">
@@ -71,7 +73,7 @@
<link manager="Big.Boss"></link>
</person>
-</personnel><?xml version="1.0" encoding="LATIN1"?>
+</personnel><?xml version="1.0" encoding="LATIN1"?>
<personnel>
<person id="Big.Boss">
@@ -111,6 +113,119 @@
</person>
</personnel>
+Usage:
+ SAX2Count [options] <XML file>
+
+Options:
+ -v=xxx Validation scheme [always | never | auto*]
+ -n Disable namespace processing. Defaults to on.
+ -s Disable schema processing. Defaults to on.
+
+This program prints the number of elements, attributes,
+white spaces and other non-white space characters in the input file.
+
+ * = Default if not provided explicitly
+
+personal.xml:{timing removed}(37 elems, 12 attrs, 0 spaces, 268 chars)
+personal.xml:{timing removed}(37 elems, 12 attrs, 134 spaces, 134 chars)
+
+Usage: SAX2Print [options] file
+This program prints the data returned by the various SAX2
+handlers for the specified input file. Options are NOT case
+sensitive.
+
+Options:
+ -u=xxx Handle unrepresentable chars [fail | rep | ref*]
+ -v=xxx Validation scheme [always | never | auto*]
+ -e Expand Namespace Alias with URI's.
+ -x=XXX Use a particular encoding for output (LATIN1*).
+ -? Show this help
+
+ * = Default if not provided explicitly
+
+The parser has intrinsic support for the following encodings:
+ UTF-8, USASCII, ISO8859-1, UTF-16[BL]E, UCS-4[BL]E,
+ WINDOWS-1252, IBM1140, IBM037
+
+<?xml version="1.0" encoding="LATIN1"?>
+<personnel>
+
+ <person id="Big.Boss">
+ <name><family>Boss</family> <given>Big</given></name>
+ <email>chief@foo.com</email>
+ <link subordinates="one.worker two.worker three.worker four.worker five.worker"></link>
+ </person>
+
+ <person id="one.worker">
+ <name><family>Worker</family> <given>One</given></name>
+ <email>one@foo.com</email>
+ <link manager="Big.Boss"></link>
+ </person>
+
+ <person id="two.worker">
+ <name><family>Worker</family> <given>Two</given></name>
+ <email>two@foo.com</email>
+ <link manager="Big.Boss"></link>
+ </person>
+
+ <person id="three.worker">
+ <name><family>Worker</family> <given>Three</given></name>
+ <email>three@foo.com</email>
+ <link manager="Big.Boss"></link>
+ </person>
+
+ <person id="four.worker">
+ <name><family>Worker</family> <given>Four</given></name>
+ <email>four@foo.com</email>
+ <link manager="Big.Boss"></link>
+ </person>
+
+ <person id="five.worker">
+ <name><family>Worker</family> <given>Five</given></name>
+ <email>five@foo.com</email>
+ <link manager="Big.Boss"></link>
+ </person>
+
+</personnel><?xml version="1.0" encoding="LATIN1"?>
+<personnel>
+
+ <person id="Big.Boss">
+ <name><family>Boss</family> <given>Big</given></name>
+ <email>chief@foo.com</email>
+ <link subordinates="one.worker two.worker three.worker four.worker five.worker"></link>
+ </person>
+
+ <person id="one.worker">
+ <name><family>Worker</family> <given>One</given></name>
+ <email>one@foo.com</email>
+ <link manager="Big.Boss"></link>
+ </person>
+
+ <person id="two.worker">
+ <name><family>Worker</family> <given>Two</given></name>
+ <email>two@foo.com</email>
+ <link manager="Big.Boss"></link>
+ </person>
+
+ <person id="three.worker">
+ <name><family>Worker</family> <given>Three</given></name>
+ <email>three@foo.com</email>
+ <link manager="Big.Boss"></link>
+ </person>
+
+ <person id="four.worker">
+ <name><family>Worker</family> <given>Four</given></name>
+ <email>four@foo.com</email>
+ <link manager="Big.Boss"></link>
+ </person>
+
+ <person id="five.worker">
+ <name><family>Worker</family> <given>Five</given></name>
+ <email>five@foo.com</email>
+ <link manager="Big.Boss"></link>
+ </person>
+
+</personnel>
Finished parsing the memory buffer containing the following XML statements:
<?xml version='1.0' encoding='ascii'?>
@@ -131,9 +246,8 @@
</company>
-Parsing took{timing removed}(4 elements, 1 attributes, 0 spaces, 111 characters).
+Parsing took{timing removed}(4 elements, 1 attributes, 16 spaces, 95 characters).
-You can also invoke it with '-v' parameter to turn on validation.
Finished parsing the memory buffer containing the following XML statements:
@@ -155,7 +269,7 @@
</company>
-Parsing took{timing removed}(4 elements, 1 attributes, 16 spaces, 95 characters).
+Parsing took{timing removed}(4 elements, 1 attributes, 0 spaces, 111 characters).
Usage:
@@ -180,6 +294,7 @@
Options:
-v=xxx Validation scheme [always | never | auto*]
-n Enable namespace processing. Defaults to off.
+ -s Enable schema processing. Defaults to off.
* = Default if not provided explicitly
@@ -190,7 +305,7 @@
Usage: DOMPrint [options] file
This program invokes the Xerces-C DOM parser and builds the DOM
-tree. It then traverses the DOM tree and prints the contents
+tree. It then traverses the DOM tree and prints the contents
of the tree. Options are NOT case sensitive.
Options:
@@ -198,6 +313,7 @@
-u=xxx Handle unrepresentable chars [fail | rep | ref*]
-v=xxx Validation scheme [always | never | auto*]
-n Enable namespace processing. Default is off.
+ -s Enable schema processing. Default is off.
-x=XXX Use a particular encoding for output. Default is
the same encoding as the input XML file. UTF-8 if
input XML file has not XML declaration.
@@ -209,7 +325,7 @@
UTF-8, USASCII, ISO8859-1, UTF-16[BL]E, UCS-4[BL]E,
WINDOWS-1252, IBM1140, IBM037
-<?xml version="1.0" encoding="iso-8859-1"?>
+<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE personnel SYSTEM "personal.dtd">
<!-- @version: -->
@@ -253,7 +369,7 @@
</personnel>
-<?xml version="1.0" encoding="iso-8859-1"?>
+<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE personnel SYSTEM "personal.dtd">
<!-- @version: -->
@@ -297,8 +413,8 @@
</personnel>
-stdin:{timing removed}(37 elems, 12 attrs, 0 spaces, 268 chars)
stdin:{timing removed}(37 elems, 12 attrs, 134 spaces, 134 chars)
+stdin:{timing removed}(37 elems, 12 attrs, 0 spaces, 268 chars)
Usage: PParse [options] <file>
@@ -310,9 +426,12 @@
At that point, our progressive parse loop exits.
Options:
- -v - Do validation [default is off]
+ -v=xxx - Validation scheme [always | never | auto*]
-n - Enable namespace processing [default is off]
+ -s - Enable schema processing [default is off]
-? - Show this help (must be the only parameter)
+
+ * = Default if not provided explicitly
Got the required 16 elements
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org