source: icXML/icXML-devel/src/xercesc/dom/DOMLSParserFilter.hpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 6.8 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: DOMLSParserFilter.hpp 671894 2008-06-26 13:29:21Z borisk $
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP)
23#define XERCESC_INCLUDE_GUARD_DOMLSPARSERFILTER_HPP
24
25 /**
26 *
27 * DOMLSParserFilter.hpp: interface for the DOMLSParserFilter class.
28 *
29 * DOMLSParserFilter provide applications the ability to examine nodes
30 * as they are being created during the parse process.
31 *
32 * DOMLSParserFilter lets the application decide what nodes should be
33 * in the output DOM tree or not.
34 *
35 * @since DOM Level 3
36 */
37
38#include <xercesc/dom/DOMNodeFilter.hpp>
39
40XERCES_CPP_NAMESPACE_BEGIN
41
42class DOMElement;
43class DOMNode;
44
45class CDOM_EXPORT DOMLSParserFilter {
46protected:
47    // -----------------------------------------------------------------------
48    //  Hidden constructors
49    // -----------------------------------------------------------------------
50    /** @name Hidden constructors */
51    //@{
52    DOMLSParserFilter() {};
53    //@}
54
55private:
56    // -----------------------------------------------------------------------
57    // Unimplemented constructors and operators
58    // -----------------------------------------------------------------------
59    /** @name Unimplemented constructors and operators */
60    //@{
61    DOMLSParserFilter(const DOMLSParserFilter &);
62    DOMLSParserFilter & operator = (const DOMLSParserFilter &);
63    //@}
64
65
66public:
67    // -----------------------------------------------------------------------
68    //  All constructors are hidden, just the destructor is available
69    // -----------------------------------------------------------------------
70    /** @name Destructor */
71    //@{
72    /**
73     * Destructor
74     *
75     */
76    virtual ~DOMLSParserFilter() {};
77    //@}
78
79    // -----------------------------------------------------------------------
80    //  Class Types
81    // -----------------------------------------------------------------------
82    /** @name Public Contants */
83    //@{
84    /**
85     * Constants returned by acceptNode.
86     *
87     * <p><code>FILTER_ACCEPT:</code>
88     * Accept the node.</p>
89     *
90     * <p><code>FILTER_REJECT:</code>
91     * Reject the node and its children.</p>
92     *
93     * <p><code>FILTER_SKIP:</code>
94     * Skip this single node. The children of this node will still be considered.</p>
95     *
96     * <p><code>FILTER_INTERRUPT:</code>
97     * Interrupt the normal processing of the document.</p>
98     *
99     * @since DOM Level 3
100     */
101    enum FilterAction {FILTER_ACCEPT = 1,
102                       FILTER_REJECT = 2,
103                       FILTER_SKIP   = 3,
104                       FILTER_INTERRUPT = 4};
105
106    // -----------------------------------------------------------------------
107    //  Virtual DOMLSParserFilter interface
108    // -----------------------------------------------------------------------
109    /** @name Functions introduced in DOM Level 3 */
110    //@{
111         /**
112       * This method will be called by the parser at the completion of the parsing of each node.
113       * The node and all of its descendants will exist and be complete. The parent node will also exist,
114       * although it may be incomplete, i.e. it may have additional children that have not yet been parsed.
115       * Attribute nodes are never passed to this function.
116       * From within this method, the new node may be freely modified - children may be added or removed,
117       * text nodes modified, etc. The state of the rest of the document outside this node is not defined,
118       * and the affect of any attempt to navigate to, or to modify any other part of the document is undefined.
119       * For validating parsers, the checks are made on the original document, before any modification by the
120       * filter. No validity checks are made on any document modifications made by the filter.
121       * If this new node is rejected, the parser might reuse the new node and any of its descendants.
122       *
123       * @param node The newly constructed element. At the time this method is called, the element is complete -
124       *             it has all of its children (and their children, recursively) and attributes, and is attached
125       *             as a child to its parent.
126       * @return One of the FilterAction enum
127       */
128    virtual FilterAction acceptNode(DOMNode* node) = 0;
129
130         /**
131       * The parser will call this method after each <code>DOMElement</code> start tag has been scanned,
132       * but before the remainder of the <code>DOMElement</code> is processed. The intent is to allow the element,
133       * including any children, to be efficiently skipped. Note that only element nodes are passed to the
134       * startElement function.
135       * The element node passed to startElement for filtering will include all of the attributes, but none
136       * of the children nodes. The <code>DOMElement</code> may not yet be in place in the document being
137       * constructed (it may not have a parent node.)
138       * A startElement filter function may access or change the attributes for the <code>DOMElement</code>.
139       * Changing namespace declarations will have no effect on namespace resolution by the parser.
140       *
141       * @param node The newly encountered element. At the time this method is called, the element is incomplete -
142       *             it will have its attributes, but no children.
143       * @return One of the FilterAction enum
144       */
145    virtual FilterAction startElement(DOMElement* node) = 0;
146
147    /**
148     * Tells the <code>DOMLSParser</code> what types of nodes to show to the method <code>DOMLSParserFilter::acceptNode</code>.
149     * If a node is not shown to the filter using this attribute, it is automatically included in the DOM document being built.
150     * See <code>DOMNodeFilter</code> for definition of the constants. The constants SHOW_ATTRIBUTE, SHOW_DOCUMENT,
151     * SHOW_DOCUMENT_TYPE, SHOW_NOTATION, SHOW_ENTITY, and SHOW_DOCUMENT_FRAGMENT are meaningless here.
152     * Those nodes will never be passed to DOMLSParserFilter::acceptNode.
153     *
154     * @return The constants of what types of nodes to show.
155     * @since DOM Level 3
156     */
157    virtual DOMNodeFilter::ShowType getWhatToShow() const = 0;
158
159    //@}
160};
161
162XERCES_CPP_NAMESPACE_END
163
164#endif
Note: See TracBrowser for help on using the repository browser.