Class Xml (1.41.8)

  public 
  
 class 
 Xml 
 

Beta XML utilities.

Inheritance

Object > Xml

Static Fields

MEDIA_TYPE

  public 
  
 static 
  
 final 
  
 String 
  
 MEDIA_TYPE 
 

"application/xml; charset=utf-8" media type used as a default for XML parsing.

Use HttpMediaType#equalsIgnoreParameters for comparing media types.

Field Value
Type Description
String

Static Methods

createParser()

  public 
  
 static 
  
 XmlPullParser 
  
 createParser 
 () 
 

Returns a new XML pull parser.

Returns
Type Description
org.xmlpull.v1.XmlPullParser
Exceptions
Type Description
org.xmlpull.v1.XmlPullParserException

createSerializer()

  public 
  
 static 
  
 XmlSerializer 
  
 createSerializer 
 () 
 

Returns a new XML serializer.

Returns
Type Description
org.xmlpull.v1.XmlSerializer

parseElement(XmlPullParser parser, Object destination, XmlNamespaceDictionary namespaceDictionary, Xml.CustomizeParser customizeParser)

  public 
  
 static 
  
 void 
  
 parseElement 
 ( 
 XmlPullParser 
  
 parser 
 , 
  
 Object 
  
 destination 
 , 
  
 XmlNamespaceDictionary 
  
 namespaceDictionary 
 , 
  
 Xml 
 . 
 CustomizeParser 
  
 customizeParser 
 ) 
 

Parses an XML element using the given XML pull parser into the given destination object.

Requires the current event be XmlPullParser#START_TAG (skipping any initial XmlPullParser#START_DOCUMENT ) of the element being parsed. At normal parsing completion, the current event will either be XmlPullParser#END_TAG of the element being parsed, or the XmlPullParser#START_TAG of the requested atom:entry .

Parameters
Name Description
parser org.xmlpull.v1.XmlPullParser

XML pull parser

destination Object

optional destination object to parser into or null to ignore XML content

namespaceDictionary XmlNamespaceDictionary

XML namespace dictionary to store unknown namespaces

customizeParser Xml.CustomizeParser

optional parser customizer or null for none

Exceptions
Type Description
IOException
org.xmlpull.v1.XmlPullParserException

toStringOf(Object element)

  public 
  
 static 
  
 String 
  
 toStringOf 
 ( 
 Object 
  
 element 
 ) 
 

Shows a debug string representation of an element data object of key/value pairs.

It will make up something for the element name and XML namespaces. If those are known, it is better to use XmlNamespaceDictionary#toStringOf(String, Object) .

Parameter
Name Description
element Object

element data object of key/value pairs ( GenericXml , Map , or any object with public fields)

Returns
Type Description
String
Design a Mobile Site
View Site in Mobile | Classic
Share by: