Package Exports
- react-native-turboxml
- react-native-turboxml/package.json
Readme
TurboXML – Fast Native XML Parser for React Native
A high-performance native XML parser for React Native using TurboModules and the New Architecture.
4× faster than JavaScript-based parsers like react-native-xml2js.
Benchmark
TurboXML (left) keeps the UI smooth while fast-xml-parser (right) freezes the entire app.
Features
- Native performance – Parses XML natively on both platforms (Kotlin on Android, Objective-C on iOS)
- TurboModules + JSI – Built for React Native's New Architecture
- Async & non-blocking – Parsing runs on background threads
- Fully typed – TypeScript definitions included
- Simple API – Single function, returns a Promise
Installation
npm install react-native-turboxml
# or
yarn add react-native-turboxmliOS
cd ios && pod installRequirements
- React Native 0.71+
- New Architecture enabled
- Android 5.0+ / iOS 13.0+
Usage
import { parseXml } from 'react-native-turboxml';
const xml = `
<config>
<title>TurboXML</title>
<enabled>true</enabled>
<version>1.0</version>
</config>
`;
const result = await parseXml(xml);
console.log(result);Output
{
"config": {
"title": "TurboXML",
"enabled": "true",
"version": "1.0"
}
}API
function parseXml(xml: string): Promise<Record<string, unknown>>;| Parameter | Type | Description |
|---|---|---|
xml |
string |
The XML string to parse |
Returns: A Promise that resolves to a JavaScript object representing the parsed XML.
Why TurboXML?
JavaScript-based XML parsers run on the JS thread and can block your UI during large file parsing. TurboXML uses native code on both platforms:
- Android: Jackson XmlMapper with Kotlin coroutines
- iOS: NSXMLParser with GCD
This means parsing happens on background threads and communicates directly via JSI – no bridge serialization overhead.
Use cases
- Offline maps and geospatial data (KML, GPX)
- Configuration files
- API responses in XML format
- Data import/export
Comparison
| Parser | Native | New Architecture | Async |
|---|---|---|---|
| react-native-turboxml | Yes | Yes (TurboModules) | Yes |
| react-native-xml2js | No | No | Yes |
| fast-xml-parser | No | No | No |
Contributing
Contributions are welcome! Feel free to open issues or submit PRs.
License
MIT