|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pivot.xml.XMLSerializer
public class XMLSerializer
Reads and writes XML data.
Field Summary | |
---|---|
static int |
BUFFER_SIZE
|
static String |
DEFAULT_CHARSET_NAME
|
static String |
MIME_TYPE
|
static String |
XMLNS_ATTRIBUTE_PREFIX
|
Constructor Summary | |
---|---|
XMLSerializer()
|
|
XMLSerializer(Charset charset)
|
|
XMLSerializer(String charsetName)
|
Method Summary | |
---|---|
Charset |
getCharset()
|
static Element |
getElement(Element root,
String path)
Returns the element matching a given path. |
static List<Element> |
getElements(Element root,
String path,
String name)
Returns the sub-elements of a descendant of root whose tag names
match the given name. |
String |
getMIMEType(Element object)
Returns the MIME type of the data read and written by this serializer. |
static String |
getText(Element root,
String path)
Returns the text content of a descendant of root . |
Element |
readObject(InputStream inputStream)
Reads an object from an input stream. |
Element |
readObject(Reader reader)
|
void |
writeObject(Element element,
OutputStream outputStream)
Writes an object to an output stream. |
void |
writeObject(Element element,
Writer writer)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String XMLNS_ATTRIBUTE_PREFIX
public static final String DEFAULT_CHARSET_NAME
public static final String MIME_TYPE
public static final int BUFFER_SIZE
Constructor Detail |
---|
public XMLSerializer()
public XMLSerializer(String charsetName)
public XMLSerializer(Charset charset)
Method Detail |
---|
public Charset getCharset()
public Element readObject(InputStream inputStream) throws IOException, SerializationException
Serializer
readObject
in interface Serializer<Element>
inputStream
- The data stream from which the object will be read.
IOException
SerializationException
public Element readObject(Reader reader) throws SerializationException
SerializationException
public void writeObject(Element element, OutputStream outputStream) throws IOException, SerializationException
Serializer
writeObject
in interface Serializer<Element>
element
- The object to serialize.outputStream
- The data stream to which the object will be written.
IOException
SerializationException
public void writeObject(Element element, Writer writer) throws SerializationException
SerializationException
public String getMIMEType(Element object)
Serializer
getMIMEType
in interface Serializer<Element>
object
- If provided, allows the serializer to attach parameters to the returned
MIME type containing more detailed information about the data. If
null, the base MIME type is returned.public static Element getElement(Element root, String path)
root
- The element from which to begin the search.path
- A path of the form:
tag[n]/tag[n]/...The bracketed index values are optional and refer to the nth occurrence of the given tag name within its parent element. If omitted, the path refers to the first occurrence of the named element (i.e. the element at index 0).
null
if no such element exists.public static List<Element> getElements(Element root, String path, String name)
root
whose tag names
match the given name.
root
- The element from which to begin the search.path
- The path to the descendant, relative to root
.name
- The tag name to match.
null
if no such descendant exists.getElement(Element, String)
,
Element.getElements(String)
public static String getText(Element root, String path)
root
.
root
- The element from which to begin the search.path
- The path to the descendant, relative to root
.
null
if no such descendant
exists.getElement(Element, String)
,
Element.getText()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |