Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:51

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 #if !defined(XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP)
0023 #define XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP
0024 
0025  /**
0026  *
0027  * DOMLSParserFilter.hpp: interface for the DOMLSParserFilter class.
0028  *
0029  * DOMLSParserFilter provide applications the ability to examine nodes
0030  * as they are being created during the parse process.
0031  *
0032  * DOMLSParserFilter lets the application decide what nodes should be
0033  * in the output DOM tree or not.
0034  *
0035  * @since DOM Level 3
0036  */
0037 
0038 #include <xercesc/dom/DOMNodeFilter.hpp>
0039 
0040 XERCES_CPP_NAMESPACE_BEGIN
0041 
0042 class DOMElement;
0043 class DOMNode;
0044 
0045 class CDOM_EXPORT DOMLSParserFilter {
0046 protected:
0047     // -----------------------------------------------------------------------
0048     //  Hidden constructors
0049     // -----------------------------------------------------------------------
0050     /** @name Hidden constructors */
0051     //@{
0052     DOMLSParserFilter() {};
0053     //@}
0054 
0055 private:
0056     // -----------------------------------------------------------------------
0057     // Unimplemented constructors and operators
0058     // -----------------------------------------------------------------------
0059     /** @name Unimplemented constructors and operators */
0060     //@{
0061     DOMLSParserFilter(const DOMLSParserFilter &);
0062     DOMLSParserFilter & operator = (const DOMLSParserFilter &);
0063     //@}
0064 
0065 
0066 public:
0067     // -----------------------------------------------------------------------
0068     //  All constructors are hidden, just the destructor is available
0069     // -----------------------------------------------------------------------
0070     /** @name Destructor */
0071     //@{
0072     /**
0073      * Destructor
0074      *
0075      */
0076     virtual ~DOMLSParserFilter() {};
0077     //@}
0078 
0079     // -----------------------------------------------------------------------
0080     //  Class Types
0081     // -----------------------------------------------------------------------
0082     /** @name Public Contants */
0083     //@{
0084     /**
0085      * Constants returned by acceptNode.
0086      *
0087      * <p><code>FILTER_ACCEPT:</code>
0088      * Accept the node.</p>
0089      *
0090      * <p><code>FILTER_REJECT:</code>
0091      * Reject the node and its children.</p>
0092      *
0093      * <p><code>FILTER_SKIP:</code>
0094      * Skip this single node. The children of this node will still be considered.</p>
0095      *
0096      * <p><code>FILTER_INTERRUPT:</code>
0097      * Interrupt the normal processing of the document.</p>
0098      *
0099      * @since DOM Level 3
0100      */
0101     enum FilterAction {FILTER_ACCEPT = 1,
0102                        FILTER_REJECT = 2,
0103                        FILTER_SKIP   = 3,
0104                        FILTER_INTERRUPT = 4};
0105 
0106     // -----------------------------------------------------------------------
0107     //  Virtual DOMLSParserFilter interface
0108     // -----------------------------------------------------------------------
0109     /** @name Functions introduced in DOM Level 3 */
0110     //@{
0111      /**
0112        * This method will be called by the parser at the completion of the parsing of each node.
0113        * The node and all of its descendants will exist and be complete. The parent node will also exist,
0114        * although it may be incomplete, i.e. it may have additional children that have not yet been parsed.
0115        * Attribute nodes are never passed to this function.
0116        * From within this method, the new node may be freely modified - children may be added or removed,
0117        * text nodes modified, etc. The state of the rest of the document outside this node is not defined,
0118        * and the affect of any attempt to navigate to, or to modify any other part of the document is undefined.
0119        * For validating parsers, the checks are made on the original document, before any modification by the
0120        * filter. No validity checks are made on any document modifications made by the filter.
0121        * If this new node is rejected, the parser might reuse the new node and any of its descendants.
0122        *
0123        * @param node The newly constructed element. At the time this method is called, the element is complete -
0124        *             it has all of its children (and their children, recursively) and attributes, and is attached
0125        *             as a child to its parent.
0126        * @return One of the FilterAction enum
0127        */
0128     virtual FilterAction acceptNode(DOMNode* node) = 0;
0129 
0130      /**
0131        * The parser will call this method after each <code>DOMElement</code> start tag has been scanned,
0132        * but before the remainder of the <code>DOMElement</code> is processed. The intent is to allow the element,
0133        * including any children, to be efficiently skipped. Note that only element nodes are passed to the
0134        * startElement function.
0135        * The element node passed to startElement for filtering will include all of the attributes, but none
0136        * of the children nodes. The <code>DOMElement</code> may not yet be in place in the document being
0137        * constructed (it may not have a parent node.)
0138        * A startElement filter function may access or change the attributes for the <code>DOMElement</code>.
0139        * Changing namespace declarations will have no effect on namespace resolution by the parser.
0140        *
0141        * @param node The newly encountered element. At the time this method is called, the element is incomplete -
0142        *             it will have its attributes, but no children.
0143        * @return One of the FilterAction enum
0144        */
0145     virtual FilterAction startElement(DOMElement* node) = 0;
0146 
0147     /**
0148      * Tells the <code>DOMLSParser</code> what types of nodes to show to the method <code>DOMLSParserFilter::acceptNode</code>.
0149      * If a node is not shown to the filter using this attribute, it is automatically included in the DOM document being built.
0150      * See <code>DOMNodeFilter</code> for definition of the constants. The constants SHOW_ATTRIBUTE, SHOW_DOCUMENT,
0151      * SHOW_DOCUMENT_TYPE, SHOW_NOTATION, SHOW_ENTITY, and SHOW_DOCUMENT_FRAGMENT are meaningless here.
0152      * Those nodes will never be passed to DOMLSParserFilter::acceptNode.
0153      *
0154      * @return The constants of what types of nodes to show.
0155      * @since DOM Level 3
0156      */
0157     virtual DOMNodeFilter::ShowType getWhatToShow() const = 0;
0158 
0159     //@}
0160 };
0161 
0162 XERCES_CPP_NAMESPACE_END
0163 
0164 #endif