Commit graph

1 commit

Author SHA1 Message Date
Steven T. Cramer
1b9d9e65d9 refactor: Replace manual XML parsing with SAX parser in DirectiveStreamingParser
- 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
2025-06-15 08:33:21 +07:00