Methods Summary |
---|
public static AttributeSet | asAttributeSet(org.xmlpull.v1.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.
return (parser instanceof AttributeSet)
? (AttributeSet) parser
: new XmlPullAttributes(parser);
|
public static android.util.Xml$Encoding | findEncodingByName(java.lang.String encodingName)Finds an encoding by name. Returns UTF-8 if you pass {@code null}.
if (encodingName == null) {
return Encoding.UTF_8;
}
for (Encoding encoding : Encoding.values()) {
if (encoding.expatName.equalsIgnoreCase(encodingName))
return encoding;
}
throw new UnsupportedEncodingException(encodingName);
|
public static org.xmlpull.v1.XmlPullParser | newPullParser()Returns a new pull parser with namespace support.
try {
KXmlParser parser = new KXmlParser();
parser.setFeature(XmlPullParser.FEATURE_PROCESS_DOCDECL, true);
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, true);
return parser;
} catch (XmlPullParserException e) {
throw new AssertionError();
}
|
public static org.xmlpull.v1.XmlSerializer | newSerializer()Creates a new xml serializer.
try {
return XmlSerializerFactory.instance.newSerializer();
} catch (XmlPullParserException e) {
throw new AssertionError(e);
}
|
public static void | parse(java.lang.String xml, org.xml.sax.ContentHandler contentHandler)Parses the given xml string and fires events on the given SAX handler.
try {
XMLReader reader = new ExpatReader();
reader.setContentHandler(contentHandler);
reader.parse(new InputSource(new StringReader(xml)));
} catch (IOException e) {
throw new AssertionError(e);
}
|
public static void | parse(java.io.Reader in, org.xml.sax.ContentHandler contentHandler)Parses xml from the given reader and fires events on the given SAX
handler.
XMLReader reader = new ExpatReader();
reader.setContentHandler(contentHandler);
reader.parse(new InputSource(in));
|
public static void | parse(java.io.InputStream in, android.util.Xml$Encoding encoding, org.xml.sax.ContentHandler contentHandler)Parses xml from the given input stream and fires events on the given SAX
handler.
XMLReader reader = new ExpatReader();
reader.setContentHandler(contentHandler);
InputSource source = new InputSource(in);
source.setEncoding(encoding.expatName);
reader.parse(source);
|