Interface XMLParser
-
public interface XMLParser
A 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 boolean
hasStartElement()
Determines whether at the current parser position there is an XML element opening tag.boolean
hasStartElement(java.lang.String tag)
Determines whether at the current parser position there is an XML element opening tag with specified tag name.void
parseEndElement(java.lang.String tag)
Reads XML element closing tag with specified tag name.<Type,Bean>
voidparseEntity(Entity<Type,Bean> entity, Bean bean)
Deserializes givenEntity
from XML form.java.lang.String
parseStartElement()
Reads XML element opening tag.void
parseStartElement(java.lang.String tag)
Reads XML element opening tag with specified tag name.java.lang.String
parseText()
Reads XML text content.
-
-
-
Method Detail
-
parseText
java.lang.String parseText() throws XMLException
Reads 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 XMLException
Determines 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 XMLException
Determines 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 XMLException
Reads XML element opening tag.Comments and whitespace text preceding the XML tag are skipped.
XMLException
is 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 XMLException
Reads XML element opening tag with specified tag name.Comments and whitespace text preceding the XML tag are skipped.
XMLException
is 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 XMLException
Reads XML element closing tag with specified tag name.Comments and whitespace text preceding the XML tag are skipped.
XMLException
is 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 givenEntity
from 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
-
-