T - The typepublic interface XmlReader<T> extends Reader<T>, HasModelReadHandler<T,name.pehl.totoe.xml.client.Element>
The setup of the XmlReader is inspired by the UiBinder and is typically specified as an inner class:
pubilc SmartYakizakanaState
{
interface Reader extends XmlReader<SmartYakizakanaState> {}
public static final Reader XML = GWT.create(Reader.class);
// The properties of this POJO annotated with XmlField.
}
An XML document can then be converted to an instance of SmartYakizakanaState
by calling
Document document = ...; SmartYakizakanaState sys = SmartYakizakanaState.XML.read(document);
| Modifier and Type | Method and Description |
|---|---|
T |
read(name.pehl.totoe.xml.client.Document document)
Convert the data in the specified document to an instance of T according
to the annotated properties in T.
|
T |
read(name.pehl.totoe.xml.client.Element element)
Convert the data in the specified element to an instance of T according
to the annotated properties in T.
|
T |
read(String xml)
Convert the data in the specified document to an instance of T according
to the annotated properties in T.
|
List<T> |
readList(name.pehl.totoe.xml.client.Document document)
Convert the direct children of the documents root element to a list of Ts
according to the annotated properties in T.
|
List<T> |
readList(name.pehl.totoe.xml.client.Document document,
String xpath)
Convert the data in the specified document to a list of Ts according to
the annotated properties in T.
|
List<T> |
readList(name.pehl.totoe.xml.client.Element element)
Convert the direct children of the specified element to a list of Ts
according to the annotated properties in T.
|
List<T> |
readList(name.pehl.totoe.xml.client.Element element,
String xpath)
Convert the data in the specified element to a list of Ts according to
the annotated properties in T.
|
List<T> |
readList(String xml)
Convert the direct children of the root element from the specified XML to
a list of Ts according to the annotated properties in T.
|
addModelReadHandlerList<T> readList(String xml) throws name.pehl.totoe.xml.client.XmlParseException
Please note: Use this method only if your XML does not contain
namespaces. Othherwise you have to parse the xml yourself and call
readList(Document):
String xmlWithNamespaces = "..."; Document document = new XmlParser().parse(xmlWithNamespaces, "..."); List<T> models = reader.readList(document);
xml - The XML used as input. May be null.null if the xml is null or empty.name.pehl.totoe.xml.client.XmlParseException - if there's an error parsing the xmlList<T> readList(name.pehl.totoe.xml.client.Document document)
document - The XML document used as input. May be null.null if the document is null or the
document has no root element.List<T> readList(name.pehl.totoe.xml.client.Document document, String xpath)
document - The XML document used as input. May be null.xpath - An xpath expression which should result in a list of elements
which in turn is used to generate the instances of Tnull if the document is null.List<T> readList(name.pehl.totoe.xml.client.Element element)
document - The XML element used as input. May be null.element is null.List<T> readList(name.pehl.totoe.xml.client.Element element, String xpath)
document - The XML element used as input. May be null.xpath - An xpath expression which should result in a list of elements
which in turn are used to generate the instances of Telement is null.T read(String xml) throws name.pehl.totoe.xml.client.XmlParseException
Please note: Use this method only if your XML does not contain
namespaces. Othherwise you have to parse the xml yourself and call
read(Document):
String xmlWithNamespaces = "..."; Document document = new XmlParser().parse(xmlWithNamespaces, "..."); T model = reader.read(document);
xml - The XML used as input. May be null.null if the
xml is null or empty.name.pehl.totoe.xml.client.XmlParseException - if there's an error parsing the xmlT read(name.pehl.totoe.xml.client.Document document)
document - The XML document used as input. May be null.null if the
document is null or the document has no root
element.T read(name.pehl.totoe.xml.client.Element element)
element - The XML element used as input. May be null.null if the
element is null.Copyright © 2013 Harald Pehl. All Rights Reserved.