xmleventwriter.html
来自「j2ee帮助文档软件设计/软件工程 文件格式」· HTML 代码 · 共 592 行 · 第 1/2 页
HTML
592 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc (build 1.5.0_14) on Mon Jan 28 05:47:00 PST 2008 --><TITLE>XMLEventWriter (Java EE 5)</TITLE><META NAME="keywords" CONTENT="javax.xml.stream.XMLEventWriter interface"><LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"><SCRIPT type="text/javascript">function windowTitle(){ parent.document.title="XMLEventWriter (Java EE 5)";}</SCRIPT><NOSCRIPT></NOSCRIPT></HEAD><BODY BGCOLOR="white" onload="windowTitle();"><!-- ========= START OF TOP NAVBAR ======= --><A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/xml/stream/XMLEventReader.html" title="interface in javax.xml.stream"><B>PREV CLASS</B></A> <A HREF="../../../javax/xml/stream/XMLInputFactory.html" title="class in javax.xml.stream"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?javax/xml/stream/XMLEventWriter.html" target="_top"><B>FRAMES</B></A> <A HREF="XMLEventWriter.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--></SCRIPT><NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A></NOSCRIPT></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.xml.stream</FONT><BR>Interface XMLEventWriter</H2><DL><DT><B>All Superinterfaces:</B> <DD><A HREF="../../../javax/xml/stream/util/XMLEventConsumer.html" title="interface in javax.xml.stream.util">XMLEventConsumer</A></DD></DL><HR><DL><DT><PRE>public interface <B>XMLEventWriter</B><DT>extends <A HREF="../../../javax/xml/stream/util/XMLEventConsumer.html" title="interface in javax.xml.stream.util">XMLEventConsumer</A></DL></PRE><P>This is the top level interface for writing XML documents. Instances of this interface are not required to validate the form of the XML.<P><P><DL><DT><B>Version:</B></DT> <DD>1.0</DD><DT><B>Author:</B></DT> <DD>Copyright (c) 2003 by BEA Systems. All Rights Reserved.</DD><DT><B>See Also:</B><DD><A HREF="../../../javax/xml/stream/XMLEventReader.html" title="interface in javax.xml.stream"><CODE>XMLEventReader</CODE></A>, <A HREF="../../../javax/xml/stream/events/XMLEvent.html" title="interface in javax.xml.stream.events"><CODE>XMLEvent</CODE></A>, <A HREF="../../../javax/xml/stream/events/Characters.html" title="interface in javax.xml.stream.events"><CODE>Characters</CODE></A>, <A HREF="../../../javax/xml/stream/events/ProcessingInstruction.html" title="interface in javax.xml.stream.events"><CODE>ProcessingInstruction</CODE></A>, <A HREF="../../../javax/xml/stream/events/StartElement.html" title="interface in javax.xml.stream.events"><CODE>StartElement</CODE></A>, <A HREF="../../../javax/xml/stream/events/EndElement.html" title="interface in javax.xml.stream.events"><CODE>EndElement</CODE></A></DL><HR><P><!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"><B>Method Summary</B></FONT></TH></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/stream/XMLEventWriter.html#add(javax.xml.stream.events.XMLEvent)">add</A></B>(<A HREF="../../../javax/xml/stream/events/XMLEvent.html" title="interface in javax.xml.stream.events">XMLEvent</A> event)</CODE><BR> 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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/stream/XMLEventWriter.html#add(javax.xml.stream.XMLEventReader)">add</A></B>(<A HREF="../../../javax/xml/stream/XMLEventReader.html" title="interface in javax.xml.stream">XMLEventReader</A> reader)</CODE><BR> 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.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/stream/XMLEventWriter.html#close()">close</A></B>()</CODE><BR> Frees any resources associated with this stream</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/stream/XMLEventWriter.html#flush()">flush</A></B>()</CODE><BR> Writes any cached events to the underlying output mechanism</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.5/docs/api/javax/xml/namespace/NamespaceContext.html" title="class or interface in javax.xml.namespace">NamespaceContext</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/stream/XMLEventWriter.html#getNamespaceContext()">getNamespaceContext</A></B>()</CODE><BR> Returns the current namespace context.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/stream/XMLEventWriter.html#getPrefix(java.lang.String)">getPrefix</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> uri)</CODE><BR> Gets the prefix the uri is bound to</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/stream/XMLEventWriter.html#setDefaultNamespace(java.lang.String)">setDefaultNamespace</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> uri)</CODE><BR> Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/stream/XMLEventWriter.html#setNamespaceContext(javax.xml.namespace.NamespaceContext)">setNamespaceContext</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/javax/xml/namespace/NamespaceContext.html" title="class or interface in javax.xml.namespace">NamespaceContext</A> context)</CODE><BR> Sets the current namespace context for prefix and uri bindings.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> void</CODE></FONT></TD><TD><CODE><B><A HREF="../../../javax/xml/stream/XMLEventWriter.html#setPrefix(java.lang.String, java.lang.String)">setPrefix</A></B>(<A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> prefix, <A HREF="http://java.sun.com/j2se/1.5/docs/api/java/lang/String.html" title="class or interface in java.lang">String</A> uri)</CODE><BR> Sets the prefix the uri is bound to.</TD></TR></TABLE> <P><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="flush()"><!-- --></A><H3>flush</H3><PRE>void <B>flush</B>() throws <A HREF="../../../javax/xml/stream/XMLStreamException.html" title="class in javax.xml.stream">XMLStreamException</A></PRE><DL><DD>Writes any cached events to the underlying output mechanism<P><DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/xml/stream/XMLStreamException.html" title="class in javax.xml.stream">XMLStreamException</A></CODE></DL></DD></DL><HR><A NAME="close()"><!-- --></A><H3>close</H3><PRE>void <B>close</B>() throws <A HREF="../../../javax/xml/stream/XMLStreamException.html" title="class in javax.xml.stream">XMLStreamException</A></PRE><DL><DD>Frees any resources associated with this stream<P><DD><DL></DL></DD><DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../../javax/xml/stream/XMLStreamException.html" title="class in javax.xml.stream">XMLStreamException</A></CODE></DL></DD></DL><HR><A NAME="add(javax.xml.stream.events.XMLEvent)"><!-- --></A><H3>add</H3><PRE>void <B>add</B>(<A HREF="../../../javax/xml/stream/events/XMLEvent.html" title="interface in javax.xml.stream.events">XMLEvent</A> event) throws <A HREF="../../../javax/xml/stream/XMLStreamException.html" title="class in javax.xml.stream">XMLStreamException</A></PRE><DL><DD>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. <table border="2" rules="all" cellpadding="4"> <thead> <tr> <th align="center" colspan="2"> Required and optional fields for events added to the writer </th> </tr> </thead> <tbody> <tr> <th>Event Type</th> <th>Required Fields</th> <th>Optional Fields</th> <th>Required Behavior</th> </tr> <tr> <td> START_ELEMENT </td> <td> QName name </td> <td> namespaces , attributes </td> <td> 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
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?