public class MwsXmlReader extends Object implements MwsReader
| Constructor and Description |
|---|
MwsXmlReader(InputStream is)
Create a MwsXmlReader instance around a java.io.InputStream
This constructor wraps the input stream, to close it call the close
method on the returned instance.
|
MwsXmlReader(String xml)
Create a MwsXmlReader instance that reads a string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
<T> T |
read(String name,
Class<T> cls)
Read the next labeled value.
|
List<Element> |
readAny()
Read a list of all elements, ignoring type and name.
|
<T> T |
readAttribute(String name,
Class<T> cls)
Get an attribute by name.
|
<T> List<T> |
readList(String memberName,
Class<T> cls)
Read a list of sibling elements.
|
<T> List<T> |
readList(String name,
String memberName,
Class<T> cls)
Read a list of child elements.
|
<T> T |
readValue(Class<T> cls)
Read raw string value.
|
public MwsXmlReader(InputStream is)
is - The input stream to wrap.public MwsXmlReader(String xml)
public void close()
public <T> T read(String name, Class<T> cls)
MwsReaderReturns null if the reader is not positioned on a labeled value of the requested type.
For XML reads:
For JSON reads: <name>value</name>
name:value if in Object or
value if in list.
public <T> T readAttribute(String name, Class<T> cls)
MwsReaderCalled when positioned on begin Object.
Returns null if the named attribute is not present.
readAttribute in interface MwsReadername - The attribute name to get.public <T> List<T> readList(String memberName, Class<T> cls)
MwsReader
For XML reads: <memberName>value</memberName>...
For JSON reads: name:[value...] or [value...]
public <T> List<T> readList(String name, String memberName, Class<T> cls)
MwsReader
For XML reads: <name><memberName>value</memberName>...
For JSON reads: name:[value...] or [value...]
public List<Element> readAny()
MwsReaderCopyright © 2014. All Rights Reserved.