more template stuff

This commit is contained in:
jez 2007-09-06 10:51:50 +00:00
parent 77c2d74398
commit 905d680b3d
2 changed files with 126 additions and 132 deletions

View file

@ -39,11 +39,11 @@ namespace SAX
std::auto_ptr<XMLPScanTokenParserImpl> data_; std::auto_ptr<XMLPScanTokenParserImpl> data_;
}; // XMLPScanToken }; // XMLPScanToken
template<class string_type, class string_adaptor> template<class string_type, class T0, class T1>
class ProgressiveParser : public XMLReaderInterface<string_type, string_adaptor> class ProgressiveParser : public XMLReaderInterface<string_type, T0, T1>
{ {
public: public:
typedef typename XMLReaderInterface<string_type, string_adaptor>::InputSourceT InputSourceT; typedef typename XMLReaderInterface<string_type, T0, T1>::InputSourceT InputSourceT;
/** @name Progressive Parsing Methods */ /** @name Progressive Parsing Methods */
//@{ //@{

View file

@ -122,31 +122,25 @@ namespace XercesImpl
template<class string_type, template<class string_type,
class T0 = Arabica::nil_t, class T0 = Arabica::nil_t,
class T1 = Arabica::nil_t> class T1 = Arabica::nil_t>
class xerces_wrapper : public SAX::ProgressiveParser<string_type> class xerces_wrapper : public ProgressiveParser<string_type, T0, T1>
{ {
private: private:
typedef typename Arabica::get_param<Arabica::string_adaptor_tag, typedef XMLReaderInterface<string_type, T0, T1> XMLReaderT;
Arabica::default_string_adaptor<string_type>, typedef typename XMLReaderT::string_adaptor string_adaptor;
T0,
T1>::type string_adaptor_type;
typedef string_adaptor_type string_adaptorT;
protected:
typedef SAX::XMLReaderInterface<string_type> base;
public: public:
typedef typename base::EntityResolverT EntityResolverT; typedef typename XMLReaderT::EntityResolverT EntityResolverT;
typedef typename base::DTDHandlerT DTDHandlerT; typedef typename XMLReaderT::DTDHandlerT DTDHandlerT;
typedef typename base::ContentHandlerT ContentHandlerT; typedef typename XMLReaderT::ContentHandlerT ContentHandlerT;
typedef typename base::InputSourceT InputSourceT; typedef typename XMLReaderT::InputSourceT InputSourceT;
typedef SAX::LexicalHandler<string_type> LexicalHandlerT; typedef LexicalHandler<string_type, string_adaptor> LexicalHandlerT;
typedef SAX::Locator<string_type> LocatorT; typedef Locator<string_type, string_adaptor> LocatorT;
typedef SAX::Attributes<string_type> AttributesT; typedef Attributes<string_type, string_adaptor> AttributesT;
typedef SAX::DeclHandler<string_type> DeclHandlerT; typedef DeclHandler<string_type, string_adaptor> DeclHandlerT;
typedef SAX::ErrorHandler<string_type> ErrorHandlerT; typedef ErrorHandler<string_type, string_adaptor> ErrorHandlerT;
typedef typename ErrorHandlerT::SAXParseExceptionT SAXParseExceptionT; typedef typename ErrorHandlerT::SAXParseExceptionT SAXParseExceptionT;
typedef SAX::XercesFeatureNames<string_type, string_adaptorT> featuresT; typedef SAX::XercesFeatureNames<string_type, string_adaptor> featuresT;
xerces_wrapper(); xerces_wrapper();
virtual ~xerces_wrapper(); virtual ~xerces_wrapper();
@ -196,8 +190,8 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
//@} //@}
protected: protected:
virtual std::auto_ptr<typename base::PropertyBase> doGetProperty(const string_type& name); virtual std::auto_ptr<typename XMLReaderT::PropertyBase> doGetProperty(const string_type& name);
virtual void doSetProperty(const string_type& name, std::auto_ptr<typename base::PropertyBase> value); virtual void doSetProperty(const string_type& name, std::auto_ptr<typename XMLReaderT::PropertyBase> value);
private: private:
/////////////////////////////// ///////////////////////////////
@ -228,11 +222,11 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
xerces_string_janitor& operator=(const xerces_string_janitor&) const; xerces_string_janitor& operator=(const xerces_string_janitor&) const;
}; // class xerces_string_janitor }; // class xerces_string_janitor
class xerces_string_adaptor : public string_adaptorT class xerces_string_adaptor : public string_adaptor
{ {
public: public:
typedef typename string_adaptorT::value_type value_type; typedef typename string_adaptor::value_type value_type;
typedef string_adaptorT base; typedef string_adaptor base;
#ifndef ARABICA_NO_WCHAR_T #ifndef ARABICA_NO_WCHAR_T
static string_type makeStringT(const XMLCh* str) static string_type makeStringT(const XMLCh* str)
@ -307,7 +301,7 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
}; // class xerces_string_adaptor }; // class xerces_string_adaptor
typedef xerces_string_adaptor SA; typedef xerces_string_adaptor XSA;
/////////////////////////////// ///////////////////////////////
// Adaptors // Adaptors
@ -331,7 +325,7 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
if(!locator_) if(!locator_)
return string_type(); return string_type();
return SA::makeStringT(locator_->getSystemId()); return XSA::makeStringT(locator_->getSystemId());
} // getSystemId } // getSystemId
int getLineNumber() const int getLineNumber() const
@ -380,14 +374,14 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
InputSourceT source; InputSourceT source;
if(entityResolverHandler_) if(entityResolverHandler_)
{ {
source = entityResolverHandler_->resolveEntity(SA::makeStringT(publicId), source = entityResolverHandler_->resolveEntity(XSA::makeStringT(publicId),
SA::makeStringT(systemId)); XSA::makeStringT(systemId));
} }
// If all of these are empty, the EntityResolver has requested that we // If all of these are empty, the EntityResolver has requested that we
// use the default entity resolver. // use the default entity resolver.
if ((source.getByteStream() == 0) && if ((source.getByteStream() == 0) &&
(SA::empty(source.getPublicId())) && (XSA::empty(source.getPublicId())) &&
(SA::empty(source.getSystemId()))) (XSA::empty(source.getSystemId())))
{ {
// Xerces-C takes a NULL (0) return to mean "use the default entity // Xerces-C takes a NULL (0) return to mean "use the default entity
// resolver". // resolver".
@ -417,9 +411,9 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
const XMLCh* const systemId) const XMLCh* const systemId)
{ {
if(dtdHandler_) if(dtdHandler_)
dtdHandler_->notationDecl(SA::makeStringT(name), dtdHandler_->notationDecl(XSA::makeStringT(name),
SA::makeStringT(publicId), XSA::makeStringT(publicId),
SA::makeStringT(systemId)); XSA::makeStringT(systemId));
} // notationDecl } // notationDecl
virtual void unparsedEntityDecl(const XMLCh* const name, virtual void unparsedEntityDecl(const XMLCh* const name,
const XMLCh* const publicId, const XMLCh* const publicId,
@ -427,10 +421,10 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
const XMLCh* const notationName) const XMLCh* const notationName)
{ {
if(dtdHandler_) if(dtdHandler_)
dtdHandler_->unparsedEntityDecl(SA::makeStringT(name), dtdHandler_->unparsedEntityDecl(XSA::makeStringT(name),
SA::makeStringT(publicId), XSA::makeStringT(publicId),
SA::makeStringT(systemId), XSA::makeStringT(systemId),
SA::makeStringT(notationName)); XSA::makeStringT(notationName));
} // unparsedEntityDecl } // unparsedEntityDecl
virtual void resetDocType() virtual void resetDocType()
@ -473,13 +467,13 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
virtual void startPrefixMapping(const XMLCh* const prefix, const XMLCh* const uri) virtual void startPrefixMapping(const XMLCh* const prefix, const XMLCh* const uri)
{ {
if(contentHandler_) if(contentHandler_)
contentHandler_->startPrefixMapping(SA::makeStringT(prefix), SA::makeStringT(uri)); contentHandler_->startPrefixMapping(XSA::makeStringT(prefix), XSA::makeStringT(uri));
} // startPrefixMapping } // startPrefixMapping
virtual void endPrefixMapping(const XMLCh* const prefix) virtual void endPrefixMapping(const XMLCh* const prefix)
{ {
if(contentHandler_) if(contentHandler_)
contentHandler_->endPrefixMapping(SA::makeStringT(prefix)); contentHandler_->endPrefixMapping(XSA::makeStringT(prefix));
} // endPrefixMapping } // endPrefixMapping
virtual void startElement(const XMLCh* const namespaceUri, virtual void startElement(const XMLCh* const namespaceUri,
@ -490,9 +484,9 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
if(contentHandler_) if(contentHandler_)
{ {
AttributesAdaptor attrAdaptor(attrs); AttributesAdaptor attrAdaptor(attrs);
contentHandler_->startElement(SA::makeStringT(namespaceUri), contentHandler_->startElement(XSA::makeStringT(namespaceUri),
SA::makeStringT(localName), XSA::makeStringT(localName),
SA::makeStringT(rawName), XSA::makeStringT(rawName),
attrAdaptor); attrAdaptor);
} // if ... } // if ...
} // startElement } // startElement
@ -502,35 +496,35 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
const XMLCh* const rawName) const XMLCh* const rawName)
{ {
if(contentHandler_) if(contentHandler_)
contentHandler_->endElement(SA::makeStringT(namespaceUri), contentHandler_->endElement(XSA::makeStringT(namespaceUri),
SA::makeStringT(localName), XSA::makeStringT(localName),
SA::makeStringT(rawName)); XSA::makeStringT(rawName));
} // endElement } // endElement
virtual void characters(const XMLCh* const chars, const unsigned int length) virtual void characters(const XMLCh* const chars, const unsigned int length)
{ {
if(contentHandler_) if(contentHandler_)
contentHandler_->characters(SA::makeStringT(chars, length)); contentHandler_->characters(XSA::makeStringT(chars, length));
} // characters } // characters
virtual void ignorableWhitespace(const XMLCh* const chars, const unsigned int length) virtual void ignorableWhitespace(const XMLCh* const chars, const unsigned int length)
{ {
if(contentHandler_) if(contentHandler_)
contentHandler_->ignorableWhitespace(SA::makeStringT(chars, length)); contentHandler_->ignorableWhitespace(XSA::makeStringT(chars, length));
} // ignorableWhitespace } // ignorableWhitespace
virtual void processingInstruction(const XMLCh* const target, virtual void processingInstruction(const XMLCh* const target,
const XMLCh* const data) const XMLCh* const data)
{ {
if(contentHandler_) if(contentHandler_)
contentHandler_->processingInstruction(SA::makeStringT(target), contentHandler_->processingInstruction(XSA::makeStringT(target),
SA::makeStringT(data)); XSA::makeStringT(data));
} // processingInstruction } // processingInstruction
virtual void skippedEntity(const XMLCh* const name) virtual void skippedEntity(const XMLCh* const name)
{ {
if(contentHandler_) if(contentHandler_)
contentHandler_->skippedEntity(SA::makeStringT(name)); contentHandler_->skippedEntity(XSA::makeStringT(name));
} // skippedEntity } // skippedEntity
private: private:
@ -555,59 +549,59 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
} // getLength } // getLength
virtual string_type getURI(unsigned int index) const virtual string_type getURI(unsigned int index) const
{ {
return SA::makeStringT(attributes_.getURI(index)); return XSA::makeStringT(attributes_.getURI(index));
} // getURI } // getURI
virtual string_type getLocalName(unsigned int index) const virtual string_type getLocalName(unsigned int index) const
{ {
return SA::makeStringT(attributes_.getLocalName(index)); return XSA::makeStringT(attributes_.getLocalName(index));
} // getLocalName } // getLocalName
virtual string_type getQName(unsigned int index) const virtual string_type getQName(unsigned int index) const
{ {
return SA::makeStringT(attributes_.getQName(index)); return XSA::makeStringT(attributes_.getQName(index));
} // getQName } // getQName
virtual string_type getType(unsigned int index) const virtual string_type getType(unsigned int index) const
{ {
return SA::makeStringT(attributes_.getType(index)); return XSA::makeStringT(attributes_.getType(index));
} // getType } // getType
virtual string_type getValue(unsigned int index) const virtual string_type getValue(unsigned int index) const
{ {
return SA::makeStringT(attributes_.getValue(index)); return XSA::makeStringT(attributes_.getValue(index));
} // getValue } // getValue
///////////////////////// /////////////////////////
// name based query // name based query
virtual int getIndex(const string_type& uri, const string_type& localName) const virtual int getIndex(const string_type& uri, const string_type& localName) const
{ {
xerces_string_janitor<XMLCh> wUri(SA::asXMLChString(uri)); xerces_string_janitor<XMLCh> wUri(XSA::asXMLChString(uri));
xerces_string_janitor<XMLCh> wLocalName(SA::asXMLChString(localName)); xerces_string_janitor<XMLCh> wLocalName(XSA::asXMLChString(localName));
return attributes_.getIndex(wUri.get(), wLocalName.get()); return attributes_.getIndex(wUri.get(), wLocalName.get());
} // getIndex } // getIndex
virtual int getIndex(const string_type& qName) const virtual int getIndex(const string_type& qName) const
{ {
xerces_string_janitor<XMLCh> wQName(SA::asXMLChString(qName)); xerces_string_janitor<XMLCh> wQName(XSA::asXMLChString(qName));
return attributes_.getIndex(wQName.get()); return attributes_.getIndex(wQName.get());
} // getIndex } // getIndex
virtual string_type getType(const string_type& uri, const string_type& localName) const virtual string_type getType(const string_type& uri, const string_type& localName) const
{ {
xerces_string_janitor<XMLCh> wUri(SA::asXMLChString(uri)); xerces_string_janitor<XMLCh> wUri(XSA::asXMLChString(uri));
xerces_string_janitor<XMLCh> wLocalName(SA::asXMLChString(localName)); xerces_string_janitor<XMLCh> wLocalName(XSA::asXMLChString(localName));
return SA::makeStringT(attributes_.getType(wUri.get(), wLocalName.get())); return XSA::makeStringT(attributes_.getType(wUri.get(), wLocalName.get()));
} // getType } // getType
virtual string_type getType(const string_type& qName) const virtual string_type getType(const string_type& qName) const
{ {
xerces_string_janitor<XMLCh> wQName(SA::asXMLChString(qName)); xerces_string_janitor<XMLCh> wQName(XSA::asXMLChString(qName));
return SA::makeStringT(attributes_.getType(wQName.get())); return XSA::makeStringT(attributes_.getType(wQName.get()));
} // getType } // getType
virtual string_type getValue(const string_type& uri, const string_type& localName) const virtual string_type getValue(const string_type& uri, const string_type& localName) const
{ {
xerces_string_janitor<XMLCh> wUri(SA::asXMLChString(uri)); xerces_string_janitor<XMLCh> wUri(XSA::asXMLChString(uri));
xerces_string_janitor<XMLCh> wLocalName(SA::asXMLChString(localName)); xerces_string_janitor<XMLCh> wLocalName(XSA::asXMLChString(localName));
return SA::makeStringT(attributes_.getValue(wUri.get(), wLocalName.get())); return XSA::makeStringT(attributes_.getValue(wUri.get(), wLocalName.get()));
} // getValue } // getValue
virtual string_type getValue(const string_type& qname) const virtual string_type getValue(const string_type& qname) const
{ {
xerces_string_janitor<XMLCh> wQName(SA::asXMLChString(qname)); xerces_string_janitor<XMLCh> wQName(XSA::asXMLChString(qname));
return SA::makeStringT(attributes_.getValue(wQName.get())); return XSA::makeStringT(attributes_.getValue(wQName.get()));
} // getValue } // getValue
private: private:
@ -654,10 +648,10 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
if(!errorHandler_) if(!errorHandler_)
return; return;
string_type errorMsg(SA::makeStringT(exception.getMessage())); string_type errorMsg(XSA::makeStringT(exception.getMessage()));
string_type publicId(SA::makeStringT(exception.getPublicId())); string_type publicId(XSA::makeStringT(exception.getPublicId()));
string_type systemId(SA::makeStringT(exception.getSystemId())); string_type systemId(XSA::makeStringT(exception.getSystemId()));
SAXParseExceptionT sp(SA::asStdString(errorMsg), SAXParseExceptionT sp(XSA::asStdString(errorMsg),
publicId, publicId,
systemId, systemId,
exception.getLineNumber(), exception.getLineNumber(),
@ -682,9 +676,9 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
const XMLCh* const systemId) const XMLCh* const systemId)
{ {
if(lexicalHandler_) if(lexicalHandler_)
lexicalHandler_->startDTD(SA::makeStringT(name), lexicalHandler_->startDTD(XSA::makeStringT(name),
SA::makeStringT(publicId), XSA::makeStringT(publicId),
SA::makeStringT(systemId)); XSA::makeStringT(systemId));
} // startDTD } // startDTD
virtual void endDTD() virtual void endDTD()
@ -696,13 +690,13 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
virtual void startEntity(const XMLCh* const name) virtual void startEntity(const XMLCh* const name)
{ {
if(lexicalHandler_) if(lexicalHandler_)
lexicalHandler_->startEntity(SA::makeStringT(name)); lexicalHandler_->startEntity(XSA::makeStringT(name));
} // startEntity } // startEntity
virtual void endEntity(const XMLCh* const name) virtual void endEntity(const XMLCh* const name)
{ {
if(lexicalHandler_) if(lexicalHandler_)
lexicalHandler_->endEntity(SA::makeStringT(name)); lexicalHandler_->endEntity(XSA::makeStringT(name));
} // endEntity } // endEntity
virtual void startCDATA() virtual void startCDATA()
@ -720,7 +714,7 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
virtual void comment(const XMLCh* const chars, const unsigned int length) virtual void comment(const XMLCh* const chars, const unsigned int length)
{ {
if(lexicalHandler_) if(lexicalHandler_)
lexicalHandler_->comment(SA::makeStringT(chars, length)); lexicalHandler_->comment(XSA::makeStringT(chars, length));
} // comment } // comment
private: private:
@ -740,8 +734,8 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
const XMLCh* const model) const XMLCh* const model)
{ {
if(declHandler_) if(declHandler_)
declHandler_->elementDecl(SA::makeStringT(name), declHandler_->elementDecl(XSA::makeStringT(name),
SA::makeStringT(model)); XSA::makeStringT(model));
} // elementDecl } // elementDecl
virtual void attributeDecl(const XMLCh* const elementName, virtual void attributeDecl(const XMLCh* const elementName,
@ -755,11 +749,11 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
const XMLCh* tmpValueDefault = valueDefault; const XMLCh* tmpValueDefault = valueDefault;
if (tmpValueDefault == XERCES_CPP_NAMESPACE::XMLUni::fgNullString) if (tmpValueDefault == XERCES_CPP_NAMESPACE::XMLUni::fgNullString)
tmpValueDefault = 0; tmpValueDefault = 0;
declHandler_->attributeDecl(SA::makeStringT(elementName), declHandler_->attributeDecl(XSA::makeStringT(elementName),
SA::makeStringT(attributeName), XSA::makeStringT(attributeName),
SA::makeStringT(type), XSA::makeStringT(type),
SA::makeStringT(tmpValueDefault), XSA::makeStringT(tmpValueDefault),
SA::makeStringT(value)); XSA::makeStringT(value));
} }
} // attributeDecl } // attributeDecl
@ -767,8 +761,8 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
const XMLCh* const value) const XMLCh* const value)
{ {
if(declHandler_) if(declHandler_)
declHandler_->internalEntityDecl(SA::makeStringT(name), declHandler_->internalEntityDecl(XSA::makeStringT(name),
SA::makeStringT(value)); XSA::makeStringT(value));
} // internalEntityDecl } // internalEntityDecl
virtual void externalEntityDecl(const XMLCh* const name, virtual void externalEntityDecl(const XMLCh* const name,
@ -776,9 +770,9 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
const XMLCh* const systemId) const XMLCh* const systemId)
{ {
if(declHandler_) if(declHandler_)
declHandler_->externalEntityDecl(SA::makeStringT(name), declHandler_->externalEntityDecl(XSA::makeStringT(name),
SA::makeStringT(publicId), XSA::makeStringT(publicId),
SA::makeStringT(systemId)); XSA::makeStringT(systemId));
} // externalEntityDecl } // externalEntityDecl
private: private:
@ -819,8 +813,8 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
InputSourceAdaptor(const InputSourceT& source) InputSourceAdaptor(const InputSourceT& source)
: inputSource_(source) : inputSource_(source)
{ {
xerces_string_janitor<XMLCh> wSystemId(SA::asXMLChString(source.getSystemId())); xerces_string_janitor<XMLCh> wSystemId(XSA::asXMLChString(source.getSystemId()));
xerces_string_janitor<XMLCh> wPublicId(SA::asXMLChString(source.getPublicId())); xerces_string_janitor<XMLCh> wPublicId(XSA::asXMLChString(source.getPublicId()));
setSystemId(wSystemId.get()); setSystemId(wSystemId.get());
setPublicId(wPublicId.get()); setPublicId(wPublicId.get());
} // InputSourceAdaptor } // InputSourceAdaptor
@ -853,7 +847,7 @@ class xerces_wrapper : public SAX::ProgressiveParser<string_type>
ErrorHandlerAdaptor errorHandlerAdaptor_; ErrorHandlerAdaptor errorHandlerAdaptor_;
LexicalHandlerAdaptor lexicalHandlerAdaptor_; LexicalHandlerAdaptor lexicalHandlerAdaptor_;
DeclHandlerAdaptor declHandlerAdaptor_; DeclHandlerAdaptor declHandlerAdaptor_;
Arabica::SAX::XercesPropertyNames<string_type, string_adaptorT> properties_; Arabica::SAX::XercesPropertyNames<string_type, string_adaptor> properties_;
// Property values to return by reference // Property values to return by reference
string_type externalSchemaLocation_; string_type externalSchemaLocation_;
@ -878,8 +872,8 @@ xerces_wrapper<string_type, T0, T1>::xerces_wrapper()
} }
catch(const XERCES_CPP_NAMESPACE::XMLException& toCatch) catch(const XERCES_CPP_NAMESPACE::XMLException& toCatch)
{ {
string_type s = SA::makeStringT(toCatch.getMessage()); string_type s = XSA::makeStringT(toCatch.getMessage());
throw SAX::SAXException(SA::asStdString(s)); throw SAX::SAXException(XSA::asStdString(s));
} // catch } // catch
xerces_ = XERCES_CPP_NAMESPACE::XMLReaderFactory::createXMLReader(); xerces_ = XERCES_CPP_NAMESPACE::XMLReaderFactory::createXMLReader();
@ -906,16 +900,16 @@ bool xerces_wrapper<string_type, T0, T1>::getFeature(const string_type& name) co
{ {
try try
{ {
xerces_string_janitor<XMLCh> wName(SA::asXMLChString(name)); xerces_string_janitor<XMLCh> wName(XSA::asXMLChString(name));
return xerces_->getFeature(wName.get()); return xerces_->getFeature(wName.get());
} // try } // try
catch(XERCES_CPP_NAMESPACE::SAXNotSupportedException& e) catch(XERCES_CPP_NAMESPACE::SAXNotSupportedException& e)
{ {
throw SAX::SAXNotSupportedException(SA::asStdString(SA::makeStringT(e.getMessage()))); throw SAX::SAXNotSupportedException(XSA::asStdString(XSA::makeStringT(e.getMessage())));
} // catch(SAXNotSupportedException& e) } // catch(SAXNotSupportedException& e)
catch(XERCES_CPP_NAMESPACE::SAXNotRecognizedException& e) catch(XERCES_CPP_NAMESPACE::SAXNotRecognizedException& e)
{ {
throw SAX::SAXNotRecognizedException(SA::asStdString(SA::makeStringT(e.getMessage()))); throw SAX::SAXNotRecognizedException(XSA::asStdString(XSA::makeStringT(e.getMessage())));
} // catch(SAXNotRecognizedException& e) } // catch(SAXNotRecognizedException& e)
} // getFeature } // getFeature
@ -924,59 +918,59 @@ void xerces_wrapper<string_type, T0, T1>::setFeature(const string_type& name, bo
{ {
try try
{ {
xerces_string_janitor<XMLCh> wName(SA::asXMLChString(name)); xerces_string_janitor<XMLCh> wName(XSA::asXMLChString(name));
xerces_->setFeature(wName.get(), value); xerces_->setFeature(wName.get(), value);
} // try } // try
catch(XERCES_CPP_NAMESPACE::SAXNotSupportedException& e) catch(XERCES_CPP_NAMESPACE::SAXNotSupportedException& e)
{ {
throw SAX::SAXNotSupportedException(SA::asStdString(SA::makeStringT(e.getMessage()))); throw SAX::SAXNotSupportedException(XSA::asStdString(XSA::makeStringT(e.getMessage())));
} // catch(SAXNotSupportedException& e) } // catch(SAXNotSupportedException& e)
catch(XERCES_CPP_NAMESPACE::SAXNotRecognizedException& e) catch(XERCES_CPP_NAMESPACE::SAXNotRecognizedException& e)
{ {
throw SAX::SAXNotRecognizedException(SA::asStdString(SA::makeStringT(e.getMessage()))); throw SAX::SAXNotRecognizedException(XSA::asStdString(XSA::makeStringT(e.getMessage())));
} // catch(SAXNotRecognizedException& e) } // catch(SAXNotRecognizedException& e)
} // setFeature } // setFeature
template<class string_type, class T0, class T1> template<class string_type, class T0, class T1>
#ifndef ARABICA_VS6_WORKAROUND #ifndef ARABICA_VS6_WORKAROUND
std::auto_ptr<typename SAX::XMLReaderInterface<string_type>::PropertyBase> xerces_wrapper<string_type, T0, T1>::doGetProperty(const string_type& name) std::auto_ptr<typename XMLReaderInterface<string_type, T0, T1>::PropertyBase> xerces_wrapper<string_type, T0, T1>::doGetProperty(const string_type& name)
#else #else
std::auto_ptr<SAX::XMLReaderInterface<string_type>::PropertyBase> xerces_wrapper<string_type, T0, T1>::doGetProperty(const string_type& name) std::auto_ptr<XMLReaderInterface<string_type, T0, T1>::PropertyBase> xerces_wrapper<string_type, T0, T1>::doGetProperty(const string_type& name)
#endif #endif
{ {
if(name == properties_.lexicalHandler) if(name == properties_.lexicalHandler)
{ {
typedef typename SAX::XMLReaderInterface<string_type>::template Property<LexicalHandlerT *> Prop; typedef typename XMLReaderInterface<string_type, T0, T1>::template Property<LexicalHandlerT *> Prop;
Prop *prop = new Prop(lexicalHandlerAdaptor_.getLexicalHandler()); Prop *prop = new Prop(lexicalHandlerAdaptor_.getLexicalHandler());
#ifndef ARABICA_VS6_WORKAROUND #ifndef ARABICA_VS6_WORKAROUND
return std::auto_ptr<typename base::PropertyBase>(prop); return std::auto_ptr<typename XMLReaderT::PropertyBase>(prop);
#else #else
return std::auto_ptr<base::PropertyBase>(prop); return std::auto_ptr<XMLReaderT::PropertyBase>(prop);
#endif #endif
} }
if(name == properties_.declHandler) if(name == properties_.declHandler)
{ {
typedef typename SAX::XMLReaderInterface<string_type>::template Property<DeclHandlerT*> Prop; typedef typename XMLReaderInterface<string_type,T0,T1>::template Property<DeclHandlerT*> Prop;
Prop* prop = new Prop(declHandlerAdaptor_.getDeclHandler()); Prop* prop = new Prop(declHandlerAdaptor_.getDeclHandler());
#ifndef ARABICA_VS6_WORKAROUND #ifndef ARABICA_VS6_WORKAROUND
return std::auto_ptr<typename base::PropertyBase>(prop); return std::auto_ptr<typename XMLReaderT::PropertyBase>(prop);
#else #else
return std::auto_ptr<base::PropertyBase>(prop); return std::auto_ptr<XMLReaderT::PropertyBase>(prop);
#endif #endif
} }
if (name == properties_.externalSchemaLocation) if (name == properties_.externalSchemaLocation)
{ {
typedef typename SAX::XMLReaderInterface<string_type>::template Property<string_type&> StringPropertyType; typedef typename XMLReaderInterface<string_type,T0,T1>::template Property<string_type&> StringPropertyType;
XMLCh* xercesExternalSchemaLocation = XMLCh* xercesExternalSchemaLocation =
static_cast<XMLCh*>(xerces_->getProperty( static_cast<XMLCh*>(xerces_->getProperty(
XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalSchemaLocation)); XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalSchemaLocation));
externalSchemaLocation_ = SA::makeStringT(xercesExternalSchemaLocation); externalSchemaLocation_ = XSA::makeStringT(xercesExternalSchemaLocation);
#ifndef ARABICA_VS6_WORKAROUND #ifndef ARABICA_VS6_WORKAROUND
std::auto_ptr<typename base::PropertyBase> toReturn(new StringPropertyType(externalSchemaLocation_)); std::auto_ptr<typename XMLReaderT::PropertyBase> toReturn(new StringPropertyType(externalSchemaLocation_));
#else #else
std::auto_ptr<base::PropertyBase> toReturn(new StringPropertyType(externalSchemaLocation_)); std::auto_ptr<XMLReaderT::PropertyBase> toReturn(new StringPropertyType(externalSchemaLocation_));
#endif #endif
#ifdef SAXXERCES_DEBUG #ifdef SAXXERCES_DEBUG
std::cerr << "Returning " << typeid(toReturn) std::cerr << "Returning " << typeid(toReturn)
@ -989,17 +983,17 @@ std::auto_ptr<SAX::XMLReaderInterface<string_type>::PropertyBase> xerces_wrapper
} }
if (name == properties_.externalNoNamespaceSchemaLocation) if (name == properties_.externalNoNamespaceSchemaLocation)
{ {
typedef typename SAX::XMLReaderInterface<string_type>::template Property<string_type&> StringPropertyType; typedef typename XMLReaderInterface<string_type,T0,T1>::template Property<string_type&> StringPropertyType;
XMLCh* xercesExternalNoNamespaceSchemaLocation = XMLCh* xercesExternalNoNamespaceSchemaLocation =
static_cast<XMLCh*>(xerces_->getProperty( static_cast<XMLCh*>(xerces_->getProperty(
XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation)); XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation));
externalNoNamespaceSchemaLocation_ = SA::makeStringT(xercesExternalNoNamespaceSchemaLocation); externalNoNamespaceSchemaLocation_ = XSA::makeStringT(xercesExternalNoNamespaceSchemaLocation);
#ifndef ARABICA_VS6_WORKAROUND #ifndef ARABICA_VS6_WORKAROUND
return std::auto_ptr<typename base::PropertyBase>(new StringPropertyType(externalNoNamespaceSchemaLocation_)); return std::auto_ptr<typename XMLReaderT::PropertyBase>(new StringPropertyType(externalNoNamespaceSchemaLocation_));
#else #else
return std::auto_ptr<base::PropertyBase>(new StringPropertyType(externalNoNamespaceSchemaLocation_)); return std::auto_ptr<XMLReaderT::PropertyBase>(new StringPropertyType(externalNoNamespaceSchemaLocation_));
#endif #endif
} }
throw SAX::SAXNotRecognizedException("Property not recognized "); throw SAX::SAXNotRecognizedException("Property not recognized ");
@ -1007,14 +1001,14 @@ std::auto_ptr<SAX::XMLReaderInterface<string_type>::PropertyBase> xerces_wrapper
template<class string_type, class T0, class T1> template<class string_type, class T0, class T1>
#ifndef ARABICA_VS6_WORKAROUND #ifndef ARABICA_VS6_WORKAROUND
void xerces_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name, std::auto_ptr<typename base::PropertyBase> value) void xerces_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name, std::auto_ptr<typename XMLReaderT::PropertyBase> value)
#else #else
void xerces_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name, std::auto_ptr<base::PropertyBase> value) void xerces_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name, std::auto_ptr<XMLReaderT::PropertyBase> value)
#endif #endif
{ {
if(name == properties_.lexicalHandler) if(name == properties_.lexicalHandler)
{ {
typedef typename SAX::XMLReaderInterface<string_type>::template Property<LexicalHandlerT&> Prop; typedef typename XMLReaderInterface<string_type,T0,T1>::template Property<LexicalHandlerT&> Prop;
Prop* prop = dynamic_cast<Prop*>(value.get()); Prop* prop = dynamic_cast<Prop*>(value.get());
if(!prop) if(!prop)
@ -1026,7 +1020,7 @@ void xerces_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name,
if(name == properties_.declHandler) if(name == properties_.declHandler)
{ {
typedef typename SAX::XMLReaderInterface<string_type>::template Property<DeclHandlerT&> Prop; typedef typename XMLReaderInterface<string_type,T0,T1>::template Property<DeclHandlerT&> Prop;
Prop* prop = dynamic_cast<Prop*>(value.get()); Prop* prop = dynamic_cast<Prop*>(value.get());
if(!prop) if(!prop)
@ -1038,12 +1032,12 @@ void xerces_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name,
if (name == properties_.externalSchemaLocation) if (name == properties_.externalSchemaLocation)
{ {
typename base::PropertyBase* propBase = value.get(); typename XMLReaderT::PropertyBase* propBase = value.get();
#ifdef SAXXERCES_DEBUG #ifdef SAXXERCES_DEBUG
std::cerr << "doSetProperty(externalSchemaLocation, &(" std::cerr << "doSetProperty(externalSchemaLocation, &("
<< typeid(*propBase) << "))" << std::endl; << typeid(*propBase) << "))" << std::endl;
#endif #endif
typedef typename base::template Property<string_type&> propertyType; typedef typename XMLReaderT::template Property<string_type&> propertyType;
propertyType* prop = dynamic_cast<propertyType*>(propBase); propertyType* prop = dynamic_cast<propertyType*>(propBase);
#ifdef SAXXERCES_DEBUG #ifdef SAXXERCES_DEBUG
std::cerr << " Extracted property to " << typeid(prop) std::cerr << " Extracted property to " << typeid(prop)
@ -1055,7 +1049,7 @@ void xerces_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name,
#ifdef SAXXERCES_DEBUG #ifdef SAXXERCES_DEBUG
std::cerr << " Setting property to " << externalSchemaLocation_ << std::endl; std::cerr << " Setting property to " << externalSchemaLocation_ << std::endl;
#endif #endif
xerces_string_janitor<XMLCh> toDelete(SA::asXMLChString(externalSchemaLocation_)); xerces_string_janitor<XMLCh> toDelete(XSA::asXMLChString(externalSchemaLocation_));
xerces_->setProperty(XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalSchemaLocation, const_cast<XMLCh*>(toDelete.get())); xerces_->setProperty(XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalSchemaLocation, const_cast<XMLCh*>(toDelete.get()));
} }
else else
@ -1067,8 +1061,8 @@ void xerces_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name,
if (name == properties_.externalNoNamespaceSchemaLocation) if (name == properties_.externalNoNamespaceSchemaLocation)
{ {
typename base::PropertyBase* propBase = value.get(); typename XMLReaderT::PropertyBase* propBase = value.get();
typedef typename base::template Property<string_type&> propertyType; typedef typename XMLReaderT::template Property<string_type&> propertyType;
#ifdef SAXXERCES_DEBUG #ifdef SAXXERCES_DEBUG
std::cerr << "doSetProperty(externalNoNamespaceSchemaLocation, &(" std::cerr << "doSetProperty(externalNoNamespaceSchemaLocation, &("
<< typeid(*propBase) << "))" << std::endl; << typeid(*propBase) << "))" << std::endl;
@ -1084,7 +1078,7 @@ void xerces_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name,
#ifdef SAXXERCES_DEBUG #ifdef SAXXERCES_DEBUG
std::cerr << " Setting property to " << externalNoNamespaceSchemaLocation_ << std::endl; std::cerr << " Setting property to " << externalNoNamespaceSchemaLocation_ << std::endl;
#endif #endif
xerces_string_janitor<XMLCh> toDelete(SA::asXMLChString(externalNoNamespaceSchemaLocation_)); xerces_string_janitor<XMLCh> toDelete(XSA::asXMLChString(externalNoNamespaceSchemaLocation_));
xerces_->setProperty(XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation, const_cast<XMLCh*>(toDelete.get())); xerces_->setProperty(XERCES_CPP_NAMESPACE::XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation, const_cast<XMLCh*>(toDelete.get()));
} }
else else
@ -1103,7 +1097,7 @@ void xerces_wrapper<string_type, T0, T1>::parse(InputSourceT& source)
{ {
// if no stream is open, let Xerces deal with it // if no stream is open, let Xerces deal with it
if(source.getByteStream() == 0) if(source.getByteStream() == 0)
xerces_->parse(SA::asStdString(source.getSystemId()).c_str()); xerces_->parse(XSA::asStdString(source.getSystemId()).c_str());
else else
{ {
// we have to wrap everything up in a Xerces friendly way // we have to wrap everything up in a Xerces friendly way
@ -1124,7 +1118,7 @@ bool xerces_wrapper<string_type,
{ {
// We can just pass the systemID to parseFirst and let Xerces open the // We can just pass the systemID to parseFirst and let Xerces open the
// stream. // stream.
const char* systemID = SA::asStdString(input.getSystemId()).c_str(); const char* systemID = XSA::asStdString(input.getSystemId()).c_str();
result = xerces_->parseFirst(systemID, newToken->token_); result = xerces_->parseFirst(systemID, newToken->token_);
} }
else else