diff --git a/doc/domprint.xml b/doc/domprint.xml index e7045dddb912c776770148b28bac8a965f61f82b..a47e1ef997e70839a2a0c932b1990529eee62535 100644 --- a/doc/domprint.xml +++ b/doc/domprint.xml @@ -37,6 +37,7 @@ Options: -wscs=xxx Enable/Disable split-cdata-sections. Default on. -wddc=xxx Enable/Disable discard-default-content. Default on. -wflt=xxx Enable/Disable filtering. Default off. + -wfpp=xxx Enable/Disable format-pretty-print. Default off. -? Show this help * = Default if not provided explicitly. diff --git a/samples/DOMPrint/DOMPrint.cpp b/samples/DOMPrint/DOMPrint.cpp index 6c7a3fb3fd766b675f3353b6415d78e0f9410afe..5430d89abab24da8e143024a467a3e07412cf6b7 100644 --- a/samples/DOMPrint/DOMPrint.cpp +++ b/samples/DOMPrint/DOMPrint.cpp @@ -176,6 +176,7 @@ static const XMLCh* gMyEOLSequence = 0; static bool gSplitCdataSections = true; static bool gDiscardDefaultContent = true; static bool gUseFilter = false; +static bool gFormatPrettyPrint = false; static XercesDOMParser::ValSchemes gValScheme = XercesDOMParser::Val_Auto; @@ -203,6 +204,7 @@ void usage() " -wscs=xxx Enable/Disable split-cdata-sections. Default on \n" " -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" " -? Show this help.\n\n" " * = Default if not provided explicitly.\n\n" "The parser has intrinsic support for the following encodings:\n" @@ -350,6 +352,21 @@ int main(int argC, char* argV[]) XMLPlatformUtils::Terminate(); return 2; } + } + else if (!strncmp(argV[parmInd], "-wfpp=", 6)) + { + const char* const parm = &argV[parmInd][6]; + + if (!strcmp(parm, "on")) + gFormatPrettyPrint = true; + else if (!strcmp(parm, "off")) + gFormatPrettyPrint = false; + else + { + cerr << "Unknown -wfpp= value: " << parm << endl; + XMLPlatformUtils::Terminate(); + return 2; + } } else { @@ -461,7 +478,10 @@ int main(int argC, char* argV[]) if (theSerializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent, gDiscardDefaultContent)) theSerializer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent, gDiscardDefaultContent); - // + if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, gFormatPrettyPrint)) + theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, gFormatPrettyPrint); + + // // Plug in a format target to receive the resultant // XML stream from the serializer. // diff --git a/scripts/sanityTest_ExpectedResult.log b/scripts/sanityTest_ExpectedResult.log index 352f12b617e0d61394dfe87fa160c2f9e9368d31..1b147955fb7a1eb99ad6fc1ac44691d54289e235 100644 --- a/scripts/sanityTest_ExpectedResult.log +++ b/scripts/sanityTest_ExpectedResult.log @@ -427,6 +427,7 @@ Options: -wscs=xxx Enable/Disable split-cdata-sections. Default on -wddc=xxx Enable/Disable discard-default-content. Default on -wflt=xxx Enable/Disable filtering. Default off + -wfpp=xxx Enable/Disable format-pretty-print. Default off -? Show this help. * = Default if not provided explicitly.