Java Doc for XMLEventWriter.java in  » 6.0-JDK-Modules » jsr173-Stax » javax » xml » stream » 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 » jsr173 Stax » javax.xml.stream 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.xml.stream.XMLEventWriter

XMLEventWriter
public interface XMLEventWriter extends XMLEventConsumer(Code)
This is the top level interface for writing XML documents. Instances of this interface are not required to validate the form of the XML.
version:
   1.0
author:
   Copyright (c) 2003 by BEA Systems. All Rights Reserved.
See Also:   XMLEventReader
See Also:   javax.xml.stream.events.XMLEvent
See Also:   javax.xml.stream.events.Characters
See Also:   javax.xml.stream.events.ProcessingInstruction
See Also:   javax.xml.stream.events.StartElement
See Also:   javax.xml.stream.events.EndElement




Method Summary
public  voidadd(XMLEvent event)
     Add an event to the output stream Adding a START_ELEMENT will open a new namespace scope that will be closed when the corresponding END_ELEMENT is written.
Required and optional fields for events added to the writer
Event Type Required Fields Optional Fields Required Behavior
START_ELEMENT QName name namespaces , attributes A START_ELEMENT will be written by writing the name, namespaces, and attributes of the event in XML 1.0 valid syntax for START_ELEMENTs.
public  voidadd(XMLEventReader reader)
     Adds an entire stream to an output stream, calls next() on the inputStream argument until hasNext() returns false This should be treated as a convenience method that will perform the following loop over all the events in an event reader and call add on each event.
public  voidclose()
    
public  voidflush()
    
public  NamespaceContextgetNamespaceContext()
     Returns the current namespace context.
public  StringgetPrefix(String uri)
    
public  voidsetDefaultNamespace(String uri)
     Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair.
public  voidsetNamespaceContext(NamespaceContext context)
     Sets the current namespace context for prefix and uri bindings. This context becomes the root namespace context for writing and will replace the current root namespace context.
public  voidsetPrefix(String prefix, String uri)
     Sets the prefix the uri is bound to.



Method Detail
add
public void add(XMLEvent event) throws XMLStreamException(Code)
Add an event to the output stream Adding a START_ELEMENT will open a new namespace scope that will be closed when the corresponding END_ELEMENT is written.
Required and optional fields for events added to the writer
Event Type Required Fields Optional Fields Required Behavior
START_ELEMENT QName name namespaces , attributes A START_ELEMENT will be written by writing the name, namespaces, and attributes of the event in XML 1.0 valid syntax for START_ELEMENTs. The name is written by looking up the prefix for the namespace uri. The writer can be configured to respect prefixes of QNames. If the writer is respecting prefixes it must use the prefix set on the QName. The default behavior is to lookup the value for the prefix on the EventWriter's internal namespace context. Each attribute (if any) is written using the behavior specified in the attribute section of this table. Each namespace (if any) is written using the behavior specified in the namespace section of this table.
END_ELEMENT Qname name None A well formed END_ELEMENT tag is written. The name is written by looking up the prefix for the namespace uri. The writer can be configured to respect prefixes of QNames. If the writer is respecting prefixes it must use the prefix set on the QName. The default behavior is to lookup the value for the prefix on the EventWriter's internal namespace context. If the END_ELEMENT name does not match the START_ELEMENT name an XMLStreamException is thrown.
ATTRIBUTE QName name , String value QName type An attribute is written using the same algorithm to find the lexical form as used in START_ELEMENT. The default is to use double quotes to wrap attribute values and to escape any double quotes found in the value. The type value is ignored.
NAMESPACE String prefix, String namespaceURI, boolean isDefaultNamespaceDeclaration None A namespace declaration is written. If the namespace is a default namespace declaration (isDefault is true) then xmlns="$namespaceURI" is written and the prefix is optional. If isDefault is false, the prefix must be declared and the writer must prepend xmlns to the prefix and write out a standard prefix declaration.
PROCESSING_INSTRUCTION None String target, String data The data does not need to be present and may be null. Target is required and many not be null. The writer will write data section directly after the target, enclosed in appropriate XML 1.0 syntax
COMMENT None String comment If the comment is present (not null) it is written, otherwise an an empty comment is written
START_DOCUMENT None String encoding , boolean standalone, String version A START_DOCUMENT event is not required to be written to the stream. If present the attributes are written inside the appropriate XML declaration syntax
END_DOCUMENT None None Nothing is written to the output
DTD String DocumentTypeDefinition None The DocumentTypeDefinition is written to the output

Parameters:
  event - the event to be added
throws:
  XMLStreamException -



add
public void add(XMLEventReader reader) throws XMLStreamException(Code)
Adds an entire stream to an output stream, calls next() on the inputStream argument until hasNext() returns false This should be treated as a convenience method that will perform the following loop over all the events in an event reader and call add on each event.
Parameters:
  reader - the event stream to add to the output
throws:
  XMLStreamException -



close
public void close() throws XMLStreamException(Code)
Frees any resources associated with this stream
throws:
  XMLStreamException -



flush
public void flush() throws XMLStreamException(Code)
Writes any cached events to the underlying output mechanism
throws:
  XMLStreamException -



getNamespaceContext
public NamespaceContext getNamespaceContext()(Code)
Returns the current namespace context. the current namespace context



getPrefix
public String getPrefix(String uri) throws XMLStreamException(Code)
Gets the prefix the uri is bound to
Parameters:
  uri - the uri to look up
throws:
  XMLStreamException -



setDefaultNamespace
public void setDefaultNamespace(String uri) throws XMLStreamException(Code)
Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the uri is bound in the root scope.
Parameters:
  uri - the uri to bind to the default namespace
throws:
  XMLStreamException -



setNamespaceContext
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException(Code)
Sets the current namespace context for prefix and uri bindings. This context becomes the root namespace context for writing and will replace the current root namespace context. Subsequent calls to setPrefix and setDefaultNamespace will bind namespaces using the context passed to the method as the root context for resolving namespaces.
Parameters:
  context - the namespace context to use for this writer
throws:
  XMLStreamException -



setPrefix
public void setPrefix(String prefix, String uri) throws XMLStreamException(Code)
Sets the prefix the uri is bound to. This prefix is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the prefix is bound in the root scope.
Parameters:
  prefix - the prefix to bind to the uri
Parameters:
  uri - the uri to bind to the prefix
throws:
  XMLStreamException -



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