Interactive Demo
Experience the power of stax-xml/converter right in your browser! This interactive demo lets you experiment with different XML parsing scenarios using our declarative, type-safe API.
🚀 Open in Full Screen for the best experience.
Features Demonstrated
Section titled “Features Demonstrated”🎯 Basic Object Parsing
Section titled “🎯 Basic Object Parsing”Parse XML into structured JavaScript objects with type safety and validation.
📦 Array Handling
Section titled “📦 Array Handling”Extract arrays of elements from XML documents using XPath selectors.
🔄 Transformations
Section titled “🔄 Transformations”Apply custom transformation functions to parsed data for data manipulation.
✅ Validation
Section titled “✅ Validation”Enforce constraints on your data with built-in validation methods like min(), max(), and int().
📰 RSS Feeds
Section titled “📰 RSS Feeds”Parse real-world RSS feed structures with nested arrays and complex schemas.
🏷️ Attributes
Section titled “🏷️ Attributes”Access XML attributes using XPath attribute selectors (@attribute).
🗂️ Nested Arrays
Section titled “🗂️ Nested Arrays”Handle complex nested structures with arrays inside objects inside arrays.
❓ Optional Fields
Section titled “❓ Optional Fields”Mark fields as optional to handle incomplete or variable XML documents.
How to Use
Section titled “How to Use”- Choose an Example: Click one of the quick example buttons to load a pre-configured scenario
- Edit the XML: Modify the XML input to test different structures
- Adjust the Schema: Change the schema definition to match your XML structure
- Select Mode: Choose between Sync (string-based) or Async (ReadableStream-based) parsing
- Parse: Click the “Parse XML” button to see the result
- Upload Files: Test with your own XML files (up to 10MB)
Performance Metrics
Section titled “Performance Metrics”The demo tracks:
- Parse Time: How long it took to parse the XML
- Mode: Whether sync or async parsing was used
- XML Size: The size of your input XML
- Throughput: Processing speed in KB/s
Try It in Your Project
Section titled “Try It in Your Project”Once you’ve experimented with the demo, install stax-xml in your project:
npm install stax-xmlThen use the same patterns from the demo:
import { x } from 'stax-xml/converter';
const schema = x.object({ title: x.string().xpath('/book/title'), author: x.string().xpath('/book/author'), price: x.number().xpath('/book/price')});
const result = schema.parseSync(xmlString);Next Steps
Section titled “Next Steps”- Core Concepts - Learn the fundamentals
- Schema Types - Explore all available schema types
- XPath Guide - Master XPath expressions
- Examples - More real-world examples