From 95eb4ff500defc4e34d043bbc096593ffcadecea Mon Sep 17 00:00:00 2001 From: Kostya Date: Thu, 8 Oct 2026 16:45:02 +0300 Subject: catalog: add cumulative v3 XML loader and event mapper Exercise 3 uploads arrive over HTTP and must never be written to the server's disk, so load Schema v3 straight from an InputStream. Each valid file is appended to the market rather than replacing it, and the uploading user becomes the Market Maker of every event in it. With no id in v3, the mapper keys events by their trimmed name, so the repository's case-insensitive lookup finds them by name. Display ids continue from the current market size. The whole file is validated and mapped before anything is added, so a rejected upload leaves the market as it was. Loading is synchronized so two concurrent uploads cannot both pass the name-collision check. DTDs and external entities are disabled on the parser, since the input is untrusted and an XXE payload could otherwise read server files. Check the loader against the course's Exercise 3 sample files, kept with their schema under test-data/ex-3/. --- test-data/ex-3/GM-EX3-Schema.xsd | 83 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 test-data/ex-3/GM-EX3-Schema.xsd (limited to 'test-data/ex-3/GM-EX3-Schema.xsd') diff --git a/test-data/ex-3/GM-EX3-Schema.xsd b/test-data/ex-3/GM-EX3-Schema.xsd new file mode 100644 index 0000000..ae83527 --- /dev/null +++ b/test-data/ex-3/GM-EX3-Schema.xsd @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3