- Replace character-by-character XML parsing with robust SAX parser library
- Add sax and @types/sax dependencies for reliable XML parsing
- Implement event-driven parsing with onopentag, onclosetag, ontext handlers
- Add XML wrapping to handle multiple root elements in streaming scenarios
- Create hasIncompleteXml() method for proper partial XML detection
- Maintain backward compatibility with existing partial detection logic
- Add comprehensive test suite with 6 new test cases
- Preserve fallback to manual parsing when SAX parser fails
- Improve error handling and maintain all existing functionality
Benefits:
- More robust XML parsing with better edge case handling
- Improved performance with event-driven parsing
- Cleaner, more maintainable code
- Standards-compliant XML parsing
- Full backward compatibility