Package org.apache.cxf.staxutils
Class StaxUtils
- java.lang.Object
- 
- org.apache.cxf.staxutils.StaxUtils
 
- 
 public final class StaxUtils extends Object 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classStaxUtils.StreamToDOMContext
 - 
Field SummaryFields Modifier and Type Field Description static StringALLOW_INSECURE_PARSERstatic StringMAX_ATTRIBUTE_COUNTstatic StringMAX_ATTRIBUTE_SIZEstatic StringMAX_CHILD_ELEMENTSstatic StringMAX_ELEMENT_COUNTstatic StringMAX_ELEMENT_DEPTHstatic StringMAX_TEXT_LENGTHstatic StringMAX_XML_CHARACTERSstatic StringMIN_TEXT_SEGMENT
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclose(XMLStreamReader reader)static voidclose(XMLStreamWriter writer)static XMLStreamReaderconfigureReader(XMLStreamReader reader, Integer maxChildElements, Integer maxElementDepth, Integer maxAttributeCount, Integer maxAttributeSize, Integer maxTextLength, Long maxElementCount, Long maxXMLCharacters)static XMLStreamReaderconfigureReader(XMLStreamReader xreader, Message message)static voidcopy(XMLStreamReader reader, OutputStream os)static voidcopy(XMLStreamReader reader, XMLStreamWriter writer)Copies the reader to the writer.static voidcopy(XMLStreamReader reader, XMLStreamWriter writer, boolean fragment)static voidcopy(XMLStreamReader reader, XMLStreamWriter writer, boolean fragment, boolean isThreshold)static voidcopy(Source source, OutputStream os)static voidcopy(Source source, XMLStreamWriter writer)static Documentcopy(Document doc)static voidcopy(Document doc, XMLStreamWriter writer)static voidcopy(Element node, XMLStreamWriter writer)static XMLStreamReadercreateFilteredReader(XMLStreamReader reader, StreamFilter filter)static XMLEventFactorycreateWoodstoxEventFactory()static XMLInputFactorycreateXMLInputFactory(boolean nsAware)Return a new factory so that the caller can set sticky parameters.static XMLStreamReadercreateXMLStreamReader(InputStream in)static XMLStreamReadercreateXMLStreamReader(InputStream in, String encoding)static XMLStreamReadercreateXMLStreamReader(Reader reader)static XMLStreamReadercreateXMLStreamReader(String systemId, InputStream in)static XMLStreamReadercreateXMLStreamReader(Source source)static XMLStreamReadercreateXMLStreamReader(Document doc)static XMLStreamReadercreateXMLStreamReader(Document doc, String sysId)static XMLStreamReadercreateXMLStreamReader(Element el)static XMLStreamReadercreateXMLStreamReader(Element el, String sysId)static XMLStreamReadercreateXMLStreamReader(InputSource src)static XMLStreamWritercreateXMLStreamWriter(OutputStream out)static XMLStreamWritercreateXMLStreamWriter(OutputStream out, String encoding)static XMLStreamWritercreateXMLStreamWriter(Writer out)static XMLStreamWritercreateXMLStreamWriter(Result r)static StringgetUniquePrefix(XMLStreamWriter writer)static StringgetUniquePrefix(XMLStreamWriter writer, String namespaceURI)static StringgetUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare)Create a unique namespace uri/prefix combination.static booleanisSecureReader(XMLStreamReader reader, Message message)static voidnextEvent(XMLStreamReader dr)static voidprint(Node node)static voidprintXmlFragment(XMLStreamReader reader)static Documentread(File is)static Documentread(InputStream s)static Documentread(Reader s)static Documentread(DocumentBuilder builder, XMLStreamReader reader, boolean repairing)static Documentread(XMLStreamReader reader)static Documentread(XMLStreamReader reader, boolean recordLoc)static Documentread(Source s)static Documentread(InputSource s)static NodereadDocElement(Document doc, Node parent, XMLEvent ev, StaxUtils.StreamToDOMContext context)static voidreadDocElements(Document doc, Node parent, XMLStreamReader reader, boolean repairing, boolean recordLoc)static voidreadDocElements(Document doc, Node parent, XMLStreamReader reader, boolean repairing, boolean recordLoc, boolean isThreshold)static voidreadDocElements(Document doc, Node parent, XMLStreamReader reader, StaxUtils.StreamToDOMContext context)static voidreadDocElements(Node parent, XMLStreamReader reader, boolean repairing)static voidreadDocElements(Node parent, XMLStreamReader reader, boolean repairing, boolean isThreshold)static QNamereadQName(XMLStreamReader reader)Reads a QName from the element text.static booleanskipToStartOfElement(XMLStreamReader in)Returns true if currently at the start of an element, otherwise move forwards to the next element start and return true, otherwise false is returned if the end of the stream is reached.static booleanskipToStartOfElement(DepthXMLStreamReader in)static booleantoNextElement(DepthXMLStreamReader dr)static booleantoNextTag(XMLStreamReader reader)static booleantoNextTag(DepthXMLStreamReader reader, QName endTag)static booleantoNextText(DepthXMLStreamReader reader)static StringtoString(Source src)static StringtoString(Document doc)static StringtoString(Element el)static StringtoString(Element el, int indent)static StringtoString(Node src)static voidwriteDocument(Document d, XMLStreamWriter writer, boolean repairing)static voidwriteDocument(Document d, XMLStreamWriter writer, boolean writeProlog, boolean repairing)static voidwriteElement(Element e, XMLStreamWriter writer, boolean repairing)Writes an Element to an XMLStreamWriter.static voidwriteElement(Element e, XMLStreamWriter writer, boolean repairing, boolean endElement)Writes an Element to an XMLStreamWriter.static voidwriteEvent(XMLEvent event, XMLStreamWriter writer)static voidwriteNode(Node n, XMLStreamWriter writer, boolean repairing)static voidwriteStartElement(XMLStreamWriter writer, String prefix, String name, String namespace)static voidwriteTo(Node node, OutputStream os)static voidwriteTo(Node node, OutputStream os, int indent)static voidwriteTo(Node node, Writer os)static voidwriteTo(Node node, Writer os, int indent)
 
