diff options
Diffstat (limited to 'libxsd/xsd/cxx')
20 files changed, 275 insertions, 80 deletions
diff --git a/libxsd/xsd/cxx/parser/expat/elements.hxx b/libxsd/xsd/cxx/parser/expat/elements.hxx index 5ed41f3..bd0b84c 100644 --- a/libxsd/xsd/cxx/parser/expat/elements.hxx +++ b/libxsd/xsd/cxx/parser/expat/elements.hxx @@ -86,6 +86,12 @@ namespace xsd return parser_; } + void + reset (XML_Parser parser) + { + *this = parser; + } + private: parser_auto_ptr (const parser_auto_ptr&); diff --git a/libxsd/xsd/cxx/parser/expat/elements.txx b/libxsd/xsd/cxx/parser/expat/elements.txx index a1b1beb..803c53c 100644 --- a/libxsd/xsd/cxx/parser/expat/elements.txx +++ b/libxsd/xsd/cxx/parser/expat/elements.txx @@ -312,7 +312,7 @@ namespace xsd if (XML_Parse (parser.get (), buf, - is.gcount (), + static_cast<int> (is.gcount ()), is.eof ()) == XML_STATUS_ERROR) { r = false; @@ -337,7 +337,8 @@ namespace xsd // if (auto_xml_parser_.get () == 0) { - auto_xml_parser_ = XML_ParserCreateNS (0, XML_Char (' ')); + auto_xml_parser_.reset ( + XML_ParserCreateNS (0, XML_Char (' '))); if (auto_xml_parser_.get () == 0) throw std::bad_alloc (); diff --git a/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx b/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx index 5ef2455..7bf2523 100644 --- a/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx +++ b/libxsd/xsd/cxx/parser/validating/xml-schema-pimpl.txx @@ -5,6 +5,7 @@ #include <locale> #ifdef XSD_CXX11 +# include <cmath> // std::isfinite # include <utility> // std::move #endif @@ -716,9 +717,13 @@ namespace xsd zc_istream<C> is (str); is.imbue (std::locale::classic ()); - //@@ TODO: now we accept scientific notations and INF/NaN. + // Note that std::isfinite() returns false for INF/NaN. // +#ifdef XSD_CXX11 + if (!(is >> value_ && std::isfinite (value_) && is.exhausted ())) +#else if (!(is >> value_ && is.exhausted ())) +#endif throw invalid_value<C> (bits::decimal<C> (), str); } diff --git a/libxsd/xsd/cxx/tree/containers.hxx b/libxsd/xsd/cxx/tree/containers.hxx index f6a24ff..3e26ca3 100644 --- a/libxsd/xsd/cxx/tree/containers.hxx +++ b/libxsd/xsd/cxx/tree/containers.hxx @@ -858,6 +858,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + sequence& + operator= (const sequence&) = default; +#endif + public: void assign (size_type n, const T& x) @@ -1090,7 +1095,7 @@ namespace xsd } // Note that the container object of the two sequences being - // swapped should be the same. + // swapped should be the same. // void swap (sequence& x) @@ -1132,6 +1137,11 @@ namespace xsd : base_sequence (s) { } + +#ifdef XSD_CXX11 + sequence& + operator= (const sequence&) = default; +#endif }; diff --git a/libxsd/xsd/cxx/tree/date-time.hxx b/libxsd/xsd/cxx/tree/date-time.hxx index eb9efce..d5d06ec 100644 --- a/libxsd/xsd/cxx/tree/date-time.hxx +++ b/libxsd/xsd/cxx/tree/date-time.hxx @@ -210,6 +210,11 @@ namespace xsd */ gday (const gday& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + gday& + operator= (const gday&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -371,6 +376,11 @@ namespace xsd */ gmonth (const gmonth& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + gmonth& + operator= (const gmonth&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -532,6 +542,11 @@ namespace xsd */ gyear (const gyear& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + gyear& + operator= (const gyear&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -696,6 +711,11 @@ namespace xsd */ gmonth_day (const gmonth_day& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + gmonth_day& + operator= (const gmonth_day&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -880,6 +900,11 @@ namespace xsd */ gyear_month (const gyear_month& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + gyear_month& + operator= (const gyear_month&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -1068,6 +1093,11 @@ namespace xsd */ date (const date& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + date& + operator= (const date&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -1269,6 +1299,11 @@ namespace xsd */ time (const time& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + time& + operator= (const time&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -1493,6 +1528,11 @@ namespace xsd virtual date_time* _clone (flags f = 0, container* c = 0) const; +#ifdef XSD_CXX11 + date_time& + operator= (const date_time&) = default; +#endif + /** * @brief Create an instance from a data representation * stream. @@ -1723,6 +1763,11 @@ namespace xsd */ duration (const duration& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + duration& + operator= (const duration&) = default; +#endif + /** * @brief Copy the instance polymorphically. * diff --git a/libxsd/xsd/cxx/tree/elements.hxx b/libxsd/xsd/cxx/tree/elements.hxx index 808b35e..cff1ada 100644 --- a/libxsd/xsd/cxx/tree/elements.hxx +++ b/libxsd/xsd/cxx/tree/elements.hxx @@ -235,6 +235,8 @@ namespace xsd std::size_t index; }; + //@cond + bool operator== (const content_order&, const content_order&); @@ -244,8 +246,6 @@ namespace xsd bool operator< (const content_order&, const content_order&); - //@cond - // DOM user data keys. // template <int dummy> @@ -458,7 +458,9 @@ namespace xsd // anyType content API. // public: + //@cond typedef element_optional dom_content_optional; + //@endcond /** * @brief Return a read-only (constant) reference to the anyType @@ -1198,10 +1200,10 @@ namespace xsd dom_content_optional dom; }; - //@endcond - mutable XSD_AUTO_PTR<content_type> content_; + //@endcond + private: container* container_; }; @@ -1252,6 +1254,11 @@ namespace xsd */ simple_type (const simple_type& x, flags f = 0, container* c = 0); +#ifdef XSD_CXX11 + simple_type& + operator= (const simple_type&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -1615,6 +1622,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + fundamental_base& + operator= (const fundamental_base&) = default; +#endif + /** * @brief Copy the instance polymorphically. * diff --git a/libxsd/xsd/cxx/tree/list.hxx b/libxsd/xsd/cxx/tree/list.hxx index f83297a..c44c882 100644 --- a/libxsd/xsd/cxx/tree/list.hxx +++ b/libxsd/xsd/cxx/tree/list.hxx @@ -62,6 +62,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + list& + operator= (const list&) = default; +#endif + public: list (const xercesc::DOMElement&, flags = 0, container* c = 0); @@ -112,6 +117,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + list& + operator= (const list&) = default; +#endif + public: list (const xercesc::DOMElement&, flags = 0, container* c = 0); diff --git a/libxsd/xsd/cxx/tree/type-factory-map.hxx b/libxsd/xsd/cxx/tree/type-factory-map.hxx index e20acfe..d52982f 100644 --- a/libxsd/xsd/cxx/tree/type-factory-map.hxx +++ b/libxsd/xsd/cxx/tree/type-factory-map.hxx @@ -150,11 +150,14 @@ namespace xsd // // - template<unsigned long id, typename C, typename T> + template<unsigned long id, typename C> struct element_factory_initializer { + typedef typename type_factory_map<C>::factory factory; + element_factory_initializer (const C* root_name, const C* root_ns, - const C* subst_name, const C* subst_ns); + const C* subst_name, const C* subst_ns, + factory); ~element_factory_initializer (); diff --git a/libxsd/xsd/cxx/tree/type-factory-map.txx b/libxsd/xsd/cxx/tree/type-factory-map.txx index 1eddb25..5a9dc38 100644 --- a/libxsd/xsd/cxx/tree/type-factory-map.txx +++ b/libxsd/xsd/cxx/tree/type-factory-map.txx @@ -302,6 +302,9 @@ namespace xsd if (i != element_map_.end ()) { + // Note that we may find an abstract element in which case the + // returned factory will be NULL. + // f = find_substitution (i->second, qn); } } @@ -455,21 +458,22 @@ namespace xsd // // - template<unsigned long id, typename C, typename T> - element_factory_initializer<id, C, T>:: + template<unsigned long id, typename C> + element_factory_initializer<id, C>:: element_factory_initializer (const C* root_name, const C* root_ns, - const C* subst_name, const C* subst_ns) + const C* subst_name, const C* subst_ns, + factory f) : root_name_ (root_name), root_ns_ (root_ns), subst_name_ (subst_name), subst_ns_ (subst_ns) { type_factory_map_instance<id, C> ().register_element ( xml::qualified_name<C> (root_name, root_ns), xml::qualified_name<C> (subst_name, subst_ns), - &factory_impl<T>); + f); } - template<unsigned long id, typename C, typename T> - element_factory_initializer<id, C, T>:: + template<unsigned long id, typename C> + element_factory_initializer<id, C>:: ~element_factory_initializer () { type_factory_map_instance<id, C> ().unregister_element ( diff --git a/libxsd/xsd/cxx/tree/type-serializer-map.hxx b/libxsd/xsd/cxx/tree/type-serializer-map.hxx index 38b2fb9..50869b5 100644 --- a/libxsd/xsd/cxx/tree/type-serializer-map.hxx +++ b/libxsd/xsd/cxx/tree/type-serializer-map.hxx @@ -216,8 +216,11 @@ namespace xsd template<unsigned long id, typename C, typename T> struct element_serializer_initializer { + typedef typename type_serializer_map<C>::serializer serializer; + element_serializer_initializer (const C* root_name, const C* root_ns, - const C* subst_name, const C* subst_ns); + const C* subst_name, const C* subst_ns, + serializer); ~element_serializer_initializer (); diff --git a/libxsd/xsd/cxx/tree/type-serializer-map.txx b/libxsd/xsd/cxx/tree/type-serializer-map.txx index 1acdad2..a6c690a 100644 --- a/libxsd/xsd/cxx/tree/type-serializer-map.txx +++ b/libxsd/xsd/cxx/tree/type-serializer-map.txx @@ -550,14 +550,21 @@ namespace xsd template<unsigned long id, typename C, typename T> element_serializer_initializer<id, C, T>:: element_serializer_initializer (const C* root_name, const C* root_ns, - const C* subst_name, const C* subst_ns) + const C* subst_name, const C* subst_ns, + serializer s) : root_name_ (root_name), root_ns_ (root_ns) { + // Note that we still have to use real typeid (instead of, say, NULL) + // for abstract elements to make sure we have separate entries for + // each of them. We can assume that such a typeid can never be looked + // up (since it's impossible to instantiate the corresponding abstract + // type). + // type_serializer_map_instance<id, C> ().register_element ( xml::qualified_name<C> (root_name, root_ns), xml::qualified_name<C> (subst_name, subst_ns), typeid (T), - &serializer_impl<T>); + s); } template<unsigned long id, typename C, typename T> diff --git a/libxsd/xsd/cxx/tree/types.hxx b/libxsd/xsd/cxx/tree/types.hxx index 3355eb0..0790997 100644 --- a/libxsd/xsd/cxx/tree/types.hxx +++ b/libxsd/xsd/cxx/tree/types.hxx @@ -268,6 +268,18 @@ namespace xsd base () = x; return *this; } + + public: + /** + * @brief Explicitly "cast" to the base string type. + * + * @return A const reference to the instance as the base string type. + */ + const std::basic_string<C>& + base_string () const + { + return *this; + } }; /** @@ -1078,6 +1090,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + nmtokens& + operator= (const nmtokens&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -2559,6 +2576,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + idrefs& + operator= (const idrefs&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -2867,6 +2889,18 @@ namespace xsd return *this; } + public: + /** + * @brief Explicitly "cast" to the base string type. + * + * @return A const reference to the instance as the base string type. + */ + const std::basic_string<C>& + base_string () const + { + return *this; + } + protected: //@cond @@ -2967,6 +3001,11 @@ namespace xsd // } +#ifdef XSD_CXX11 + qname& + operator= (const qname&) = default; +#endif + /** * @brief Copy the instance polymorphically. * @@ -3123,7 +3162,9 @@ namespace xsd class base64_binary: public B, public buffer<C> { public: + //@cond typedef typename buffer<C>::size_t size_t; + //@endcond public: /** @@ -3342,7 +3383,9 @@ namespace xsd class hex_binary: public B, public buffer<C> { public: + //@cond typedef typename buffer<C>::size_t size_t; + //@endcond public: /** @@ -3845,6 +3888,11 @@ namespace xsd { } +#ifdef XSD_CXX11 + entities& + operator= (const entities&) = default; +#endif + /** * @brief Copy the instance polymorphically. * diff --git a/libxsd/xsd/cxx/version.hxx b/libxsd/xsd/cxx/version.hxx index c2948c3..e69de29 100644 --- a/libxsd/xsd/cxx/version.hxx +++ b/libxsd/xsd/cxx/version.hxx @@ -1,27 +0,0 @@ -// file : xsd/cxx/version.hxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef XSD_CXX_VERSION_HXX -#define XSD_CXX_VERSION_HXX - -// Version format is AABBCCDD where -// -// AA - major version number -// BB - minor version number -// CC - bugfix version number -// DD - alpha / beta (DD + 50) version number -// -// When DD is not 00, 1 is subtracted from AABBCC. For example: -// -// Version AABBCCDD -// 2.0.0 02000000 -// 2.1.0 02010000 -// 2.1.1 02010100 -// 2.2.0.a1 02019901 -// 3.0.0.b2 02999952 -// - -#define XSD_STR_VERSION "4.1.0.a11" -#define XSD_INT_VERSION 4009911L - -#endif // XSD_CXX_VERSION_HXX diff --git a/libxsd/xsd/cxx/version.hxx.in b/libxsd/xsd/cxx/version.hxx.in new file mode 100644 index 0000000..7f2e17a --- /dev/null +++ b/libxsd/xsd/cxx/version.hxx.in @@ -0,0 +1,43 @@ +// file : xsd/cxx/version.hxx.in +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#ifndef LIBXSD_VERSION // Note: using the version macro itself. + +// The numeric version format is AAAAABBBBBCCCCCDDDE where: +// +// AAAAA - major version number +// BBBBB - minor version number +// CCCCC - bugfix version number +// DDD - alpha / beta (DDD + 500) version number +// E - final (0) / snapshot (1) +// +// When DDDE is not 0, 1 is subtracted from AAAAABBBBBCCCCC. For example: +// +// Version AAAAABBBBBCCCCCDDDE +// +// 0.1.0 0000000001000000000 +// 0.1.2 0000000001000020000 +// 1.2.3 0000100002000030000 +// 2.2.0-a.1 0000200001999990010 +// 3.0.0-b.2 0000299999999995020 +// 2.2.0-a.1.z 0000200001999990011 +// +#define LIBXSD_VERSION $libxsd.version.project_number$ULL +#define LIBXSD_VERSION_STR "$libxsd.version.project$" +#define LIBXSD_VERSION_ID "$libxsd.version.project_id$" +#define LIBXSD_VERSION_FULL "$libxsd.version$" + +#define LIBXSD_VERSION_MAJOR $libxsd.version.major$ +#define LIBXSD_VERSION_MINOR $libxsd.version.minor$ +#define LIBXSD_VERSION_PATCH $libxsd.version.patch$ + +#define LIBXSD_PRE_RELEASE $libxsd.version.pre_release$ + +#define LIBXSD_SNAPSHOT $libxsd.version.snapshot_sn$ULL +#define LIBXSD_SNAPSHOT_ID "$libxsd.version.snapshot_id$" + +// Note that Xerces and Expat compatibility is verified by the respective +// parsers (see parser/xerces/elements.hxx and parser/expat/elements.hxx for +// details). + +#endif // LIBXSD_VERSION diff --git a/libxsd/xsd/cxx/xml/char-utf8.txx b/libxsd/xsd/cxx/xml/char-utf8.txx index ba65397..76bba86 100644 --- a/libxsd/xsd/cxx/xml/char-utf8.txx +++ b/libxsd/xsd/cxx/xml/char-utf8.txx @@ -115,20 +115,24 @@ namespace xsd rs[i + 3] = C ((u | 0x80UL) & 0xBFUL); u >>= 6; } + // Fall through. case 3: { rs[i + 2] = C ((u | 0x80UL) & 0xBFUL); u >>= 6; } + // Fall through. case 2: { rs[i + 1] = C ((u | 0x80UL) & 0xBFUL); u >>= 6; } + // Fall through. case 1: { rs[i] = C (u | first_byte_mask_[count]); } + // Fall through. } i += count; @@ -216,7 +220,7 @@ namespace xsd // u = (c & 0x1F) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -231,7 +235,7 @@ namespace xsd // u = (c & 0x0F) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -239,7 +243,7 @@ namespace xsd } u = (u | (c & 0x3F)) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -254,7 +258,7 @@ namespace xsd // u = (c & 0x07) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -262,7 +266,7 @@ namespace xsd } u = (u | (c & 0x3F)) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -270,7 +274,7 @@ namespace xsd } u = (u | (c & 0x3F)) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; diff --git a/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx b/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx index 97c9399..256f824 100644 --- a/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx +++ b/libxsd/xsd/cxx/xml/dom/auto-ptr.hxx @@ -53,8 +53,11 @@ namespace xsd unique_ptr (unique_ptr&& p): base (std::move (p)) {} template <class T1> unique_ptr (unique_ptr<T1>&& p): base (std::move (p)) {} + +#if !defined(__cplusplus) || __cplusplus < 201703L template <class T1> unique_ptr (std::auto_ptr<T1>&& p): base (std::move (p)) {} +#endif unique_ptr& operator= (unique_ptr&& p) { diff --git a/libxsd/xsd/cxx/xml/dom/parsing-source.hxx b/libxsd/xsd/cxx/xml/dom/parsing-source.hxx index fc0bd71..e4cb37e 100644 --- a/libxsd/xsd/cxx/xml/dom/parsing-source.hxx +++ b/libxsd/xsd/cxx/xml/dom/parsing-source.hxx @@ -8,6 +8,7 @@ #include <xercesc/dom/DOMNode.hpp> #include <xercesc/dom/DOMAttr.hpp> +#include <xercesc/dom/DOMText.hpp> #include <xercesc/dom/DOMElement.hpp> #include <xercesc/dom/DOMDocument.hpp> #include <xercesc/dom/DOMNamedNodeMap.hpp> diff --git a/libxsd/xsd/cxx/xml/dom/parsing-source.txx b/libxsd/xsd/cxx/xml/dom/parsing-source.txx index 6543671..2a2d6e2 100644 --- a/libxsd/xsd/cxx/xml/dom/parsing-source.txx +++ b/libxsd/xsd/cxx/xml/dom/parsing-source.txx @@ -105,7 +105,10 @@ namespace xsd const properties<C>& prop, unsigned long flags) { - using namespace xercesc; + // Note: explicitly qualifying everything with xerces:: to avoid + // conflicts with MSXML. + // + using xercesc::XMLUni; // Instantiate the DOM parser. // @@ -115,13 +118,14 @@ namespace xsd // Get an implementation of the Load-Store (LS) interface. // - DOMImplementation* impl ( - DOMImplementationRegistry::getDOMImplementation (ls_id)); + xercesc::DOMImplementation* impl ( + xercesc::DOMImplementationRegistry::getDOMImplementation (ls_id)); - XSD_DOM_AUTO_PTR<DOMLSParser> parser ( - impl->createLSParser (DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + XSD_DOM_AUTO_PTR<xercesc::DOMLSParser> parser ( + impl->createLSParser ( + xercesc::DOMImplementationLS::MODE_SYNCHRONOUS, 0)); - DOMConfiguration* conf (parser->getDomConfig ()); + xercesc::DOMConfiguration* conf (parser->getDomConfig ()); // Discard comment nodes in the document. // @@ -216,7 +220,7 @@ namespace xsd xercesc::Wrapper4InputSource wrap (&is, false); - XSD_DOM_AUTO_PTR<DOMDocument> doc; + XSD_DOM_AUTO_PTR<xercesc::DOMDocument> doc; try { doc.reset (parser->parse (&wrap)); @@ -249,7 +253,10 @@ namespace xsd const properties<C>& prop, unsigned long flags) { - using namespace xercesc; + // Note: explicitly qualifying everything with xerces:: to avoid + // conflicts with MSXML. + // + using xercesc::XMLUni; // Instantiate the DOM parser. // @@ -259,13 +266,14 @@ namespace xsd // Get an implementation of the Load-Store (LS) interface. // - DOMImplementation* impl ( - DOMImplementationRegistry::getDOMImplementation (ls_id)); + xercesc::DOMImplementation* impl ( + xercesc::DOMImplementationRegistry::getDOMImplementation (ls_id)); - XSD_DOM_AUTO_PTR<DOMLSParser> parser ( - impl->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, 0)); + XSD_DOM_AUTO_PTR<xercesc::DOMLSParser> parser ( + impl->createLSParser( + xercesc::DOMImplementationLS::MODE_SYNCHRONOUS, 0)); - DOMConfiguration* conf (parser->getDomConfig ()); + xercesc::DOMConfiguration* conf (parser->getDomConfig ()); // Discard comment nodes in the document. // @@ -359,7 +367,7 @@ namespace xsd bits::error_handler_proxy<C> ehp (eh); conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); - XSD_DOM_AUTO_PTR<DOMDocument> doc; + XSD_DOM_AUTO_PTR<xercesc::DOMDocument> doc; try { doc.reset (parser->parseURI (string (uri).c_str ())); diff --git a/libxsd/xsd/cxx/xml/dom/serialization-header.txx b/libxsd/xsd/cxx/xml/dom/serialization-header.txx index 997dfe9..4b9ebdd 100644 --- a/libxsd/xsd/cxx/xml/dom/serialization-header.txx +++ b/libxsd/xsd/cxx/xml/dom/serialization-header.txx @@ -174,7 +174,9 @@ namespace xsd atts.push_back (a); } - for (std::vector<DOMAttr*>::iterator i (atts.begin ()), + // Qualify DOMAttr to work around MSVC 16.11 /std:c++20 issue. + // + for (std::vector<xercesc::DOMAttr*>::iterator i (atts.begin ()), end (atts.end ()); i != end; ++i) { e.removeAttributeNode (*i); diff --git a/libxsd/xsd/cxx/xml/dom/serialization-source.txx b/libxsd/xsd/cxx/xml/dom/serialization-source.txx index b59e109..e663d7b 100644 --- a/libxsd/xsd/cxx/xml/dom/serialization-source.txx +++ b/libxsd/xsd/cxx/xml/dom/serialization-source.txx @@ -109,7 +109,10 @@ namespace xsd add_namespaces (xercesc::DOMElement& el, const namespace_infomap<C>& map) { - using namespace xercesc; + // Note: explicitly qualifying everything with xerces:: to avoid + // conflicts with MSXML. + // + using xercesc::XMLUni; typedef std::basic_string<C> string; typedef namespace_infomap<C> infomap; @@ -159,14 +162,14 @@ namespace xsd // if (!i->second.name.empty ()) el.setAttributeNS ( - xercesc::XMLUni::fgXMLNSURIName, + XMLUni::fgXMLNSURIName, xml::string (xmlns_prefix).c_str (), xml::string (i->second.name).c_str ()); } else { el.setAttributeNS ( - xercesc::XMLUni::fgXMLNSURIName, + XMLUni::fgXMLNSURIName, xml::string (xmlns_prefix + colon + i->first).c_str (), xml::string (i->second.name).c_str ()); } @@ -236,7 +239,8 @@ namespace xsd const namespace_infomap<C>& map, unsigned long) { - using namespace xercesc; + // Note: explicitly qualifying everything with xerces:: to avoid + // conflicts with MSXML. typedef std::basic_string<C> string; typedef namespace_infomap<C> infomap; @@ -268,10 +272,10 @@ namespace xsd xercesc::chLatin_S, xercesc::chNull}; - DOMImplementation* impl ( - DOMImplementationRegistry::getDOMImplementation (ls)); + xercesc::DOMImplementation* impl ( + xercesc::DOMImplementationRegistry::getDOMImplementation (ls)); - XSD_DOM_AUTO_PTR<DOMDocument> doc ( + XSD_DOM_AUTO_PTR<xercesc::DOMDocument> doc ( impl->createDocument ( (ns.empty () ? 0 : xml::string (ns).c_str ()), xml::string ((prefix.empty () @@ -293,21 +297,24 @@ namespace xsd xercesc::DOMErrorHandler& eh, unsigned long flags) { - using namespace xercesc; + // Note: explicitly qualifying everything with xerces:: to avoid + // conflicts with MSXML. + // + using xercesc::XMLUni; const XMLCh ls[] = {xercesc::chLatin_L, xercesc::chLatin_S, xercesc::chNull}; - DOMImplementation* impl ( - DOMImplementationRegistry::getDOMImplementation (ls)); + xercesc::DOMImplementation* impl ( + xercesc::DOMImplementationRegistry::getDOMImplementation (ls)); bits::error_handler_proxy<C> ehp (eh); - XSD_DOM_AUTO_PTR<DOMLSSerializer> writer ( + XSD_DOM_AUTO_PTR<xercesc::DOMLSSerializer> writer ( impl->createLSSerializer ()); - DOMConfiguration* conf (writer->getDomConfig ()); + xercesc::DOMConfiguration* conf (writer->getDomConfig ()); conf->setParameter (XMLUni::fgDOMErrorHandler, &ehp); @@ -334,7 +341,7 @@ namespace xsd conf->canSetParameter (XMLUni::fgDOMXMLDeclaration, false)) conf->setParameter (XMLUni::fgDOMXMLDeclaration, false); - XSD_DOM_AUTO_PTR<DOMLSOutput> out (impl->createLSOutput ()); + XSD_DOM_AUTO_PTR<xercesc::DOMLSOutput> out (impl->createLSOutput ()); out->setEncoding (xml::string (encoding).c_str ()); out->setByteStream (&target); |