Java Doc for XMLReader.java in  » 6.0-JDK-Modules » jax-ws-runtime » com » sun » xml » ws » streaming » 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 » 6.0 JDK Modules » jax ws runtime » com.sun.xml.ws.streaming 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.sun.xml.ws.streaming.XMLReader

XMLReader
public interface XMLReader (Code)

XMLReader provides a high-level streaming parser interface for reading XML documents.

The XMLReader.next method is used to read events from the XML document.

Each time it is called, XMLReader.next returns the new state of the reader.

Possible states are: BOF, the initial state, START, denoting the start tag of an element, END, denoting the end tag of an element, CHARS, denoting the character content of an element, PI, denoting a processing instruction, EOF, denoting the end of the document.

Depending on the state the reader is in, one or more of the following query methods will be meaningful: XMLReader.getName , XMLReader.getURI , XMLReader.getLocalName , XMLReader.getAttributes , XMLReader.getValue .

Elements visited by a XMLReader are tagged with unique IDs. The ID of the current element can be found by calling XMLReader.getElementId .

A XMLReader is always namespace-aware, and keeps track of the namespace declarations which are in scope at any time during streaming. The XMLReader.getURI(java.lang.String) method can be used to find the URI associated to a given prefix in the current scope.

XMLReaders can be created using a XMLReaderFactory .

Some utility methods, XMLReader.nextContent and XMLReader.nextElementContent make it possible to ignore whitespace and processing instructions with minimum impact on the client code.

Similarly, the XMLReader.skipElement and XMLReader.skipElement(int elementId) methods allow to skip to the end tag of an element ignoring all its content.

Finally, the XMLReader.recordElement method can be invoked when the XMLReader is positioned on the start tag of an element to record the element's contents so that they can be played back later.


See Also:   XMLReaderFactory
author:
   WS Development Team


Field Summary
final public static  intBOF
     The initial state of a XMLReader.
final public static  intCHARS
     The state denoting the character content of an element.
final public static  intEND
     The state denoting the end tag of an element.
final public static  intEOF
     The state denoting that the end of the document has been reached.
final public static  intPI
     The state denoting a processing instruction.
final public static  intSTART
     The state denoting the start tag of an element.


Method Summary
public  voidclose()
     Close the XMLReader.

All subsequent calls to XMLReader.next will return EOF.

public  AttributesgetAttributes()
     Return the current attribute list.
public  intgetElementId()
     Return the current element ID.
public  intgetLineNumber()
     Return the current line number.

Due to aggressive parsing, this value may be off by a few lines.

public  StringgetLocalName()
     Return the current local name.

Meaningful only when the state is one of: START, END, PI.

public  QNamegetName()
     Return the current qualified name.

Meaningful only when the state is one of: START, END.

public  IteratorgetPrefixes()
     Return an iterator on all prefixes in scope, except for the default prefix.
public  intgetState()
     Return the current state of the XMLReader.
public  StringgetURI()
     Return the current URI.

Meaningful only when the state is one of: START, END.

public  StringgetURI(String prefix)
     Return the URI for the given prefix.

If there is no namespace declaration in scope for the given prefix, return null.

public  StringgetValue()
     Return the current value.

Meaningful only when the state is one of: CHARS, PI.

public  intnext()
     Return the next state of the XMLReader.
public  intnextContent()
    
public  intnextElementContent()
     Return the next state of the XMLReader.

Whitespace character content, processing instructions are ignored. Non-whitespace character content triggers an exception.

public  XMLReaderrecordElement()
     Records the current element and leaves the reader positioned on its end tag.

The XMLReader must be positioned on the start tag of the element. The returned reader will play back all events starting with the start tag of the element and ending with its end tag.

public  voidskipElement()
     Skip all nodes up to the end tag of the element with the current element ID.
public  voidskipElement(int elementId)
     Skip all nodes up to the end tag of the element with the given element ID.

Field Detail
BOF
final public static int BOF(Code)
The initial state of a XMLReader.



CHARS
final public static int CHARS(Code)
The state denoting the character content of an element.



END
final public static int END(Code)
The state denoting the end tag of an element.



EOF
final public static int EOF(Code)
The state denoting that the end of the document has been reached.



PI
final public static int PI(Code)
The state denoting a processing instruction.



START
final public static int START(Code)
The state denoting the start tag of an element.





Method Detail
close
public void close()(Code)
Close the XMLReader.

All subsequent calls to XMLReader.next will return EOF.




getAttributes
public Attributes getAttributes()(Code)
Return the current attribute list. In the jaxws implementation, this list also includes namespace declarations.

Meaningful only when the state is one of: START.

The returned Attributes object belong to the XMLReader and is only guaranteed to be valid until the XMLReader.next method is called, directly or indirectly.




getElementId
public int getElementId()(Code)
Return the current element ID.



getLineNumber
public int getLineNumber()(Code)
Return the current line number.

Due to aggressive parsing, this value may be off by a few lines.




getLocalName
public String getLocalName()(Code)
Return the current local name.

Meaningful only when the state is one of: START, END, PI.




getName
public QName getName()(Code)
Return the current qualified name.

Meaningful only when the state is one of: START, END.




getPrefixes
public Iterator getPrefixes()(Code)
Return an iterator on all prefixes in scope, except for the default prefix.



getState
public int getState()(Code)
Return the current state of the XMLReader.



getURI
public String getURI()(Code)
Return the current URI.

Meaningful only when the state is one of: START, END.




getURI
public String getURI(String prefix)(Code)
Return the URI for the given prefix.

If there is no namespace declaration in scope for the given prefix, return null.




getValue
public String getValue()(Code)
Return the current value.

Meaningful only when the state is one of: CHARS, PI.




next
public int next()(Code)
Return the next state of the XMLReader. The return value is one of: START, END, CHARS, PI, EOF.



nextContent
public int nextContent()(Code)



nextElementContent
public int nextElementContent()(Code)
Return the next state of the XMLReader.

Whitespace character content, processing instructions are ignored. Non-whitespace character content triggers an exception.

The return value is one of: START, END, EOF.




recordElement
public XMLReader recordElement()(Code)
Records the current element and leaves the reader positioned on its end tag.

The XMLReader must be positioned on the start tag of the element. The returned reader will play back all events starting with the start tag of the element and ending with its end tag.




skipElement
public void skipElement()(Code)
Skip all nodes up to the end tag of the element with the current element ID.



skipElement
public void skipElement(int elementId)(Code)
Skip all nodes up to the end tag of the element with the given element ID.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.