public class XMLUtils extends Object
Modifier and Type | Field and Description |
---|---|
static org.apache.axiom.om.util.StAXParserConfiguration |
STAX_PARSER_CONFIGURATION |
Constructor and Description |
---|
XMLUtils() |
Modifier and Type | Method and Description |
---|---|
static BXML<?> |
concatenate(BXML<?> firstSeq,
BXML<?> secondSeq)
Concatenate two XML sequences and produce a single sequence.
|
static BValue |
convertToJSON(BXML xml,
String attributePrefix,
boolean preserveNamespaces)
Converts given xml object to the corresponding json.
|
static BXML<?> |
createXMLComment(String content)
Create a comment type BXML.
|
static BXML<?> |
createXMLElement(BXMLQName startTagName,
BXMLQName endTagName,
String defaultNsUri)
Create an element type BXML.
|
static BXML<?> |
createXMLProcessingInstruction(String tartget,
String data)
Create a processing instruction type BXML.
|
static BXML<?> |
createXMLText(String content)
Create a comment type BXML.
|
static BXML<?> |
parse(InputStream xmlStream)
Create a XML sequence from string inputstream.
|
static BXML<?> |
parse(InputStream xmlStream,
String charset)
Create a XML sequence from string inputstream with a given charset.
|
static BXML<?> |
parse(Reader reader)
Create a XML sequence from string reader.
|
static BXML<?> |
parse(String xmlStr)
Create a XML item from string literal.
|
static org.apache.axiom.om.OMElement |
stringToOM(String xmlFragment)
Create an OMElement from an XML fragment given as a string.
|
static BXML |
tableToXML(BTable table,
boolean isInTransaction)
|
public static final org.apache.axiom.om.util.StAXParserConfiguration STAX_PARSER_CONFIGURATION
public static BXML<?> parse(String xmlStr)
xmlStr
- String representation of the XMLpublic static BXML<?> parse(InputStream xmlStream)
xmlStream
- XML input streampublic static BXML<?> parse(InputStream xmlStream, String charset)
xmlStream
- XML imput streamcharset
- Charset to be used for parsingpublic static BXML<?> parse(Reader reader)
reader
- XML readerpublic static BXML<?> concatenate(BXML<?> firstSeq, BXML<?> secondSeq)
firstSeq
- First XML sequencesecondSeq
- Second XML sequencepublic static BXML<?> createXMLElement(BXMLQName startTagName, BXMLQName endTagName, String defaultNsUri)
startTagName
- Name of the start tag of the elementendTagName
- Name of the end tag of elementdefaultNsUri
- Default namespace URIpublic static BXML<?> createXMLComment(String content)
content
- Comment contentpublic static BXML<?> createXMLText(String content)
content
- Text contentpublic static BXML<?> createXMLProcessingInstruction(String tartget, String data)
tartget
- PI targetdata
- PI datapublic static BValue convertToJSON(BXML xml, String attributePrefix, boolean preserveNamespaces)
xml
- XML object to get the corresponding jsonattributePrefix
- Prefix to use in attributespreserveNamespaces
- preserve the namespaces when convertingpublic static org.apache.axiom.om.OMElement stringToOM(String xmlFragment) throws XMLStreamException
xmlFragment
- the well-formed XML fragmentXMLStreamException
- when unexpected processing error occur while parsing.Copyright © 2018 WSO2. All rights reserved.