Source Code Cross Referenced for PullFilter.java in  » XML » saxonb » net » sf » saxon » pull » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML » saxonb » net.sf.saxon.pull 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.sf.saxon.pull;
002:
003:        import net.sf.saxon.event.PipelineConfiguration;
004:        import net.sf.saxon.om.AttributeCollection;
005:        import net.sf.saxon.om.NamespaceDeclarations;
006:        import net.sf.saxon.om.NamePool;
007:        import net.sf.saxon.trans.XPathException;
008:        import net.sf.saxon.value.AtomicValue;
009:
010:        import javax.xml.transform.SourceLocator;
011:
012:        /**
013:         * PullFilter is a pass-through filter class that links one PullProvider to another PullProvider
014:         * in a pipeline. This class passes all events through completely unchanged. The class is designed
015:         * so that subclasses can modify this behavior by altering some of the events.
016:         */
017:
018:        public class PullFilter implements  PullProvider {
019:
020:            private PullProvider base;
021:            private PipelineConfiguration pipe;
022:            protected int currentEvent;
023:
024:            /**
025:             * Create a PullFilter
026:             * @param base the PullProvider to which requests are to be passed
027:             */
028:
029:            public PullFilter(PullProvider base) {
030:                this .base = base;
031:                setPipelineConfiguration(base.getPipelineConfiguration());
032:            }
033:
034:            /**
035:             * Set configuration information. This must only be called before any events
036:             * have been read.
037:             */
038:
039:            public void setPipelineConfiguration(PipelineConfiguration pipe) {
040:                this .pipe = pipe;
041:                base.setPipelineConfiguration(pipe);
042:            }
043:
044:            /**
045:             * Get configuration information.
046:             */
047:
048:            public PipelineConfiguration getPipelineConfiguration() {
049:                return pipe;
050:            }
051:
052:            /**
053:             * Helper method to get the current namePool
054:             */
055:
056:            public final NamePool getNamePool() {
057:                return getPipelineConfiguration().getConfiguration()
058:                        .getNamePool();
059:            }
060:
061:            /**
062:             * Get the underlying PullProvider
063:             */
064:
065:            public PullProvider getUnderlyingProvider() {
066:                return base;
067:            }
068:
069:            /**
070:             * Get the next event.
071:             *
072:             * <p>Note that a subclass that overrides this method is responsible for ensuring
073:             * that current() works properly. This can be achieved by setting the field
074:             * currentEvent to the event returned by any call on next().</p>
075:             *
076:             * @return an integer code indicating the type of event. The code
077:             *         {@link #END_OF_INPUT} is returned at the end of the sequence.
078:             */
079:
080:            public int next() throws XPathException {
081:                return base.next();
082:            }
083:
084:            /**
085:             * Get the event most recently returned by next(), or by other calls that change
086:             * the position, for example getStringValue() and skipToMatchingEnd(). This
087:             * method does not change the position of the PullProvider.
088:             *
089:             * @return the current event
090:             */
091:
092:            public int current() {
093:                return currentEvent;
094:            }
095:
096:            /**
097:             * Get the attributes associated with the current element. This method must
098:             * be called only after a START_ELEMENT event has been notified. The contents
099:             * of the returned AttributeCollection are guaranteed to remain unchanged
100:             * until the next START_ELEMENT event, but may be modified thereafter. The object
101:             * should not be modified by the client.
102:             * <p/>
103:             * <p>Attributes may be read before or after reading the namespaces of an element,
104:             * but must not be read after the first child node has been read, or after calling
105:             * one of the methods skipToEnd(), getStringValue(), or getTypedValue().</p>
106:             *
107:             * @return an AttributeCollection representing the attributes of the element
108:             *         that has just been notified.
109:             */
110:
111:            public AttributeCollection getAttributes() throws XPathException {
112:                return base.getAttributes();
113:            }
114:
115:            /**
116:             * Get the namespace declarations associated with the current element. This method must
117:             * be called only after a START_ELEMENT event has been notified. In the case of a top-level
118:             * START_ELEMENT event (that is, an element that either has no parent node, or whose parent
119:             * is not included in the sequence being read), the NamespaceDeclarations object returned
120:             * will contain a namespace declaration for each namespace that is in-scope for this element
121:             * node. In the case of a non-top-level element, the NamespaceDeclarations will contain
122:             * a set of namespace declarations and undeclarations, representing the differences between
123:             * this element and its parent.
124:             * <p/>
125:             * <p>It is permissible for this method to return namespace declarations that are redundant.</p>
126:             * <p/>
127:             * <p>The NamespaceDeclarations object is guaranteed to remain unchanged until the next START_ELEMENT
128:             * event, but may then be overwritten. The object should not be modified by the client.</p>
129:             * <p/>
130:             * <p>Namespaces may be read before or after reading the attributes of an element,
131:             * but must not be read after the first child node has been read, or after calling
132:             * one of the methods skipToEnd(), getStringValue(), or getTypedValue().</p>*
133:             */
134:
135:            public NamespaceDeclarations getNamespaceDeclarations()
136:                    throws XPathException {
137:                return base.getNamespaceDeclarations();
138:            }
139:
140:            /**
141:             * Skip the current subtree. This method may be called only immediately after
142:             * a START_DOCUMENT or START_ELEMENT event. This call returns the matching
143:             * END_DOCUMENT or END_ELEMENT event; the next call on next() will return
144:             * the event following the END_DOCUMENT or END_ELEMENT.
145:             */
146:
147:            public int skipToMatchingEnd() throws XPathException {
148:                return base.skipToMatchingEnd();
149:            }
150:
151:            /**
152:             * Close the event reader. This indicates that no further events are required.
153:             * It is not necessary to close an event reader after {@link #END_OF_INPUT} has
154:             * been reported, but it is recommended to close it if reading terminates
155:             * prematurely. Once an event reader has been closed, the effect of further
156:             * calls on next() is undefined.
157:             */
158:
159:            public void close() {
160:                base.close();
161:            }
162:
163:            /**
164:             * Get the nameCode identifying the name of the current node. This method
165:             * can be used after the {@link #START_ELEMENT}, {@link #PROCESSING_INSTRUCTION},
166:             * {@link #ATTRIBUTE}, or {@link #NAMESPACE} events. With some PullProvider implementations,
167:             * it can also be used after {@link #END_ELEMENT}, but this is not guaranteed: a client who
168:             * requires the information at that point (for example, to do serialization) should insert an
169:             * {@link ElementNameTracker} into the pipeline.
170:             * If called at other times, the result is undefined and may result in an IllegalStateException.
171:             * If called when the current node is an unnamed namespace node (a node representing the default namespace)
172:             * the returned value is -1.
173:             *
174:             * @return the nameCode. The nameCode can be used to obtain the prefix, local name,
175:             *         and namespace URI from the name pool.
176:             */
177:
178:            public int getNameCode() {
179:                return base.getNameCode();
180:            }
181:
182:            /**
183:             * Get the fingerprint of the name of the element. This is similar to the nameCode, except that
184:             * it does not contain any information about the prefix: so two elements with the same fingerprint
185:             * have the same name, excluding prefix. This method
186:             * can be used after the {@link #START_ELEMENT}, {@link #END_ELEMENT}, {@link #PROCESSING_INSTRUCTION},
187:             * {@link #ATTRIBUTE}, or {@link #NAMESPACE} events.
188:             * If called at other times, the result is undefined and may result in an IllegalStateException.
189:             * If called when the current node is an unnamed namespace node (a node representing the default namespace)
190:             * the returned value is -1.
191:             *
192:             * @return the fingerprint. The fingerprint can be used to obtain the local name
193:             *         and namespace URI from the name pool.
194:             */
195:
196:            public int getFingerprint() {
197:                return base.getFingerprint();
198:            }
199:
200:            /**
201:             * Get the string value of the current element, text node, processing-instruction,
202:             * or top-level attribute or namespace node, or atomic value.
203:             * <p/>
204:             * <p>In other situations the result is undefined and may result in an IllegalStateException.</p>
205:             * <p/>
206:             * <p>If the most recent event was a {@link #START_ELEMENT}, this method causes the content
207:             * of the element to be read. The next event notified will be the corresponding {@link #END_ELEMENT}.</p>
208:             *
209:             * @return the String Value of the node in question, defined according to the rules in the
210:             *         XPath data model.
211:             */
212:
213:            public CharSequence getStringValue() throws XPathException {
214:                return base.getStringValue();
215:            }
216:
217:            /**
218:             * Get an atomic value. This call may be used only when the last event reported was
219:             * ATOMIC_VALUE. This indicates that the PullProvider is reading a sequence that contains
220:             * a free-standing atomic value; it is never used when reading the content of a node.
221:             */
222:
223:            public AtomicValue getAtomicValue() {
224:                return base.getAtomicValue();
225:            }
226:
227:            /**
228:             * Get the type annotation of the current attribute or element node, or atomic value.
229:             * The result of this method is undefined unless the most recent event was START_ELEMENT,
230:             * ATTRIBUTE, or ATOMIC_VALUE.
231:             *
232:             * @return the type annotation. This code is the fingerprint of a type name, which may be
233:             *         resolved to a {@link net.sf.saxon.type.SchemaType} by access to the Configuration.
234:             */
235:
236:            public int getTypeAnnotation() {
237:                return base.getTypeAnnotation();
238:            }
239:
240:            /**
241:             * Get the location of the current event.
242:             * For an event stream representing a real document, the location information
243:             * should identify the location in the lexical XML source. For a constructed document, it should
244:             * identify the location in the query or stylesheet that caused the node to be created.
245:             * A value of null can be returned if no location information is available.
246:             */
247:
248:            public SourceLocator getSourceLocator() {
249:                return base.getSourceLocator();
250:            }
251:        }
252:
253:        //
254:        // The contents of this file are subject to the Mozilla Public License Version 1.0 (the "License");
255:        // you may not use this file except in compliance with the License. You may obtain a copy of the
256:        // License at http://www.mozilla.org/MPL/
257:        //
258:        // Software distributed under the License is distributed on an "AS IS" basis,
259:        // WITHOUT WARRANTY OF ANY KIND, either express or implied.
260:        // See the License for the specific language governing rights and limitations under the License.
261:        //
262:        // The Original Code is: all this file.
263:        //
264:        // The Initial Developer of the Original Code is Michael H. Kay.
265:        //
266:        // Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
267:        //
268:        // Contributor(s): none.
269:        //
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.