public class FormatXMLWriter extends Object implements XMLStreamWriter
| Constructor and Description |
|---|
FormatXMLWriter()
Конструктор по умолчанию
|
FormatXMLWriter(File file,
Charset encoding) |
FormatXMLWriter(File file,
Charset encoding) |
FormatXMLWriter(OutputStream stream)
Конструктор
|
FormatXMLWriter(OutputStream stream,
Charset enconding)
Конструктор
|
FormatXMLWriter(OutputStream stream,
String enconding)
Конструктор
|
FormatXMLWriter(Path file,
Charset encoding) |
FormatXMLWriter(Result result)
Конструктр
|
FormatXMLWriter(Writer writer)
Конструктор
|
FormatXMLWriter(XMLStreamWriter writer)
Конструктор
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
Integer |
getLevel() |
NamespaceContext |
getNamespaceContext() |
String |
getNewline() |
String |
getPrefix(String uri) |
Object |
getProperty(String name) |
String |
getSpacer() |
XMLStreamWriter |
getWriter() |
static String |
htmlDecode(String html)
Декодирует строку html (замееняет символы &,<,> на соответствующие)
|
static String |
htmlEncode(String text)
Кодирует строку в формат html (замееняет символы &,<,> на соответствующие)
|
boolean |
isEscapeWriteChars()
Экранирует символы проходящие через методы writeCharacters.
|
boolean |
isWriteOutline() |
boolean |
isWriteStartDocument() |
void |
setDefaultNamespace(String uri) |
void |
setEscapeWriteChars(boolean escapeWriteChars)
Устанавливае Экранирует символы проходящие через методы writeCharacters.
|
void |
setNamespaceContext(NamespaceContext context) |
void |
setNewline(String newline) |
void |
setPrefix(String prefix,
String uri) |
void |
setSpacer(String spacer) |
void |
setWriteOutline(boolean writeOutline) |
void |
setWriteStartDocument(boolean writeStartDocument) |
static String |
toStringWithException(Node xmlDocument)
Конвертирует XMLDOM древо в текстовое представление
|
static String |
toStringWithoutException(Node xmlDocument,
String defaultResult)
Конвертирует XMLDOM древо в текстовое представление с подовлением исключений
|
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) |
void |
writeCharacters(char[] text,
int start,
int len) |
void |
writeCharacters(String text) |
void |
writeComment(String data) |
void |
writeDefaultNamespace(String namespaceURI) |
void |
writeDTD(String 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 |
writeEscapeCharacters(char[] text,
int start,
int len) |
void |
writeEscapeCharacters(String text)
Кодирует и пишет текст
|
void |
writeNamespace(String prefix,
String namespaceURI) |
void |
writeProcessingInstruction(String target) |
void |
writeProcessingInstruction(String target,
String data) |
void |
writeStartDocument() |
void |
writeStartDocument(String version) |
void |
writeStartDocument(String encoding,
String version) |
void |
writeStartElement(String localName) |
void |
writeStartElement(String namespaceURI,
String localName) |
void |
writeStartElement(String prefix,
String localName,
String namespaceURI) |
public FormatXMLWriter()
public FormatXMLWriter(XMLStreamWriter writer)
writer - исходный XMLStreamWriterpublic FormatXMLWriter(Writer writer) throws XMLStreamException
writer - исходный WriterXMLStreamException - Ошибка IOpublic FormatXMLWriter(OutputStream stream, String enconding) throws XMLStreamException
stream - Поток куда будет писатьсяenconding - КодировкаXMLStreamException - Мало ли чтоpublic FormatXMLWriter(OutputStream stream, Charset enconding) throws XMLStreamException
stream - Поток куда будет писатьсяenconding - КодировкаXMLStreamException - Мало ли чтоpublic FormatXMLWriter(OutputStream stream) throws XMLStreamException
stream - Поток куда будет писатьсяXMLStreamException - Мало ли чтоpublic FormatXMLWriter(Result result) throws XMLStreamException
result - Поток куда будет писатьсяXMLStreamException - Мало ли чтоpublic boolean isWriteOutline()
public void setWriteOutline(boolean writeOutline)
public boolean isEscapeWriteChars()
public void setEscapeWriteChars(boolean escapeWriteChars)
escapeWriteChars - Экранирует (по умол. нет)public static String htmlEncode(String text)
text - Текстpublic static String htmlDecode(String html)
html - Текстpublic void writeEscapeCharacters(String text) throws XMLStreamException
text - ТекстXMLStreamException - IO Ошибкаpublic void writeEscapeCharacters(char[] text,
int start,
int len)
throws XMLStreamException
XMLStreamExceptionpublic void writeStartElement(String localName) throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartElement(String namespaceURI, String localName) throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument()
throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument(String version) throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument(String encoding, String version) throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeProcessingInstruction(String target) throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWriterXMLStreamExceptionpublic void writeProcessingInstruction(String target, String data) throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWriterXMLStreamExceptionpublic void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException
writeNamespace in interface XMLStreamWriterXMLStreamExceptionpublic void writeEntityRef(String name) throws XMLStreamException
writeEntityRef in interface XMLStreamWriterXMLStreamExceptionpublic void writeEndElement()
throws XMLStreamException
writeEndElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEndDocument()
throws XMLStreamException
writeEndDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String localName) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeDefaultNamespace(String namespaceURI) throws XMLStreamException
writeDefaultNamespace in interface XMLStreamWriterXMLStreamExceptionpublic void writeDTD(String dtd) throws XMLStreamException
writeDTD in interface XMLStreamWriterXMLStreamExceptionpublic void writeComment(String data) throws XMLStreamException
writeComment in interface XMLStreamWriterXMLStreamExceptionpublic void writeCharacters(String text) throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamExceptionpublic void writeCharacters(char[] text,
int start,
int len)
throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamExceptionpublic void writeCData(String data) throws XMLStreamException
writeCData in interface XMLStreamWriterXMLStreamExceptionpublic void writeAttribute(String localName, String value) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void setSpacer(String spacer)
public void setPrefix(String prefix, String uri) throws XMLStreamException
setPrefix in interface XMLStreamWriterXMLStreamExceptionpublic void setNewline(String newline)
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException
setNamespaceContext in interface XMLStreamWriterXMLStreamExceptionpublic void setDefaultNamespace(String uri) throws XMLStreamException
setDefaultNamespace in interface XMLStreamWriterXMLStreamExceptionpublic XMLStreamWriter getWriter()
public String getSpacer()
public Object getProperty(String name) throws IllegalArgumentException
getProperty in interface XMLStreamWriterIllegalArgumentExceptionpublic String getPrefix(String uri) throws XMLStreamException
getPrefix in interface XMLStreamWriterXMLStreamExceptionpublic String getNewline()
public NamespaceContext getNamespaceContext()
getNamespaceContext in interface XMLStreamWriterpublic Integer getLevel()
public void flush()
throws XMLStreamException
flush in interface XMLStreamWriterXMLStreamExceptionpublic void close()
throws XMLStreamException
close in interface XMLStreamWriterXMLStreamExceptionpublic boolean isWriteStartDocument()
public void setWriteStartDocument(boolean writeStartDocument)
public static String toStringWithException(Node xmlDocument) throws XMLStreamException, TransformerConfigurationException, TransformerException, IOException
xmlDocument - XMLDOM древоXMLStreamException - Если не смоглоTransformerConfigurationException - Если не смоглоTransformerException - Если не смоглоIOException - Если не смоглоpublic static String toStringWithoutException(Node xmlDocument, String defaultResult)
xmlDocument - XMLDOM древоdefaultResult - Результат возвращаем в случае, если не смогло сковертироватьCopyright © 2018. All rights reserved.