Class StAXWriter

  • All Implemented Interfaces:
    XMLWriter

    public class StAXWriter
    extends XMLWriterBase
    An implementation of XMLWriter that uses StAX
    • Method Detail

      • getXMLStreamWriter

        public XMLStreamWriter getXMLStreamWriter()
        Returns the StAX XMLStreamWriter that is being used.
      • startElement

        public void startElement​(String localName,
                                 String uri)
        Description copied from interface: XMLWriter
        Write the start tag for an element.
      • startElement

        public void startElement​(String localName,
                                 String uri,
                                 String prefix)
        Description copied from interface: XMLWriter
        Write the start tag for an element.
      • writeAttribute

        public void writeAttribute​(String localName,
                                   String uri,
                                   String value)
        Description copied from interface: XMLWriter
        Write an attribute of the current element.
      • writeAttributeUnquoted

        public void writeAttributeUnquoted​(String localName,
                                           String uri,
                                           String value)
        Description copied from interface: XMLWriter
        Write an attribute (unquoted) of the current element.
      • writeCharsUnquoted

        public void writeCharsUnquoted​(String chars)
        If the first character of the string is an opening bracket, then this method assumes that the string is xml and it parses the string to write out the correct xml representation. This is because there is no api in stax to write unescaped characters.
      • writeCharsUnquoted

        public void writeCharsUnquoted​(char[] buf,
                                       int offset,
                                       int len)
        If the first character of the string is an opening bracket, then this method assumes that the string is xml and it parses the string to write out the correct xml representation. This is because there is no api in stax to write unescaped characters.
      • writeNamespaceDeclaration

        public void writeNamespaceDeclaration​(String prefix,
                                              String uri)
        Description copied from interface: XMLWriter
        Write a namespace declaration of the current element.
      • writeNamespaceDeclaration

        public void writeNamespaceDeclaration​(String uri)
        Description copied from interface: XMLWriter
        Write a namespace declaration of the current element. The prefix name will be generated by the PrefixFactory currently configured for this writer.
      • endElement

        public void endElement()
        Description copied from interface: XMLWriter
        Write the end tag for the current element.
      • close

        public void close()
        Description copied from interface: XMLWriter
        Close the writer and its underlying stream.
      • flush

        public void flush()
        Description copied from interface: XMLWriter
        Flush the writer and its underlying stream.
      • getPrefix

        public String getPrefix​(String uri)
        Description copied from interface: XMLWriter
        Return a prefix for the given URI.

        If no prefix for the given URI is in scope, return null.

      • getURI

        public String getURI​(String prefix)
        Description copied from interface: XMLWriter
        Return the URI for a given prefix. If the prefix is undeclared, return null.
      • getPrefixFactory

        public PrefixFactory getPrefixFactory()
        Description copied from interface: XMLWriter
        Return the prefix factory in use by this writer.
      • setPrefixFactory

        public void setPrefixFactory​(PrefixFactory factory)
        Description copied from interface: XMLWriter
        Set the prefix factory to be used by this writer.