{
XMLReaderBase* pReader = (XMLReaderBase*) userData;
- if (version) {
+ if (version)
pReader->_xml_version = version;
+
+ if (encoding)
pReader->_encoding = encoding;
- }
}
/// notifications about XML start tag
case XML_ERROR_FEATURE_REQUIRES_XML_DTD: return "XML_ERROR_FEATURE_REQUIRES_XML_DTD";
case XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING: return "XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING";
case XML_ERROR_UNBOUND_PREFIX: return "XML_ERROR_UNBOUND_PREFIX";
+ // EXPAT version >= 1.95.8
+#if XML_MAJOR_VERSION>1 || (XML_MAJOR_VERSION==1 && XML_MINOR_VERSION>95) || (XML_MAJOR_VERSION==1 && XML_MINOR_VERSION==95 && XML_MICRO_VERSION>7)
case XML_ERROR_SUSPENDED: return "XML_ERROR_SUSPENDED";
case XML_ERROR_NOT_SUSPENDED: return "XML_ERROR_NOT_SUSPENDED";
case XML_ERROR_ABORTED: return "XML_ERROR_ABORTED";
case XML_ERROR_FINISHED: return "XML_ERROR_FINISHED";
case XML_ERROR_SUSPEND_PE: return "XML_ERROR_SUSPEND_PE";
+#endif
}
std::ostringstream out;
int _value;
private:
- void operator=(const XMLBool&); // disallow assignment operations
+ void operator=(const XMLInt&); // disallow assignment operations
};
struct XMLIntRef
};
+struct XMLString
+{
+ XMLString(const String& value)
+ : _value(value)
+ {
+ }
+
+ XMLString(LPCTSTR value, LPCTSTR def=TEXT(""))
+ {
+ if (value && *value)
+ _value = value;
+ else
+ _value = def;
+ }
+
+ XMLString(const XMLNode* node, const String& attr_name, LPCTSTR def=TEXT(""))
+ {
+ const String& value = node->get(attr_name);
+
+ if (!value.empty())
+ _value = value;
+ else
+ _value = def;
+ }
+
+ XMLString(const XMLNode* node, const String& name, const String& attr_name, LPCTSTR def=TEXT(""))
+ {
+ const String& value = node->value(name, attr_name);
+
+ if (!value.empty())
+ _value = value;
+ else
+ _value = def;
+ }
+
+ operator const String&() const
+ {
+ return _value;
+ }
+
+protected:
+ String _value;
+
+private:
+ void operator=(const XMLString&); // disallow assignment operations
+};
+
+struct XMStringRef
+{
+ XMStringRef(XMLNode* node, const String& name, const String& attr_name, LPCTSTR def=TEXT(""))
+ : _ref(node->value(name, attr_name))
+ {
+ if (_ref.empty())
+ assign(def);
+ }
+
+ XMStringRef& operator=(const String& value)
+ {
+ assign(value);
+
+ return *this;
+ }
+
+ operator const String&() const
+ {
+ return _ref;
+ }
+
+ void assign(const String& value)
+ {
+ _ref.assign(value);
+ }
+
+protected:
+ String& _ref;
+};
+
+
#ifdef _MSC_VER
#pragma warning(disable: 4355)
#endif