diff options
Diffstat (limited to 'libxsd/xsd/cxx')
-rw-r--r-- | libxsd/xsd/cxx/tree/type-factory-map.hxx | 7 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/type-factory-map.txx | 16 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/type-serializer-map.hxx | 5 | ||||
-rw-r--r-- | libxsd/xsd/cxx/tree/type-serializer-map.txx | 11 | ||||
-rw-r--r-- | libxsd/xsd/cxx/xml/char-utf8.txx | 12 | ||||
-rw-r--r-- | libxsd/xsd/cxx/xml/dom/parsing-source.hxx | 1 | ||||
-rw-r--r-- | libxsd/xsd/cxx/xml/dom/parsing-source.txx | 36 | ||||
-rw-r--r-- | libxsd/xsd/cxx/xml/dom/serialization-source.txx | 33 |
8 files changed, 77 insertions, 44 deletions
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/xml/char-utf8.txx b/libxsd/xsd/cxx/xml/char-utf8.txx index a571ce9..76bba86 100644 --- a/libxsd/xsd/cxx/xml/char-utf8.txx +++ b/libxsd/xsd/cxx/xml/char-utf8.txx @@ -220,7 +220,7 @@ namespace xsd // u = (c & 0x1F) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -235,7 +235,7 @@ namespace xsd // u = (c & 0x0F) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -243,7 +243,7 @@ namespace xsd } u = (u | (c & 0x3F)) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -258,7 +258,7 @@ namespace xsd // u = (c & 0x07) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -266,7 +266,7 @@ namespace xsd } u = (u | (c & 0x3F)) << 6; - c = *++p; + c = static_cast<unsigned char> (*++p); if ((c >> 6) != 2) { valid = false; @@ -274,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/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-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); |