🚀 고성능
스트리밍 지원으로 속도와 낮은 메모리 사용량을 위해 최적화됨
🚀 고성능
스트리밍 지원으로 속도와 낮은 메모리 사용량을 위해 최적화됨
🔄 풀 기반 파싱
대용량 XML 파일의 메모리 효율적인 처리를 위한 스트림 기반 접근법
🌐 범용 호환성
웹 표준 API를 사용하여 Node.js, Bun, Deno 및 웹 브라우저에서 작동
📝 TypeScript 지원
포괄적인 타입 정의와 함께 완전한 TypeScript 지원
# npmnpm install stax-xml
# yarnyarn add stax-xml
# pnpmpnpm add stax-xml
# bunbun add stax-xml
# denodeno add npm:stax-xml
import { StaxXmlParser, XmlEventType } from 'stax-xml';
const xmlContent = '<root><item>안녕하세요</item></root>';const stream = new ReadableStream({ start(controller) { controller.enqueue(new TextEncoder().encode(xmlContent)); controller.close(); }});
async function parseXml() { const parser = new StaxXmlParser(stream); for await (const event of parser) { console.log(event); }}parseXml();
기존의 XML-to-JSON 매퍼와 달리, StAX-XML은 스트리밍이나 직접 문자열 처리를 통해 XML 파일을 효율적으로 처리하면서 XML 데이터를 원하는 모든 사용자 정의 구조로 매핑할 수 있습니다.