MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / XmlRecoveryHelper

Class XmlRecoveryHelper

src/util/xml_stream_util.h:84–108  ·  view source on GitHub ↗

* This class provides recovery from invalid characters in an XML stream. * * Some characters are not allowed in well-formed XML 1.0 (cf. * https://www.w3.org/TR/2008/REC-xml-20081126/#NT-Char). While QXmlStreamWriter * will not complain when writing such characters, QXmlStreamReader will raise * a NotWellFormedError. This class will remove offending characters from the * input and reset the

Source from the content-addressed store, hash-verified

82 * }
83 */
84class XmlRecoveryHelper
85{
86public:
87 /**
88 * Constructs a new recovery helper for the given xml stream.
89 *
90 * Captures the current position in the XML stream (QXmlStreamReader::characterOffset()).
91 */
92 XmlRecoveryHelper(QXmlStreamReader& xml) : xml (xml), recovery_start {xml.characterOffset()} {}
93
94 /**
95 * Checks the stream for an error which this utility can handle,
96 * applies corrections, and resets the stream.
97 *
98 * If this operator returns false if either there was a different type of
99 * error, or if recovery failed. If it returns true, the stream was modified
100 * in order to fix the errors which are handled by this utility, and a new
101 * attempt can be made to parse the remainder of the stream.
102 */
103 bool operator() ();
104
105private:
106 QXmlStreamReader& xml;
107 const qint64 recovery_start;
108};
109
110
111

Callers 2

importMapNotesMethod · 0.85
importMapPartsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected