Package org.xmlpull.v1.builder.impl
Class XmlInfosetBuilderImpl
- java.lang.Object
-
- org.xmlpull.v1.builder.XmlInfosetBuilder
-
- org.xmlpull.v1.builder.impl.XmlInfosetBuilderImpl
-
public class XmlInfosetBuilderImpl extends XmlInfosetBuilder
Implementation of generic buuilder that uses XmlPull API to access current default XmlPullParser and XmlSerializer.- Author:
- Aleksander Slominski
-
-
Field Summary
-
Fields inherited from class org.xmlpull.v1.builder.XmlInfosetBuilder
factory
-
-
Constructor Summary
Constructors Constructor Description XmlInfosetBuilderImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XmlDocumentnewDocument(String version, Boolean standalone, String characterEncoding)Create a new document with given XML prolog.XmlElementnewFragment(String elementName)Create XML fragment that is not associated with any document.XmlElementnewFragment(String elementNamespaceName, String elementName)Create XML fragment that is not associated with any document.XmlElementnewFragment(XmlNamespace elementNamespace, String elementName)Create XML fragment that is not associated with any document.XmlNamespacenewNamespace(String namespaceName)Create a new namespace that is not associated with any XML document.XmlNamespacenewNamespace(String prefix, String namespaceName)Create a new namespace that is not associated with any XML document.XmlDocumentparse(XmlPullParser pp)Parse document - parser must be in START_DOCUMENT state.XmlElementparseFragment(XmlPullParser pp)Parse fragment - parser must be on START_TAG.ObjectparseItem(XmlPullParser pp)Will convert current parser state into event rerpresenting XML infoset item: START_Document: XmlDocument without root element START_TAG: XmlElement without children TEXT: String or XmlCHaracters depending on builder mode additiona states to corresponding XML infoset items (when implemented!)XmlDocumentparseLocation(String locationUrl)Parse input from URL location to create XML document.XmlElementparseStartTag(XmlPullParser pp)Parser must be on START_TAG and this method will convert START_TAG content into XmlELement.voidserialize(Object item, XmlSerializer serializer)Serialize XML infoset item including serializing of children.voidserializeEndTag(XmlElement el, XmlSerializer ser)Write XML end tag with information provided in XML element.voidserializeItem(Object item, XmlSerializer ser)Serialize XML infoset item without serializing any of children.voidserializeStartTag(XmlElement el, XmlSerializer ser)Write XML start tag with information provided in XML element.-
Methods inherited from class org.xmlpull.v1.builder.XmlInfosetBuilder
getFactory, newDocument, newInstance, newInstance, parseFragementFromInputStream, parseFragmentFromInputStream, parseFragmentFromReader, parseInputStream, parseInputStream, parseReader, serializeToOutputStream, serializeToOutputStream, serializeToString, serializeToWriter, skipSubTree
-
-
-
-
Method Detail
-
newDocument
public XmlDocument newDocument(String version, Boolean standalone, String characterEncoding)
Description copied from class:XmlInfosetBuilderCreate a new document with given XML prolog.- Specified by:
newDocumentin classXmlInfosetBuilder- Parameters:
version- a Stringstandalone- a BooleancharacterEncoding- a String- Returns:
- a XmlDocument
-
newFragment
public XmlElement newFragment(String elementName)
Description copied from class:XmlInfosetBuilderCreate XML fragment that is not associated with any document.- Specified by:
newFragmentin classXmlInfosetBuilder- Parameters:
elementName- name of element- Returns:
- a XmlElement
-
newFragment
public XmlElement newFragment(String elementNamespaceName, String elementName)
Description copied from class:XmlInfosetBuilderCreate XML fragment that is not associated with any document.- Specified by:
newFragmentin classXmlInfosetBuilder- Parameters:
elementNamespaceName- namespace of elementelementName- name of element- Returns:
- a XmlElement
-
newFragment
public XmlElement newFragment(XmlNamespace elementNamespace, String elementName)
Description copied from class:XmlInfosetBuilderCreate XML fragment that is not associated with any document.- Specified by:
newFragmentin classXmlInfosetBuilder- Parameters:
elementNamespace- a XmlNamespaceelementName- a String- Returns:
- a XmlElement
-
newNamespace
public XmlNamespace newNamespace(String namespaceName)
Description copied from class:XmlInfosetBuilderCreate a new namespace that is not associated with any XML document.- Specified by:
newNamespacein classXmlInfosetBuilder- Parameters:
namespaceName- a String- Returns:
- a XmlNamespace
-
newNamespace
public XmlNamespace newNamespace(String prefix, String namespaceName)
Description copied from class:XmlInfosetBuilderCreate a new namespace that is not associated with any XML document.- Specified by:
newNamespacein classXmlInfosetBuilder- Parameters:
prefix- a StringnamespaceName- a String- Returns:
- a XmlNamespace
-
parse
public XmlDocument parse(XmlPullParser pp)
Description copied from class:XmlInfosetBuilderParse document - parser must be in START_DOCUMENT state.- Specified by:
parsein classXmlInfosetBuilder
-
parseItem
public Object parseItem(XmlPullParser pp)
Description copied from class:XmlInfosetBuilderWill convert current parser state into event rerpresenting XML infoset item:- START_Document: XmlDocument without root element
- START_TAG: XmlElement without children
- TEXT: String or XmlCHaracters depending on builder mode
- additiona states to corresponding XML infoset items (when implemented!)
- Specified by:
parseItemin classXmlInfosetBuilder
-
parseFragment
public XmlElement parseFragment(XmlPullParser pp)
Description copied from class:XmlInfosetBuilderParse fragment - parser must be on START_TAG. After parsing is on corresponding END_TAG.- Specified by:
parseFragmentin classXmlInfosetBuilder
-
parseStartTag
public XmlElement parseStartTag(XmlPullParser pp)
Description copied from class:XmlInfosetBuilderParser must be on START_TAG and this method will convert START_TAG content into XmlELement. Parser location is not chnaged.- Specified by:
parseStartTagin classXmlInfosetBuilder
-
parseLocation
public XmlDocument parseLocation(String locationUrl)
Description copied from class:XmlInfosetBuilderParse input from URL location to create XML document.- Specified by:
parseLocationin classXmlInfosetBuilder- Parameters:
locationUrl- a String- Returns:
- a XmlDocument
-
serialize
public void serialize(Object item, XmlSerializer serializer)
Description copied from class:XmlInfosetBuilderSerialize XML infoset item including serializing of children. If item is Collection all items in collection are serialized by recursively calling this function. This method assumes that item is either interface defined in XB1 API, class String, or that item implements XmlSerializable otherwise IllegalArgumentException is thrown.- Specified by:
serializein classXmlInfosetBuilder
-
serializeItem
public void serializeItem(Object item, XmlSerializer ser)
Description copied from class:XmlInfosetBuilderSerialize XML infoset item without serializing any of children. This method assumes that item is either interface defined in XB1 API, class String, or item that implements XmlSerializable otherwise IllegalArgumentException is thrown.- Specified by:
serializeItemin classXmlInfosetBuilder
-
serializeStartTag
public void serializeStartTag(XmlElement el, XmlSerializer ser)
Description copied from class:XmlInfosetBuilderWrite XML start tag with information provided in XML element.- Specified by:
serializeStartTagin classXmlInfosetBuilder- Parameters:
el- a XmlElementser- a XmlSerializer
-
serializeEndTag
public void serializeEndTag(XmlElement el, XmlSerializer ser)
Description copied from class:XmlInfosetBuilderWrite XML end tag with information provided in XML element.- Specified by:
serializeEndTagin classXmlInfosetBuilder- Parameters:
el- a XmlElementser- a XmlSerializer
-
-