Skip to content
Snippets Groups Projects
Commit 56a0d52a authored by PeiYong Zhang's avatar PeiYong Zhang
Browse files

*** empty log message ***

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@173788 13f79535-47bb-0310-9956-ffa450edef68
parent 743bf8c6
No related branches found
No related tags found
No related merge requests found
......@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
* Revision 1.2 2002/06/03 22:40:07 peiyongz
* *** empty log message ***
*
* Revision 1.1 2002/05/29 13:33:32 peiyongz
* DOM3 Save Interface: DOMWriter/DOMWriterFilter
*
......@@ -76,64 +79,78 @@ static const XMLCh element_link[]=
chLatin_l, chLatin_i, chLatin_n, chLatin_k, chNull
};
DOMPrintFilter::DOMPrintFilter(unsigned long toShowMask)
:DOMWriterFilter(toShowMask)
DOMPrintFilter::DOMPrintFilter(unsigned long whatToShow)
:DOMWriterFilter(whatToShow)
{}
short DOMPrintFilter::acceptNode(const DOMNode *const node) const
short DOMPrintFilter::acceptNode(const DOMNode* node) const
{
//
// We are to process what we claimed interested in
// The DOMWriter shall call getWhatToShow() before calling
// acceptNode(), to show nodes which are supposed to be
// shown to this filter.
//
// REVISIT: In case the DOMWriter does not follow the protocol,
// Shall the filter honour, or NOT, what it claimes
// (when it is constructed/setWhatToShow())
// it is interested in ?
//
if (!showNode(node))
// 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:
{
if (XMLString::compareString(node->getNodeName(), element_person)==0)
{
return DOMNodeFilter::FILTER_SKIP;
}
// 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;
if (XMLString::compareString(node->getNodeName(), element_link)==0)
break;
}
case DOMNode::COMMENT_NODE:
{
// the WhatToShow will make this no effect
return DOMNodeFilter::FILTER_REJECT;
break;
}
break;
}
case DOMNode::COMMENT_NODE:
{
//return DOMNodeFilter::FILTER_REJECT;
break;
}
case DOMNode::TEXT_NODE:
{
//return DOMNodeFilter::FILTER_REJECT;
break;
}
{
// the WhatToShow will make this no effect
return DOMNodeFilter::FILTER_REJECT;
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
// DOMWriterFilter will block it
//
return DOMNodeFilter::FILTER_REJECT; // no effect
break;
}
{
// 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;
}
{
// same as DOCUMENT_NODE
return DOMNodeFilter::FILTER_REJECT; // no effect
break;
}
default :
{
return DOMNodeFilter::FILTER_ACCEPT;
break;
}
break;
}
return DOMNodeFilter::FILTER_ACCEPT;
......
......@@ -57,6 +57,9 @@
/*
* $Id$
* $Log$
* Revision 1.2 2002/06/03 22:40:07 peiyongz
* *** empty log message ***
*
* Revision 1.1 2002/05/29 13:33:32 peiyongz
* DOM3 Save Interface: DOMWriter/DOMWriterFilter
*
......@@ -76,7 +79,7 @@ class DOMPrintFilter : public DOMWriterFilter {
public:
/** @name Constructors */
DOMPrintFilter(unsigned long toShowMask = DOMNodeFilter::SHOW_ALL);
DOMPrintFilter(unsigned long whatToShow = DOMNodeFilter::SHOW_ALL);
//@{
/** @name Destructors */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment