public interface XMLStreamWriter 
      javax.xml.stream.isRepairingNamespaces and write method behaviour   Method 
         isRepairingNamespaces == true isRepairingNamespaces == false    
         namespaceURI bound namespaceURI unbound namespaceURI bound namespaceURI unbound     writeAttribute(namespaceURI, localName, value) 
          
         prefix:localName="value" [1]   
         xmlns:{generated}="namespaceURI" {generated}:localName="value"  
          
         prefix:localName="value" [1]   
         XMLStreamException    writeAttribute(prefix, namespaceURI, localName, value) 
          
         bound to same prefix:XMLStreamException[2]   
         xmlns:prefix="namespaceURI" prefix:localName="value" [2][5]    writeStartElement(namespaceURI, localName)writeEmptyElement(namespaceURI, localName) 
          
         <prefix:localName> [1]   
         <{generated}:localName xmlns:{generated}="namespaceURI">  
          
         <prefix:localName> [1]   
         XMLStreamException    writeStartElement(prefix, localName, namespaceURI)writeEmptyElement(prefix, localName, namespaceURI) 
          
         bound to same prefix:XMLStreamException   
         <prefix:localName>        Notes: 
        XMLOutputFactory , XMLStreamReader 
       | Modifier and Type | Method and Description | 
|---|---|
| void | close()
              关闭此作者并释放与作者相关的任何资源。 
             | 
| void | flush()
              将任何缓存的数据写入基础输出机制。 
             | 
| NamespaceContext | getNamespaceContext()
              返回当前的命名空间上下文。 
             | 
| String | getPrefix(String uri)
              获取uri绑定的前缀 
             | 
| Object | getProperty(String name)
              从底层实现获取特征/属性的值 
             | 
| void | setDefaultNamespace(String uri)
              将URI绑定到默认命名空间此URI绑定在当前START_ELEMENT / END_ELEMENT对的范围内。 
             | 
| void | setNamespaceContext(NamespaceContext context)
              设置前缀和uri绑定的当前命名空间上下文。 
             | 
| void | setPrefix(String prefix, String uri)
              设置uri所绑定的前缀。 
             | 
| void | writeAttribute(String localName, String value)
              将不带前缀的属性写入输出流。 
             | 
| void | writeAttribute(String namespaceURI, String localName, String value)
              将一个属性写入输出流 
             | 
| void | writeAttribute(String prefix, String namespaceURI, String localName, String value)
              将一个属性写入输出流 
             | 
| void | writeCData(String data)
              写一个CData部分 
             | 
| void | writeCharacters(char[] text, int start, int len)
              将文本写入输出 
             | 
| void | writeCharacters(String text)
              将文本写入输出 
             | 
| void | writeComment(String data)
              用附带的数据写入一个xml注释 
             | 
| void | writeDefaultNamespace(String namespaceURI)
              将默认命名空间写入流 
             | 
| void | writeDTD(String dtd)
              写一个DTD部分。 
             | 
| void | writeEmptyElement(String localName)
              将一个空的元素标签写入输出 
             | 
| void | writeEmptyElement(String namespaceURI, String localName)
              将一个空的元素标签写入输出 
             | 
| void | writeEmptyElement(String prefix, String localName, String namespaceURI)
              将一个空的元素标签写入输出 
             | 
| void | writeEndDocument()
              关闭任何起始标记并写入相应的结束标签。 
             | 
| void | writeEndElement()
              根据写入程序的内部状态将结束标记写入输出,以确定事件的前缀和本地名称。 
             | 
| void | writeEntityRef(String name)
              写实体引用 
             | 
| void | writeNamespace(String prefix, String namespaceURI)
              将命名空间写入输出流如果此方法的前缀参数为空字符串“xmlns”,或为null,则此方法将委托为writeDefaultNamespace 
             | 
| void | writeProcessingInstruction(String target)
              写一个处理指令 
             | 
| void | writeProcessingInstruction(String target, String data)
              写一个处理指令 
             | 
| void | writeStartDocument()
              编写XML声明 
             | 
| void | writeStartDocument(String version)
              编写XML声明 
             | 
| void | writeStartDocument(String encoding, String version)
              编写XML声明 
             | 
| void | writeStartElement(String localName)
              将开始标签写入输出。 
             | 
| void | writeStartElement(String namespaceURI, String localName)
              将开始标签写入输出 
             | 
| void | writeStartElement(String prefix, String localName, String namespaceURI)
              将开始标签写入输出 
             | 
void writeStartElement(String localName) throws XMLStreamException
localName - 标记的本地名称,可能不为空 
           XMLStreamException 
           void writeStartElement(String namespaceURI, String localName) throws XMLStreamException
namespaceURI - 要使用的前缀的namespaceURI可能不为null 
           localName - 标记的本地名称,可能不为空 
           XMLStreamException - 如果命名空间URI未绑定到前缀和javax.xml.stream.isRepairingNamespaces尚未设置为true 
           void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
