Source Code Cross Referenced for LSParserFilter.java in  » 6.0-JDK-Core » w3c » org » w3c » dom » ls » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » w3c » org.w3c.dom.ls 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001        /*
002         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
003         *
004         * This code is free software; you can redistribute it and/or modify it
005         * under the terms of the GNU General Public License version 2 only, as
006         * published by the Free Software Foundation.  Sun designates this
007         * particular file as subject to the "Classpath" exception as provided
008         * by Sun in the LICENSE file that accompanied this code.
009         *
010         * This code is distributed in the hope that it will be useful, but WITHOUT
011         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
012         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
013         * version 2 for more details (a copy is included in the LICENSE file that
014         * accompanied this code).
015         *
016         * You should have received a copy of the GNU General Public License version
017         * 2 along with this work; if not, write to the Free Software Foundation,
018         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
019         *
020         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
021         * CA 95054 USA or visit www.sun.com if you need additional information or
022         * have any questions.
023         */
024
025        /*
026         * This file is available under and governed by the GNU General Public
027         * License version 2 only, as published by the Free Software Foundation.
028         * However, the following notice accompanied the original version of this
029         * file and, per its terms, should not be removed:
030         *
031         * Copyright (c) 2004 World Wide Web Consortium,
032         *
033         * (Massachusetts Institute of Technology, European Research Consortium for
034         * Informatics and Mathematics, Keio University). All Rights Reserved. This
035         * work is distributed under the W3C(r) Software License [1] in the hope that
036         * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
037         * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
038         *
039         * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
040         */
041
042        package org.w3c.dom.ls;
043
044        import org.w3c.dom.Node;
045        import org.w3c.dom.Element;
046
047        /**
048         *  <code>LSParserFilter</code>s provide applications the ability to examine 
049         * nodes as they are being constructed while parsing. As each node is 
050         * examined, it may be modified or removed, or the entire parse may be 
051         * terminated early. 
052         * <p> At the time any of the filter methods are called by the parser, the 
053         * owner Document and DOMImplementation objects exist and are accessible. 
054         * The document element is never passed to the <code>LSParserFilter</code> 
055         * methods, i.e. it is not possible to filter out the document element. 
056         * <code>Document</code>, <code>DocumentType</code>, <code>Notation</code>, 
057         * <code>Entity</code>, and <code>Attr</code> nodes are never passed to the 
058         * <code>acceptNode</code> method on the filter. The child nodes of an 
059         * <code>EntityReference</code> node are passed to the filter if the 
060         * parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-entities'>
061         * entities</a>" is set to <code>false</code>. Note that, as described by the parameter "<a href='http://www.w3.org/TR/DOM-Level-3-Core/core.html#parameter-entities'>
062         * entities</a>", unexpanded entity reference nodes are never discarded and are always 
063         * passed to the filter. 
064         * <p> All validity checking while parsing a document occurs on the source 
065         * document as it appears on the input stream, not on the DOM document as it 
066         * is built in memory. With filters, the document in memory may be a subset 
067         * of the document on the stream, and its validity may have been affected by 
068         * the filtering. 
069         * <p> All default attributes must be present on elements when the elements 
070         * are passed to the filter methods. All other default content must be 
071         * passed to the filter methods. 
072         * <p> DOM applications must not raise exceptions in a filter. The effect of 
073         * throwing exceptions from a filter is DOM implementation dependent. 
074         * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407'>Document Object Model (DOM) Level 3 Load
075         and Save Specification</a>.
076         */
077        public interface LSParserFilter {
078            // Constants returned by startElement and acceptNode
079            /**
080             * Accept the node.
081             */
082            public static final short FILTER_ACCEPT = 1;
083            /**
084             * Reject the node and its children.
085             */
086            public static final short FILTER_REJECT = 2;
087            /**
088             * Skip this single node. The children of this node will still be 
089             * considered. 
090             */
091            public static final short FILTER_SKIP = 3;
092            /**
093             *  Interrupt the normal processing of the document. 
094             */
095            public static final short FILTER_INTERRUPT = 4;
096
097            /**
098             *  The parser will call this method after each <code>Element</code> start 
099             * tag has been scanned, but before the remainder of the 
100             * <code>Element</code> is processed. The intent is to allow the 
101             * element, including any children, to be efficiently skipped. Note that 
102             * only element nodes are passed to the <code>startElement</code> 
103             * function. 
104             * <br>The element node passed to <code>startElement</code> for filtering 
105             * will include all of the Element's attributes, but none of the 
106             * children nodes. The Element may not yet be in place in the document 
107             * being constructed (it may not have a parent node.) 
108             * <br>A <code>startElement</code> filter function may access or change 
109             * the attributes for the Element. Changing Namespace declarations will 
110             * have no effect on namespace resolution by the parser.
111             * <br>For efficiency, the Element node passed to the filter may not be 
112             * the same one as is actually placed in the tree if the node is 
113             * accepted. And the actual node (node object identity) may be reused 
114             * during the process of reading in and filtering a document.
115             * @param elementArg The newly encountered element. At the time this 
116             *   method is called, the element is incomplete - it will have its 
117             *   attributes, but no children. 
118             * @return 
119             * <ul>
120             * <li> <code>FILTER_ACCEPT</code> if the <code>Element</code> should 
121             *   be included in the DOM document being built. 
122             * </li>
123             * <li> 
124             *   <code>FILTER_REJECT</code> if the <code>Element</code> and all of 
125             *   its children should be rejected. 
126             * </li>
127             * <li> <code>FILTER_SKIP</code> if the 
128             *   <code>Element</code> should be skipped. All of its children are 
129             *   inserted in place of the skipped <code>Element</code> node. 
130             * </li>
131             * <li> 
132             *   <code>FILTER_INTERRUPT</code> if the filter wants to stop the 
133             *   processing of the document. Interrupting the processing of the 
134             *   document does no longer guarantee that the resulting DOM tree is 
135             *   XML well-formed. The <code>Element</code> is rejected. 
136             * </li>
137             * </ul> Returning 
138             *   any other values will result in unspecified behavior. 
139             */
140            public short startElement(Element elementArg);
141
142            /**
143             * This method will be called by the parser at the completion of the 
144             * parsing of each node. The node and all of its descendants will exist 
145             * and be complete. The parent node will also exist, although it may be 
146             * incomplete, i.e. it may have additional children that have not yet 
147             * been parsed. Attribute nodes are never passed to this function.
148             * <br>From within this method, the new node may be freely modified - 
149             * children may be added or removed, text nodes modified, etc. The state 
150             * of the rest of the document outside this node is not defined, and the 
151             * affect of any attempt to navigate to, or to modify any other part of 
152             * the document is undefined. 
153             * <br>For validating parsers, the checks are made on the original 
154             * document, before any modification by the filter. No validity checks 
155             * are made on any document modifications made by the filter.
156             * <br>If this new node is rejected, the parser might reuse the new node 
157             * and any of its descendants.
158             * @param nodeArg The newly constructed element. At the time this method 
159             *   is called, the element is complete - it has all of its children 
160             *   (and their children, recursively) and attributes, and is attached 
161             *   as a child to its parent. 
162             * @return 
163             * <ul>
164             * <li> <code>FILTER_ACCEPT</code> if this <code>Node</code> should 
165             *   be included in the DOM document being built. 
166             * </li>
167             * <li> 
168             *   <code>FILTER_REJECT</code> if the <code>Node</code> and all of its 
169             *   children should be rejected. 
170             * </li>
171             * <li> <code>FILTER_SKIP</code> if the 
172             *   <code>Node</code> should be skipped and the <code>Node</code> 
173             *   should be replaced by all the children of the <code>Node</code>. 
174             * </li>
175             * <li> 
176             *   <code>FILTER_INTERRUPT</code> if the filter wants to stop the 
177             *   processing of the document. Interrupting the processing of the 
178             *   document does no longer guarantee that the resulting DOM tree is 
179             *   XML well-formed. The <code>Node</code> is accepted and will be the 
180             *   last completely parsed node. 
181             * </li>
182             * </ul>
183             */
184            public short acceptNode(Node nodeArg);
185
186            /**
187             *  Tells the <code>LSParser</code> what types of nodes to show to the 
188             * method <code>LSParserFilter.acceptNode</code>. If a node is not shown 
189             * to the filter using this attribute, it is automatically included in 
190             * the DOM document being built. See <code>NodeFilter</code> for 
191             * definition of the constants. The constants <code>SHOW_ATTRIBUTE</code>
192             * , <code>SHOW_DOCUMENT</code>, <code>SHOW_DOCUMENT_TYPE</code>, 
193             * <code>SHOW_NOTATION</code>, <code>SHOW_ENTITY</code>, and 
194             * <code>SHOW_DOCUMENT_FRAGMENT</code> are meaningless here. Those nodes 
195             * will never be passed to <code>LSParserFilter.acceptNode</code>. 
196             * <br> The constants used here are defined in [<a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>DOM Level 2 Traversal and      Range</a>]
197             * . 
198             */
199            public int getWhatToShow();
200
201        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.