Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
Android APIs
public class

Xml

extends Object
java.lang.Object
   ↳ android.util.Xml

Class Overview

XML utility methods.

Summary

Nested Classes
enum Xml.Encoding Supported character encodings. 
Fields
public static String FEATURE_RELAXED XmlPullParser "relaxed" feature name.
Public Methods
static AttributeSet asAttributeSet ( XmlPullParser parser)
Return an AttributeSet interface for use with the given XmlPullParser.
static Xml.Encoding findEncodingByName ( String encodingName)
Finds an encoding by name.
static XmlPullParser newPullParser ()
Returns a new pull parser with namespace support.
static XmlSerializer newSerializer ()
Creates a new xml serializer.
static void parse ( String xml, ContentHandler contentHandler)
Parses the given xml string and fires events on the given SAX handler.
static void parse ( InputStream in, Xml.Encoding encoding, ContentHandler contentHandler)
Parses xml from the given input stream and fires events on the given SAX handler.
static void parse ( Reader in, ContentHandler contentHandler)
Parses xml from the given reader and fires events on the given SAX handler.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

public static String FEATURE_RELAXED

Added in API level 1

XmlPullParser "relaxed" feature name.

Public Methods

public static AttributeSet asAttributeSet ( XmlPullParser parser)

Added in API level 1

Return an AttributeSet interface for use with the given XmlPullParser. If the given parser itself implements AttributeSet, that implementation is simply returned. Otherwise a wrapper class is instantiated on top of the XmlPullParser, as a proxy for retrieving its attributes, and returned to you.

Parameters
parser The existing parser for which you would like an AttributeSet.
Returns
  • An AttributeSet you can use to retrieve the attribute values at each of the tags as the parser moves through its XML document.

public static Xml.Encoding findEncodingByName ( String encodingName)

Added in API level 1

Finds an encoding by name. Returns UTF-8 if you pass null .

public static XmlPullParser newPullParser ()

Added in API level 1

Returns a new pull parser with namespace support.

public static XmlSerializer newSerializer ()

Added in API level 1

Creates a new xml serializer.

public static void parse ( String xml, ContentHandler contentHandler)

Added in API level 1

Parses the given xml string and fires events on the given SAX handler.

public static void parse ( InputStream in, Xml.Encoding encoding, ContentHandler contentHandler)

Added in API level 1

Parses xml from the given input stream and fires events on the given SAX handler.

public static void parse ( Reader in, ContentHandler contentHandler)

Added in API level 1

Parses xml from the given reader and fires events on the given SAX handler.