- 
- 
- 
Field Detail- 
MAX_CHILD_ELEMENTSpublic static final String MAX_CHILD_ELEMENTS - See Also:
- Constant Field Values
 
 - 
MAX_ELEMENT_DEPTHpublic static final String MAX_ELEMENT_DEPTH - See Also:
- Constant Field Values
 
 - 
MAX_ATTRIBUTE_COUNTpublic static final String MAX_ATTRIBUTE_COUNT - See Also:
- Constant Field Values
 
 - 
MAX_ATTRIBUTE_SIZEpublic static final String MAX_ATTRIBUTE_SIZE - See Also:
- Constant Field Values
 
 - 
MAX_TEXT_LENGTHpublic static final String MAX_TEXT_LENGTH - See Also:
- Constant Field Values
 
 - 
MIN_TEXT_SEGMENTpublic static final String MIN_TEXT_SEGMENT - See Also:
- Constant Field Values
 
 - 
MAX_ELEMENT_COUNTpublic static final String MAX_ELEMENT_COUNT - See Also:
- Constant Field Values
 
 - 
MAX_XML_CHARACTERSpublic static final String MAX_XML_CHARACTERS - See Also:
- Constant Field Values
 
 - 
ALLOW_INSECURE_PARSERpublic static final String ALLOW_INSECURE_PARSER - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
createXMLInputFactorypublic static XMLInputFactory createXMLInputFactory(boolean nsAware) Return a new factory so that the caller can set sticky parameters.- Parameters:
- nsAware-
- Throws:
- XMLStreamException
 
 - 
createWoodstoxEventFactorypublic static XMLEventFactory createWoodstoxEventFactory() 
 - 
createXMLStreamWriterpublic static XMLStreamWriter createXMLStreamWriter(Writer out) 
 - 
createXMLStreamWriterpublic static XMLStreamWriter createXMLStreamWriter(OutputStream out) 
 - 
createXMLStreamWriterpublic static XMLStreamWriter createXMLStreamWriter(OutputStream out, String encoding) 
 - 
createXMLStreamWriterpublic static XMLStreamWriter createXMLStreamWriter(Result r) 
 - 
createFilteredReaderpublic static XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) 
 - 
nextEventpublic static void nextEvent(XMLStreamReader dr) 
 - 
toNextTextpublic static boolean toNextText(DepthXMLStreamReader reader) 
 - 
toNextTagpublic static boolean toNextTag(XMLStreamReader reader) 
 - 
toNextTagpublic static boolean toNextTag(DepthXMLStreamReader reader, QName endTag) 
 - 
writeStartElementpublic static void writeStartElement(XMLStreamWriter writer, String prefix, String name, String namespace) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
skipToStartOfElementpublic static boolean skipToStartOfElement(XMLStreamReader in) throws XMLStreamException Returns true if currently at the start of an element, otherwise move forwards to the next element start and return true, otherwise false is returned if the end of the stream is reached.- Throws:
- XMLStreamException
 
 - 
toNextElementpublic static boolean toNextElement(DepthXMLStreamReader dr) 
 - 
skipToStartOfElementpublic static boolean skipToStartOfElement(DepthXMLStreamReader in) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
copypublic static void copy(Source source, OutputStream os) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
copypublic static void copy(Source source, XMLStreamWriter writer) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
copypublic static Document copy(Document doc) throws XMLStreamException, ParserConfigurationException 
 - 
