Refactor NLAP XML parsing to a new Xerces-based tree parser with static DTD validation - #202
Refactor NLAP XML parsing to a new Xerces-based tree parser with static DTD validation#202clauspruefer with Copilot wants to merge 5 commits into
Conversation
clauspruefer
left a comment
There was a problem hiding this comment.
@copilot who the fuck did tell you to use coroutines? I will not pay this shit! Please start over with the exact specifications i gave you!
Done. I removed the coroutine-based implementation and replaced it with straightforward loop/vector logic in commit |
clauspruefer
left a comment
There was a problem hiding this comment.
@copilot From the original specifications 5. Use std::generatorand co_yieldin sub-parser routines 6. Usestd::string_viewto reduce copy operations 7. Use smart pointersunique_ptr<>andshared_ptr<> where possible In your last commit you used C++20 Coroutines, it was my fault it must be C++23 std::generator and only co_yield, please re-aplly these specs, use std::generator and co_yield, recheck using std::string_view where possible and use smart pointers! And always produce clean OOP code!
Done — reapplied the parser specs in commit |
This PR replaces the XML parser implementation in
lib/xmlwith a clean-slate design aligned to the NLAP parser contract: Xerces-backed parsing, DTD-constrained validation, strict framing/syntax/content errors, and zero-copy leaf addressing from the caller buffer.The parser now returns per-message nested result trees (
vector<unordered_map<...>>) with terminalAddress/Lengthspans suitable for direct field extraction.Parser API + data model
ParseResult_t { vector<ResultTree_t> Results, uint16_t ErrorCode }const char* Address+size_t Lengthparse(char* InputBuffer)with internalstd::string_viewhandling.setParseBufferSize,getParseBufferSize).Fresh Xerces parsing pipeline
Validation + error semantics
xmlconstants.hpp:XML_ERROR_INVALID_CONTENT_DTDXML_ERROR_INVALID_SYNTAXXML_ERROR_INVALID_FRAMINGStatic DTD embedding
lib/xml/static-dtd.hppwith constexpr hex-encoded DTD bytes.MemBufInputSource) and used as cached DTD for validation.Security posture
XML module reset + test surface update
lib/xml/xmlparser.hpp/.cppimplementation and updated XML module behavior accordingly.