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()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.
ExpatPullParser parser = new ExpatPullParser();
parser.setNamespaceProcessingEnabled(true);
return parser;
|
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.
try {
XMLReader reader = new ExpatReader();
reader.setContentHandler(contentHandler);
InputSource source = new InputSource(in);
source.setEncoding(encoding.expatName);
reader.parse(source);
} catch (IOException e) {
throw new AssertionError(e);
}
|