copypublic static void copy(Document doc, XMLStreamWriter writer) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
copypublic static void copy(Element node, XMLStreamWriter writer) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
copypublic static void copy(XMLStreamReader reader, OutputStream os) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
writeTopublic static void writeTo(Node node, OutputStream os) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
writeTopublic static void writeTo(Node node, OutputStream os, int indent) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
writeTopublic static void writeTo(Node node, Writer os) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
writeTopublic static void writeTo(Node node, Writer os, int indent) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
copypublic static void copy(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException Copies the reader to the writer. The start and end document methods must be handled on the writer manually.- Parameters:
- reader-
- writer-
- Throws:
- XMLStreamException
 
 - 
copypublic static void copy(XMLStreamReader reader, XMLStreamWriter writer, boolean fragment) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
copypublic static void copy(XMLStreamReader reader, XMLStreamWriter writer, boolean fragment, boolean isThreshold) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
writeDocumentpublic static void writeDocument(Document d, XMLStreamWriter writer, boolean repairing) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
writeDocumentpublic static void writeDocument(Document d, XMLStreamWriter writer, boolean writeProlog, boolean repairing) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
writeElementpublic static void writeElement(Element e, XMLStreamWriter writer, boolean repairing) throws XMLStreamException Writes an Element to an XMLStreamWriter. The writer must already have started the document (via writeStartDocument()). Also, this probably won't work with just a fragment of a document. The Element should be the root element of the document.- Parameters:
- e-
- writer-
- Throws:
- XMLStreamException
 
 - 
writeElementpublic static void writeElement(Element e, XMLStreamWriter writer, boolean repairing, boolean endElement) throws XMLStreamException Writes an Element to an XMLStreamWriter. The writer must already have started the document (via writeStartDocument()). Also, this probably won't work with just a fragment of a document. The Element should be the root element of the document.- Parameters:
- e-
- writer-
- endElement- true if the element should be ended
- Throws:
- XMLStreamException
 
 - 
writeNodepublic static void writeNode(Node n, XMLStreamWriter writer, boolean repairing) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readpublic static Document read(Source s) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readpublic static Document read(InputStream s) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readpublic static Document read(Reader s) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readpublic static Document read(File is) throws XMLStreamException, IOException - Throws:
- XMLStreamException
- IOException
 
 - 
readpublic static Document read(InputSource s) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readpublic static Document read(XMLStreamReader reader) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readpublic static Document read(XMLStreamReader reader, boolean recordLoc) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readpublic static Document read(DocumentBuilder builder, XMLStreamReader reader, boolean repairing) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readDocElementspublic static void readDocElements(Node parent, XMLStreamReader reader, boolean repairing) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readDocElementspublic static void readDocElements(Node parent, XMLStreamReader reader, boolean repairing, boolean isThreshold) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readDocElementspublic static void readDocElements(Document doc, Node parent, XMLStreamReader reader, boolean repairing, boolean recordLoc) throws XMLStreamException - Parameters:
- parent-
- reader-
- Throws:
- XMLStreamException
 
 - 
readDocElementspublic static void readDocElements(Document doc, Node parent, XMLStreamReader reader, boolean repairing, boolean recordLoc, boolean isThreshold) throws XMLStreamException - Parameters:
- parent-
- reader-
- Throws:
- XMLStreamException
 
 - 
readDocElementspublic static void readDocElements(Document doc, Node parent, XMLStreamReader reader, StaxUtils.StreamToDOMContext context) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
readDocElementpublic static Node readDocElement(Document doc, Node parent, XMLEvent ev, StaxUtils.StreamToDOMContext context) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
createXMLStreamReaderpublic static XMLStreamReader createXMLStreamReader(InputSource src) 
 - 
createXMLStreamReaderpublic static XMLStreamReader createXMLStreamReader(InputStream in, String encoding) - Parameters:
- in-
- encoding-
 
 - 
createXMLStreamReaderpublic static XMLStreamReader createXMLStreamReader(InputStream in) - Parameters:
- in-
 
 - 
createXMLStreamReaderpublic static XMLStreamReader createXMLStreamReader(String systemId, InputStream in) 
 - 
createXMLStreamReaderpublic static XMLStreamReader createXMLStreamReader(Element el) 
 - 
createXMLStreamReaderpublic static XMLStreamReader createXMLStreamReader(Document doc) 
 - 
createXMLStreamReaderpublic static XMLStreamReader createXMLStreamReader(Element el, String sysId) 
 - 
createXMLStreamReaderpublic static XMLStreamReader createXMLStreamReader(Document doc, String sysId) 
 - 
createXMLStreamReaderpublic static XMLStreamReader createXMLStreamReader(Source source) 
 - 
createXMLStreamReaderpublic static XMLStreamReader createXMLStreamReader(Reader reader) - Parameters:
- reader-
 
 - 
readQNamepublic static QName readQName(XMLStreamReader reader) throws XMLStreamException Reads a QName from the element text. Reader must be positioned at the start tag.- Throws:
- XMLStreamException
 
 - 
getUniquePrefixpublic static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException Create a unique namespace uri/prefix combination.- Returns:
- The namespace with the specified URI. If one doesn't exist, one is created.
- Throws:
- XMLStreamException
 
 - 
getUniquePrefixpublic static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
getUniquePrefixpublic static String getUniquePrefix(XMLStreamWriter writer) 
 - 
printXmlFragmentpublic static void printXmlFragment(XMLStreamReader reader) 
 - 
writeEventpublic static void writeEvent(XMLEvent event, XMLStreamWriter writer) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
printpublic static void print(Node node) 
 - 
closepublic static void close(XMLStreamReader reader) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
closepublic static void close(XMLStreamWriter writer) 
 - 
isSecureReaderpublic static boolean isSecureReader(XMLStreamReader reader, Message message) 
 - 
configureReaderpublic static XMLStreamReader configureReader(XMLStreamReader xreader, Message message) throws XMLStreamException - Throws:
- XMLStreamException
 
 - 
configureReaderpublic static XMLStreamReader configureReader(XMLStreamReader reader, Integer maxChildElements, Integer maxElementDepth, Integer maxAttributeCount, Integer maxAttributeSize, Integer maxTextLength, Long maxElementCount, Long maxXMLCharacters) throws XMLStreamException - Throws:
- XMLStreamException
 
 
- 
 
-