react-native-turboxml
v1.0.3
Published
A high-performance native XML parser for React Native built with Kotlin and Objective-C using TurboModules and the New Architecture.
Downloads
84
Maintainers
Readme
Benchmark
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
