public class ElementFormatter extends Object
Modifier and Type | Method and Description |
---|---|
static Element |
createMainElement(String name)
Creates an empty DOM element with the specified name.
|
static Element |
createMainElementNS(String namespaceURI,
String qualifiedName)
Creates an empty DOM element with the specified name.
|
static String |
format(Element element)
Returns the String representation of the element as XML.
|
static void |
format(Element element,
XMLOutputter xmlout)
Serializes the DOM Element in the XMLOutputter.
|
static Element |
parse(InputStream stream)
Creates a DOM element by parsing the XML included in the input stream.
|
static Element |
parse(Reader reader)
Creates a DOM element by parsing the XML included in the reader.
|
static Element |
parse(String xml)
Creates a DOM element by parsing the given XML.
|
static Element |
parseURI(String uri)
Creates a DOM element by parsing the given XML location.
|
public static String format(Element element)
element
- the element to serialize, cannot be null
.public static void format(Element element, XMLOutputter xmlout) throws IOException
element
- the DOM element to serialize, cannot be null
.xmlout
- the XMLOutputer to serialize the element, cannot be null
.IOException
- if the serialization failed.public static Element parse(String xml) throws SAXException
xml
- the XML text to parse, cannot be null
.null
.SAXException
- if for any reason the XML cannot be parsed correctly.public static Element parseURI(String uri) throws SAXException
uri
- the URI location of the XML resource to parse, cannot be null
.null
.SAXException
- if for any reason the XML cannot be parsed correctly.public static Element parse(Reader reader) throws SAXException
reader
- the reader to use to read the XML source, cannot be null
.null
.SAXException
- if for any reason the XML cannot be parsed correctly.public static Element parse(InputStream stream) throws SAXException
stream
- the input stream to use to read the XML source, cannot be null
.null
.SAXException
- if for any reason the XML cannot be parsed correctly.public static Element createMainElement(String name)
name
- the local name of the XML element, cannot be null
.null
.public static Element createMainElementNS(String namespaceURI, String qualifiedName)
namespaceURI
- the namespace URI of the XML element, can be null
.qualifiedName
- the qualified name of the XML element, cannot be null
.null
.See http://www.xins.org/.