Files
bun.sh/test_xml.js
Claude Bot 03b2e48600 Initial XML parsing implementation
- Add XMLObject.zig API wrapper following YAML pattern
- Add xml.zig parser using Expr AST like YAML
- Add XML to BunObject hash table and exports
- Add XML to interchange.zig and api.zig

Currently debugging parsing issue where 'Expected <' error occurs
even with simple XML like '<a>b</a>'.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-29 19:20:54 +00:00

36 lines
1.0 KiB
JavaScript

// Simple test for XML parsing
const xml = `<person name="John" age="30">
<address>
<city>New York</city>
<country>USA</country>
</address>
<hobbies>
<hobby>reading</hobby>
<hobby>swimming</hobby>
</hobbies>
</person>`;
try {
const result = Bun.XML.parse(xml);
console.log("XML Parse Result:", JSON.stringify(result, null, 2));
} catch (err) {
console.error("XML Parse Error:", err.message);
}
// Test simple text element
const simpleXml = `<message>Hello World</message>`;
try {
const simpleResult = Bun.XML.parse(simpleXml);
console.log("Simple XML Result:", JSON.stringify(simpleResult, null, 2));
} catch (err) {
console.error("Simple XML Error:", err.message);
}
// Test self-closing element
const selfClosing = `<config debug="true"/>`;
try {
const selfClosingResult = Bun.XML.parse(selfClosing);
console.log("Self-closing XML Result:", JSON.stringify(selfClosingResult, null, 2));
} catch (err) {
console.error("Self-closing XML Error:", err.message);
}