Better error locations in XML. cpl-metadata
authorCarl Hetherington <cth@carlh.net>
Sun, 20 Sep 2020 23:04:30 +0000 (01:04 +0200)
committerCarl Hetherington <cth@carlh.net>
Sun, 20 Sep 2020 23:18:37 +0000 (01:18 +0200)
src/verify.cc

index 0b48ce246337a0941678e303e849a67660ef7548..3301ca170c548b73f008b396640ebf997730195e 100644 (file)
@@ -103,6 +103,8 @@ public:
                : _message (xml_ch_to_string(e.getMessage()))
                , _line (e.getLineNumber())
                , _column (e.getColumnNumber())
+               , _public_id (e.getPublicId() ? xml_ch_to_string(e.getPublicId()) : "")
+               , _system_id (e.getSystemId() ? xml_ch_to_string(e.getSystemId()) : "")
        {
 
        }
@@ -119,10 +121,20 @@ public:
                return _column;
        }
 
+       string public_id () const {
+               return _public_id;
+       }
+
+       string system_id () const {
+               return _system_id;
+       }
+
 private:
        string _message;
        uint64_t _line;
        uint64_t _column;
+       string _public_id;
+       string _system_id;
 };
 
 
@@ -333,7 +345,7 @@ validate_xml (T xml, boost::filesystem::path xsd_dtd_directory, list<Verificatio
                                VerificationNote::VERIFY_ERROR,
                                VerificationNote::XML_VALIDATION_ERROR,
                                i.message(),
-                               xml,
+                               boost::trim_copy(i.public_id() + " " + i.system_id()),
                                i.line()
                                )
                        );