Interface XMLParser
-
public interface XMLParserA facility to deserialize data in in XML format. Allows deserialization of entities and reading of any other data.- Author:
- Mikolaj Izdebski
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanhasStartElement()Determines whether at the current parser position there is an XML element opening tag.booleanhasStartElement(java.lang.String tag)Determines whether at the current parser position there is an XML element opening tag with specified tag name.voidparseEndElement(java.lang.String tag)Reads XML element closing tag with specified tag name.<Type,Bean>
voidparseEntity(Entity<Type,Bean> entity, Bean bean)Deserializes givenEntityfrom XML form.java.lang.StringparseStartElement()Reads XML element opening tag.voidparseStartElement(java.lang.String tag)Reads XML element opening tag with specified tag name.java.lang.StringparseText()Reads XML text content.
-
-
-
Method Detail
-
parseText
java.lang.String parseText() throws XMLExceptionReads XML text content.If there is no XML text content at given parser position, then empty String is returned.
Comments within the text are skipped.
- Returns:
- text content that was read
- Throws:
XMLException- in case exception occurs during XML deserialization
-
hasStartElement
boolean hasStartElement() throws XMLExceptionDetermines whether at the current parser position there is an XML element opening tag.Comments and whitespace text preceding the XML tag are skipped.
- Returns:
- true iff at the current parser position there is an XML element
- Throws:
XMLException- in case exception occurs during XML deserialization
-
hasStartElement
boolean hasStartElement(java.lang.String tag) throws XMLExceptionDetermines whether at the current parser position there is an XML element opening tag with specified tag name.Comments and whitespace text preceding the XML tag are skipped.
- Parameters:
tag- XML element tag name- Returns:
- true iff at the current parser position there is an XML element with specified tag name
- Throws:
XMLException- in case exception occurs during XML deserialization
-
parseStartElement
java.lang.String parseStartElement() throws XMLExceptionReads XML element opening tag.Comments and whitespace text preceding the XML tag are skipped.
XMLExceptionis thrown if at the current position there is no XML element (but, for example, text data or element closing tag).- Returns:
- XML element tag name
- Throws:
XMLException- in case exception occurs during XML deserialization
-
parseStartElement
void parseStartElement(java.lang.String tag) throws XMLExceptionReads XML element opening tag with specified tag name.Comments and whitespace text preceding the XML tag are skipped.
XMLExceptionis thrown if at the current position there is no XML element opening tag with specified tag (but, for example, text data, element closing tag or element opening tag with a different tag name).- Parameters:
tag- XML element tag name- Throws:
XMLException- in case exception occurs during XML deserialization
-
parseEndElement
void parseEndElement(java.lang.String tag) throws XMLExceptionReads XML element closing tag with specified tag name.Comments and whitespace text preceding the XML tag are skipped.
XMLExceptionis thrown if at the current position there is no XML element closing tag with specified tag (but, for example, text data, element opening tag or XML element closing tag with a different tag name).- Parameters:
tag- XML element tag name- Throws:
XMLException- in case exception occurs during XML deserialization
-
parseEntity
<Type,Bean> void parseEntity(Entity<Type,Bean> entity, Bean bean) throws XMLException
Deserializes givenEntityfrom XML form.- Type Parameters:
Type- data type of entityBean- type of bean associated with the entity- Parameters:
entity- the entity type to deserializebean- the entity bean to deserialize data into- Throws:
XMLException- in case exception occurs during XML deserialization
-
-