org.xmlpull.v1.builder.impl
Class XmlInfosetBuilderImpl

java.lang.Object
  extended by org.xmlpull.v1.builder.XmlInfosetBuilder
      extended by 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.


Field Summary
 
Fields inherited from class org.xmlpull.v1.builder.XmlInfosetBuilder
factory
 
Constructor Summary
XmlInfosetBuilderImpl()
           
 
Method Summary
 XmlDocument newDocument(java.lang.String version, java.lang.Boolean standalone, java.lang.String characterEncoding)
          Create a new document with given XML prolog.
 XmlElement newFragment(java.lang.String elementName)
          Create XML fragment that is not associated with any document.
 XmlElement newFragment(java.lang.String elementNamespaceName, java.lang.String elementName)
          Create XML fragment that is not associated with any document.
 XmlElement newFragment(XmlNamespace elementNamespace, java.lang.String elementName)
          Create XML fragment that is not associated with any document.
 XmlNamespace newNamespace(java.lang.String namespaceName)
          Create a new namespace that is not associated with any XML document.
 XmlNamespace newNamespace(java.lang.String prefix, java.lang.String namespaceName)
          Create a new namespace that is not associated with any XML document.
 XmlDocument parse(XmlPullParser pp)
          Parse document - parser must be in START_DOCUMENT state.
 XmlElement parseFragment(XmlPullParser pp)
          Parse fragment - parser must be on START_TAG.
 java.lang.Object parseItem(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!)
 XmlDocument parseLocation(java.lang.String locationUrl)
          Parse input from URL location to create XML document.
 XmlElement parseStartTag(XmlPullParser pp)
          Parser must be on START_TAG and this method will convert START_TAG content into XmlELement.
 void serialize(java.lang.Object item, XmlSerializer serializer)
          Serialize XML infoset item including serializing of children.
 void serializeEndTag(XmlElement el, XmlSerializer ser)
          Write XML end tag with information provided in XML element.
 void serializeItem(java.lang.Object item, XmlSerializer ser)
          Serialize XML infoset item without serializing any of children.
 void serializeStartTag(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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlInfosetBuilderImpl

public XmlInfosetBuilderImpl()
Method Detail

newDocument

public XmlDocument newDocument(java.lang.String version,
                               java.lang.Boolean standalone,
                               java.lang.String characterEncoding)
Description copied from class: XmlInfosetBuilder
Create a new document with given XML prolog.

Specified by:
newDocument in class XmlInfosetBuilder
Parameters:
version - a String
standalone - a Boolean
characterEncoding - a String
Returns:
a XmlDocument

newFragment

public XmlElement newFragment(java.lang.String elementName)
Description copied from class: XmlInfosetBuilder
Create XML fragment that is not associated with any document.

Specified by:
newFragment in class XmlInfosetBuilder
Parameters:
elementName - name of element
Returns:
a XmlElement

newFragment

public XmlElement newFragment(java.lang.String elementNamespaceName,
                              java.lang.String elementName)
Description copied from class: XmlInfosetBuilder
Create XML fragment that is not associated with any document.

Specified by:
newFragment in class XmlInfosetBuilder
Parameters:
elementNamespaceName - namespace of element
elementName - name of element
Returns:
a XmlElement

newFragment

public XmlElement newFragment(XmlNamespace elementNamespace,
                              java.lang.String elementName)
Description copied from class: XmlInfosetBuilder
Create XML fragment that is not associated with any document.

Specified by:
newFragment in class XmlInfosetBuilder
Parameters:
elementNamespace - a XmlNamespace
elementName - a String
Returns:
a XmlElement

newNamespace

public XmlNamespace newNamespace(java.lang.String namespaceName)
Description copied from class: XmlInfosetBuilder
Create a new namespace that is not associated with any XML document.

Specified by:
newNamespace in class XmlInfosetBuilder
Parameters:
namespaceName - a String
Returns:
a XmlNamespace

newNamespace

public XmlNamespace newNamespace(java.lang.String prefix,
                                 java.lang.String namespaceName)
Description copied from class: XmlInfosetBuilder
Create a new namespace that is not associated with any XML document.

Specified by:
newNamespace in class XmlInfosetBuilder
Parameters:
prefix - a String
namespaceName - a String
Returns:
a XmlNamespace

parse

public XmlDocument parse(XmlPullParser pp)
Description copied from class: XmlInfosetBuilder
Parse document - parser must be in START_DOCUMENT state.

Specified by:
parse in class XmlInfosetBuilder

parseItem

public java.lang.Object parseItem(XmlPullParser pp)
Description copied from class: XmlInfosetBuilder
Will convert current parser state into event rerpresenting XML infoset item:

Specified by:
parseItem in class XmlInfosetBuilder

parseFragment

public XmlElement parseFragment(XmlPullParser pp)
Description copied from class: XmlInfosetBuilder
Parse fragment - parser must be on START_TAG. After parsing is on corresponding END_TAG.

Specified by:
parseFragment in class XmlInfosetBuilder

parseStartTag

public XmlElement parseStartTag(XmlPullParser pp)
Description copied from class: XmlInfosetBuilder
Parser must be on START_TAG and this method will convert START_TAG content into XmlELement. Parser location is not chnaged.

Specified by:
parseStartTag in class XmlInfosetBuilder

parseLocation

public XmlDocument parseLocation(java.lang.String locationUrl)
Description copied from class: XmlInfosetBuilder
Parse input from URL location to create XML document.

Specified by:
parseLocation in class XmlInfosetBuilder
Parameters:
locationUrl - a String
Returns:
a XmlDocument

serialize

public void serialize(java.lang.Object item,
                      XmlSerializer serializer)
Description copied from class: XmlInfosetBuilder
Serialize 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:
serialize in class XmlInfosetBuilder

serializeItem

public void serializeItem(java.lang.Object item,
                          XmlSerializer ser)
Description copied from class: XmlInfosetBuilder
Serialize 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:
serializeItem in class XmlInfosetBuilder

serializeStartTag

public void serializeStartTag(XmlElement el,
                              XmlSerializer ser)
Description copied from class: XmlInfosetBuilder
Write XML start tag with information provided in XML element.

Specified by:
serializeStartTag in class XmlInfosetBuilder
Parameters:
el - a XmlElement
ser - a XmlSerializer

serializeEndTag

public void serializeEndTag(XmlElement el,
                            XmlSerializer ser)
Description copied from class: XmlInfosetBuilder
Write XML end tag with information provided in XML element.

Specified by:
serializeEndTag in class XmlInfosetBuilder
Parameters:
el - a XmlElement
ser - a XmlSerializer