Package Exports
- react-native-turboxml
- react-native-turboxml/package.json
Readme
π TurboXML β Fast XML Parser for React Native (TurboModules)
A blazing-fast, Android-native XML parser built for React Nativeβs New Architecture using Kotlin, JSI, and TurboModules.
4Γ faster than react-native-xml2js in parsing large XML files.
β‘ Features
- β
4Γ faster than
react-native-xml2js - β Native multithreaded XML parsing on Android
- β Powered by TurboModules + JSI (New Architecture support)
- β Lightweight and fully typed (TypeScript ready)
- β Designed for offline, map-heavy, or config-driven React Native apps
π¦ Installation
npm install react-native-turboxml
# or
yarn add react-native-turboxmlMake sure New Architecture is enabled:
cd ios && RCT_NEW_ARCH_ENABLED=1 pod install && cd ..β οΈ Currently supports Android only. iOS support planned for future releases.
π§ͺ Usage Example
import { useEffect, useState } from 'react';
import { Text, View, StyleSheet } from 'react-native';
import { parseXml } from 'react-native-turboxml';
export default function App() {
const [parsedResult, setParsedResult] = useState<string | null>(null);
useEffect(() => {
const xml = `
<config>
<title>TurboXML</title>
<enabled>true</enabled>
<version>1.0</version>
</config>
`;
parseXml(xml)
.then((result) => {
setParsedResult(JSON.stringify(result, null, 2));
})
.catch((error) => {
setParsedResult(\`Error: \${error.message}\`);
});
}, []);
return (
<View style={styles.container}>
<Text style={styles.title}>Parsed XML:</Text>
<Text style={styles.output}>{parsedResult}</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 24,
justifyContent: 'center',
},
title: {
fontWeight: 'bold',
marginBottom: 8,
},
output: {
fontFamily: 'monospace',
},
});β Example Output
{
"config": {
"title": ["TurboXML"],
"enabled": ["true"],
"version": ["1.0"]
}
}π Why TurboXML?
If your app needs to parse large XML files β such as offline maps, configuration files, or external data feeds β react-native-turboxml offers a significant speed improvement over JavaScript-based parsers by leveraging native code, multithreading, and the React Native New Architecture (TurboModules + JSI).
π Requirements
- React Native 0.71+ with New Architecture enabled
- Android 5+ (iOS support coming)
- TurboModule + JSI support (enabled by default in modern RN projects)
π API Reference
function parseXml(xml: string): Promise<Record<string, any>>;π Contribute or Sponsor
Got feature ideas or want to help bring iOS support? PRs welcome! If this module helps your app or workflow, consider starring the repo or reaching out.