peiyongz 2003/01/28 10:30:56
Modified: c/samples/DOMPrint DOMPrint.cpp
Log:
Bug#13694: Allow Xerces to write the BOM to XML files
Revision Changes Path
1.54 +21 -1 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.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- DOMPrint.cpp 14 Nov 2002 18:29:57 -0000 1.53
+++ DOMPrint.cpp 28 Jan 2003 18:30:56 -0000 1.54
@@ -179,6 +179,7 @@
static bool gDiscardDefaultContent = true;
static bool gUseFilter = false;
static bool gFormatPrettyPrint = false;
+static bool gWriteBOM = false;
static XercesDOMParser::ValSchemes gValScheme = XercesDOMParser::Val_Auto;
@@ -208,6 +209,7 @@
" -wddc=xxx Enable/Disable discard-default-content. Default on\n"
" -wflt=xxx Enable/Disable filtering. Default
off\n"
" -wfpp=xxx Enable/Disable format-pretty-print. Default
off\n"
+ " -wbom=xxx Enable/Disable write Byte-Order-Mark Default
off\n"
" -? Show this help.\n\n"
" * = Default if not provided explicitly.\n\n"
"The parser has intrinsic support for the following encodings:\n"
@@ -375,6 +377,21 @@
return 2;
}
}
+ else if (!strncmp(argV[parmInd], "-wbom=", 6))
+ {
+ const char* const parm = &argV[parmInd][6];
+
+ if (!strcmp(parm, "on"))
+ gWriteBOM = true;
+ else if (!strcmp(parm, "off"))
+ gWriteBOM = false;
+ else
+ {
+ cerr << "Unknown -wbom= value: " << parm << endl;
+ XMLPlatformUtils::Terminate();
+ return 2;
+ }
+ }
else
{
cerr << "Unknown option '" << argV[parmInd]
@@ -493,6 +510,9 @@
if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
gFormatPrettyPrint))
theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint,
gFormatPrettyPrint);
+
+ if (theSerializer->canSetFeature(XMLUni::fgDOMWRTBOM, gWriteBOM))
+ theSerializer->setFeature(XMLUni::fgDOMWRTBOM, gWriteBOM);
//
// Plug in a format target to receive the resultant
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]