Name
XPP (XML Pull Parser)
Description
XPP
is an MIT App Inventor extension (also works on Kodular, Niotron, and AndroidBuilder ..etc.) that provides a fast and lightweight way to parse XML data using the XmlPullParser API in Java.
It allows you to read and parse XML from multiple sources:
- From text (String)
- From URL (HTTP/HTTPS)
- From local file path
- From application assets
During parsing, it triggers events so you can handle XML data dynamically:
TagStarted
→ fired when a start tag is foundTextFound
→ fired when text content is foundTagEnded
→ fired when an end tag is found
Why use XmlPullParser?
1. Performance & Speed
- XmlPullParser works in a streaming manner, reading the XML step by step.
- This makes it much faster and more memory-efficient than DOM parsing (which loads the entire document).
2. Lightweight
- Ideal for Android apps, especially when working with large XML files.
- Consumes less memory compared to tree-based parsers.
3. Flexible
- You can skip unwanted sections, jump to specific tags (
SkipToTag
,FindNextTag
), or extract only the parts you need.
4. Full Control
- You decide what to do with tags, attributes, and text as they are parsed, instead of loading everything at once.
Benefits of XPP Extension
Multiple XML sources: Read from text, URL, file, or asset.
Event-driven parsing: Handle tags and text dynamically during parsing.
Attributes support: Retrieve all attributes or specific ones by index or name.
Utility methods:
SkipToTag
,FindNextTag
,GetInnerXml
for advanced navigation.Error handling: Central
ErrorOccurred
event with details about the error and method.Resource-safe: Automatically closes old input streams and resets parser state.
Easy to use: Designed with simple App Inventor blocks.
All Blocks
Example Usage
data usage :
<books>
<book id="1" author="Aemo">
<title>XML Parsing Made Easy</title>
</book>
<book id="2" author="Dev">
<title>MIT App Inventor Extensions</title>
</book>
</books>
Output
### Download AIX
me.aemo.xpp.aix (14.9 KB)
For more info:
https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser
Credits
Support Development
If you like this extension and want to support future work:
Donate via PayPal