localName - 标记的本地名称,可能不为空 
           prefix - 标签的前缀可能不为空 
           namespaceURI - 绑定前缀的uri可能不为null 
           XMLStreamException 
           void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException
namespaceURI - 将标签绑定到的uri,可能不为null 
           localName - 标记的本地名称,可能不为空 
           XMLStreamException - 如果命名空间URI未绑定到前缀和javax.xml.stream.isRepairingNamespaces尚未设置为true 
           void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
prefix - 标签的前缀可能不为空 
           localName - 标记的本地名称,可能不为空 
           namespaceURI - 将标签绑定到的uri,可能不为null 
           XMLStreamException 
           void writeEmptyElement(String localName) throws XMLStreamException
localName - 标记的本地名称,可能不为空 
           XMLStreamException 
           void writeEndElement()
              throws XMLStreamException 
          void writeEndDocument()
               throws XMLStreamException 
          void close()
    throws XMLStreamException 
          void flush()
    throws XMLStreamException 
          void writeAttribute(String localName, String value) throws XMLStreamException
localName - 
            localName的本地名称 
           value - 属性的值 
           IllegalStateException - 如果当前状态不允许属性写入 
           XMLStreamException 
           void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException
prefix - 此属性的前缀 
           namespaceURI - 此属性的前缀的uri 
           localName - 
            localName的本地名称 
           value - 属性的值 
           IllegalStateException - 如果当前状态不允许属性写入 
           XMLStreamException - 如果命名空间URI未绑定到前缀和javax.xml.stream.isRepairingNamespaces尚未设置为true 
           void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException
namespaceURI - 此属性的前缀的uri 
           localName - 
            localName的本地名称 
           value - 属性的值 
           IllegalStateException - 如果当前状态不允许属性写入 
           XMLStreamException - 如果命名空间URI未绑定到前缀,并且javax.xml.stream.isRepairingNamespaces尚未设置为true 
           void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException
prefix - 将此命名空间绑定到的前缀 
           namespaceURI - 绑定前缀的uri 
           IllegalStateException - 如果当前状态不允许命名空间写入 
           XMLStreamException 
           void writeDefaultNamespace(String namespaceURI) throws XMLStreamException
namespaceURI - 将默认命名空间绑定到的uri 
           IllegalStateException - 如果当前状态不允许命名空间写入 
           XMLStreamException 
           void writeComment(String data) throws XMLStreamException
data - 注释中包含的数据可能为null 
           XMLStreamException 
           void writeProcessingInstruction(String target) throws XMLStreamException
target - 处理指令的目标可能不为空 
           XMLStreamException 
           void writeProcessingInstruction(String target, String data) throws XMLStreamException
target - 处理指令的目标可能不为空 
           data - 处理指令中包含的数据可能不为空 
           XMLStreamException 
           void writeCData(String data) throws XMLStreamException
data - CData部分中包含的数据可能不为空 
           XMLStreamException 
           void writeDTD(String dtd) throws XMLStreamException
dtd - 
            dtd的DTD 
           XMLStreamException 
           void writeEntityRef(String name) throws XMLStreamException
name - 实体的名称 
           XMLStreamException 
           void writeStartDocument()
                 throws XMLStreamException 
          void writeStartDocument(String version) throws XMLStreamException
version - xml文档的版本 
           XMLStreamException 
           void writeStartDocument(String encoding, String version) throws XMLStreamException
encoding - xml声明的编码 
           version - xml文档的版本 
           XMLStreamException - 如果给定的编码与底层流的编码不匹配 
           void writeCharacters(String text) throws XMLStreamException
text - 要写的值 
           XMLStreamException 
           void writeCharacters(char[] text,
                     int start,
                     int len)
              throws XMLStreamException 
          text - 要写的值 
           start - 数组中的起始位置 
           len - 要写入的字符数 
           XMLStreamException 
           String getPrefix(String uri) throws XMLStreamException
XMLStreamException 
           void setPrefix(String prefix, String uri) throws XMLStreamException
prefix - 绑定到uri的前缀可能不为null 
           uri - 绑定到前缀的uri可能为null 
           XMLStreamException 
           void setDefaultNamespace(String uri) throws XMLStreamException
uri - 绑定到默认命名空间的uri可能为null 
           XMLStreamException 
           void setNamespaceContext(NamespaceContext context) throws XMLStreamException
context - 用于此作者的命名空间上下文可能不为空 
           XMLStreamException 
           NamespaceContext getNamespaceContext()
Object getProperty(String name) throws IllegalArgumentException
name - 属性的名称,可能不为null 
           IllegalArgumentException - 如果不支持该属性 
           NullPointerException - if the name is null 
            Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.