remove xcerces2

This commit is contained in:
berniev
2022-09-02 10:03:27 +10:00
committed by wwmayer
parent 282fa8bc3b
commit 5678fc1abe
7 changed files with 0 additions and 254 deletions

View File

@@ -28,9 +28,6 @@
# include <cassert>
# include <memory>
# include <xercesc/dom/DOM.hpp>
# if (XERCES_VERSION_MAJOR == 2)
# include <xercesc/dom/DOMWriter.hpp>
# endif
# include <xercesc/framework/LocalFileFormatTarget.hpp>
# include <xercesc/framework/LocalFileInputSource.hpp>
# include <xercesc/framework/MemBufFormatTarget.hpp>
@@ -112,40 +109,6 @@ public:
};
#if (XERCES_VERSION_MAJOR == 2)
class DOMPrintFilter : public DOMWriterFilter
{
public:
/** @name Constructors */
DOMPrintFilter(unsigned long whatToShow = DOMNodeFilter::SHOW_ALL);
//@{
/** @name Destructors */
~DOMPrintFilter() {};
//@{
/** @ interface from DOMWriterFilter */
virtual short acceptNode(const XERCES_CPP_NAMESPACE_QUALIFIER DOMNode*) const;
//@{
virtual unsigned long getWhatToShow() const {
return fWhatToShow;
};
virtual void setWhatToShow(unsigned long toShow) {
fWhatToShow = toShow;
};
private:
// unimplemented copy ctor and assignment operator
DOMPrintFilter(const DOMPrintFilter&);
DOMPrintFilter & operator = (const DOMPrintFilter&);
unsigned long fWhatToShow;
};
#else
class DOMPrintFilter : public DOMLSSerializerFilter
{
public:
@@ -173,7 +136,6 @@ private:
ShowType fWhatToShow;
};
#endif
class DOMPrintErrorHandler : public DOMErrorHandler
{
public:
@@ -1370,74 +1332,6 @@ void ParameterManager::SaveDocument(const char* sFileName) const
void ParameterManager::SaveDocument(XMLFormatTarget* pFormatTarget) const
{
#if (XERCES_VERSION_MAJOR == 2)
DOMPrintFilter *myFilter = 0;
try {
// get a serializer, an instance of DOMWriter
XMLCh tempStr[100];
XMLString::transcode("LS", tempStr, 99);
DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(tempStr);
DOMWriter *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();
// set user specified end of line sequence and output encoding
theSerializer->setNewLine(gMyEOLSequence);
theSerializer->setEncoding(gOutputEncoding);
// plug in user's own filter
if (gUseFilter) {
// even we say to show attribute, but the DOMWriter
// will not show attribute nodes to the filter as
// the specs explicitly says that DOMWriter shall
// NOT show attributes to DOMWriterFilter.
//
// so DOMNodeFilter::SHOW_ATTRIBUTE has no effect.
// same DOMNodeFilter::SHOW_DOCUMENT_TYPE, no effect.
//
myFilter = new DOMPrintFilter(DOMNodeFilter::SHOW_ELEMENT |
DOMNodeFilter::SHOW_ATTRIBUTE |
DOMNodeFilter::SHOW_DOCUMENT_TYPE
);
theSerializer->setFilter(myFilter);
}
// plug in user's own error handler
DOMErrorHandler *myErrorHandler = new DOMPrintErrorHandler();
theSerializer->setErrorHandler(myErrorHandler);
// set feature if the serializer supports the feature/mode
if (theSerializer->canSetFeature(XMLUni::fgDOMWRTSplitCdataSections, gSplitCdataSections))
theSerializer->setFeature(XMLUni::fgDOMWRTSplitCdataSections, gSplitCdataSections);
if (theSerializer->canSetFeature(XMLUni::fgDOMWRTDiscardDefaultContent, gDiscardDefaultContent))
theSerializer->setFeature(XMLUni::fgDOMWRTDiscardDefaultContent, gDiscardDefaultContent);
if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, gFormatPrettyPrint))
theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, gFormatPrettyPrint);
//
// do the serialization through DOMWriter::writeNode();
//
theSerializer->writeNode(pFormatTarget, *_pDocument);
delete theSerializer;
//
// Filter and error handler
// are NOT owned by the serializer.
//
delete myErrorHandler;
if (gUseFilter)
delete myFilter;
}
catch (XMLException& e) {
std::cerr << "An error occurred during creation of output transcoder. Msg is:"
<< std::endl
<< StrX(e.getMessage()) << std::endl;
}
#else
try {
std::unique_ptr<DOMPrintFilter> myFilter;
std::unique_ptr<DOMErrorHandler> myErrorHandler;
@@ -1495,7 +1389,6 @@ void ParameterManager::SaveDocument(XMLFormatTarget* pFormatTarget) const
<< std::endl
<< StrX(e.getMessage()) << std::endl;
}
#endif
}
void ParameterManager::CreateDocument()
@@ -1613,81 +1506,6 @@ void DOMTreeErrorReporter::resetErrors()
//**************************************************************************
// DOMPrintFilter
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#if (XERCES_VERSION_MAJOR == 2)
DOMPrintFilter::DOMPrintFilter(unsigned long whatToShow)
:fWhatToShow(whatToShow)
{
}
short DOMPrintFilter::acceptNode(const DOMNode* node) const
{
//
// The DOMWriter shall call getWhatToShow() before calling
// acceptNode(), to show nodes which are supposed to be
// shown to this filter.
// TODO:
// REVISIT: In case the DOMWriter does not follow the protocol,
// Shall the filter honor, or NOT, what it claims
// (when it is constructed/setWhatToShow())
// it is interested in ?
//
// The DOMLS specs does not specify that acceptNode() shall do
// this way, or not, so it is up the implementation,
// to skip the code below for the sake of performance ...
//
if ((getWhatToShow() & (1 << (node->getNodeType() - 1))) == 0)
return DOMNodeFilter::FILTER_ACCEPT;
switch (node->getNodeType()) {
case DOMNode::ELEMENT_NODE: {
// for element whose name is "person", skip it
//if (XMLString::compareString(node->getNodeName(), element_person)==0)
// return DOMNodeFilter::FILTER_SKIP;
// for element whose name is "line", reject it
//if (XMLString::compareString(node->getNodeName(), element_link)==0)
// return DOMNodeFilter::FILTER_REJECT;
// for rest, accept it
return DOMNodeFilter::FILTER_ACCEPT;
break;
}
case DOMNode::COMMENT_NODE: {
// the WhatToShow will make this no effect
//return DOMNodeFilter::FILTER_REJECT;
return DOMNodeFilter::FILTER_ACCEPT;
break;
}
case DOMNode::TEXT_NODE: {
// the WhatToShow will make this no effect
//return DOMNodeFilter::FILTER_REJECT;
return DOMNodeFilter::FILTER_ACCEPT;
break;
}
case DOMNode::DOCUMENT_TYPE_NODE: {
// even we say we are going to process document type,
// we are not able be to see this node since
// DOMWriterImpl (a XercesC's default implementation
// of DOMWriter) will not pass DocumentType node to
// this filter.
//
return DOMNodeFilter::FILTER_REJECT; // no effect
break;
}
case DOMNode::DOCUMENT_NODE: {
// same as DOCUMENT_NODE
return DOMNodeFilter::FILTER_REJECT; // no effect
break;
}
default : {
return DOMNodeFilter::FILTER_ACCEPT;
break;
}
}
return DOMNodeFilter::FILTER_ACCEPT;
}
#else
DOMPrintFilter::DOMPrintFilter(ShowType whatToShow)
: fWhatToShow(whatToShow)
{
@@ -1737,7 +1555,6 @@ DOMPrintFilter::FilterAction DOMPrintFilter::acceptNode(const DOMNode* node) con
return DOMNodeFilter::FILTER_ACCEPT;
}
#endif
//**************************************************************************
//**************************************************************************