Android
android.util
public class

android.util.Xml

java.lang.Object
android.util.Xml

XML utility methods.

Nested Classes
Xml.Encoding Supported character encodings. 

Summary

Fields

public  static    String  FEATURE_RELAXED  XmlPullParser "relaxed" feature name. 

Public Constructors

            Xml()

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()
Creates 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(Reader in, ContentHandler contentHandler)
Parses xml from the given reader 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.
Methods inherited from class java.lang.Object

Details

Fields

public static String FEATURE_RELAXED

XmlPullParser "relaxed" feature name.

See Also

Public Constructors

public Xml()

Public Methods

public static AttributeSet asAttributeSet(XmlPullParser parser)

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.

See Also

public static Xml.Encoding findEncodingByName(String encodingName)

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

public static XmlPullParser newPullParser()

Creates a new pull parser with namespace support.

Note: This is actually slower than the SAX parser, and it's not fully implemented. If you need a fast, mostly implemented pull parser, use this. If you need a complete implementation, use KXML.

public static XmlSerializer newSerializer()

Creates a new xml serializer.

public static void parse(String xml, ContentHandler contentHandler)

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

Throws

SAXException

public static void parse(Reader in, ContentHandler contentHandler)

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

public 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.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48