mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-17 18:12:04 +01:00
had inadvertantly broken the MSXML build
This commit is contained in:
parent
e6432c57eb
commit
f4453c647d
1 changed files with 168 additions and 165 deletions
|
@ -62,7 +62,7 @@ class COMExternalInitializer : public COMInitializer_tag
|
||||||
class COMSingleThreadInitializer : public COMInitializer_tag
|
class COMSingleThreadInitializer : public COMInitializer_tag
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
COMSingleThreadInitializer() { ::CoInitialize(NULL); }
|
COMSingleThreadInitializer() { ::CoInitialize(NULL); }
|
||||||
~COMSingleThreadInitializer() { ::CoUninitialize(); }
|
~COMSingleThreadInitializer() { ::CoUninitialize(); }
|
||||||
}; // COMSingleThreadInitializer
|
}; // COMSingleThreadInitializer
|
||||||
|
|
||||||
|
@ -80,79 +80,82 @@ template<class string_type,
|
||||||
class T1 = Arabica::nil_t>
|
class T1 = Arabica::nil_t>
|
||||||
class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
{
|
{
|
||||||
typedef typename Arabica::get_param<COMInitializer_tag, COMSingleThreadInitializer, T0, T1>::type COMInitializer_type;
|
typedef typename Arabica::get_param<Arabica::string_adaptor_tag,
|
||||||
typedef typename Arabica::get_param<Arabica::string_adaptor_tag, Arabica::default_string_adaptor<string_type>, T0, T1>::type string_adaptor_type;
|
Arabica::default_string_adaptor<string_type>,
|
||||||
|
T0,
|
||||||
|
T1>::type string_adaptor_type;
|
||||||
|
typedef typename Arabica::get_param<COMInitializer_tag,
|
||||||
|
COMSingleThreadInitializer,
|
||||||
|
T0,
|
||||||
|
T1>::type COMInitializer_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef SAX::basic_EntityResolver<string_type> entityResolverT;
|
||||||
typedef string_adaptor_type string_adaptorT;
|
typedef SAX::basic_DTDHandler<string_type> dtdHandlerT;
|
||||||
typedef SAX::basic_EntityResolver<stringT> entityResolverT;
|
typedef SAX::basic_ContentHandler<string_type> contentHandlerT;
|
||||||
typedef SAX::basic_DTDHandler<stringT> dtdHandlerT;
|
typedef SAX::basic_DeclHandler<string_type> declHandlerT;
|
||||||
typedef SAX::basic_ContentHandler<stringT> contentHandlerT;
|
typedef SAX::basic_LexicalHandler<string_type> lexicalHandlerT;
|
||||||
typedef SAX::basic_DeclHandler<stringT> declHandlerT;
|
typedef SAX::basic_InputSource<string_type> inputSourceT;
|
||||||
typedef SAX::basic_LexicalHandler<stringT> lexicalHandlerT;
|
typedef SAX::basic_Locator<string_type> locatorT;
|
||||||
typedef SAX::basic_InputSource<stringT> inputSourceT;
|
typedef SAX::basic_ErrorHandler<string_type> errorHandlerT;
|
||||||
typedef SAX::basic_Locator<stringT> locatorT;
|
|
||||||
typedef SAX::basic_ErrorHandler<stringT> errorHandlerT;
|
|
||||||
typedef COMInitializer_type COMInitializerT;
|
|
||||||
|
|
||||||
msxml2_wrapper();
|
msxml2_wrapper();
|
||||||
virtual ~msxml2_wrapper();
|
virtual ~msxml2_wrapper();
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
// Configuration
|
// Configuration
|
||||||
virtual bool getFeature(const stringT& name) const;
|
virtual bool getFeature(const string_type& name) const;
|
||||||
virtual void setFeature(const stringT& name, bool value);
|
virtual void setFeature(const string_type& name, bool value);
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
// Event Handlers
|
// Event Handlers
|
||||||
/* MSXML does not use EntityResolver currently */
|
/* MSXML does not use EntityResolver currently */
|
||||||
virtual void setEntityResolver(SAX::basic_EntityResolver<stringT>& resolver) { }
|
virtual void setEntityResolver(SAX::basic_EntityResolver<string_type>& resolver) { }
|
||||||
virtual SAX::basic_EntityResolver<stringT>* getEntityResolver() const { return 0; }
|
virtual SAX::basic_EntityResolver<string_type>* getEntityResolver() const { return 0; }
|
||||||
virtual void setDTDHandler(SAX::basic_DTDHandler<stringT>& handler) { dtdHandler_.setDTDHandler(handler); }
|
virtual void setDTDHandler(SAX::basic_DTDHandler<string_type>& handler) { dtdHandler_.setDTDHandler(handler); }
|
||||||
virtual SAX::basic_DTDHandler<stringT>* getDTDHandler() const { return dtdHandler_.getDTDHandler(); }
|
virtual SAX::basic_DTDHandler<string_type>* getDTDHandler() const { return dtdHandler_.getDTDHandler(); }
|
||||||
virtual void setContentHandler(SAX::basic_ContentHandler<stringT>& handler) { contentHandler_.setContentHandler(handler); }
|
virtual void setContentHandler(SAX::basic_ContentHandler<string_type>& handler) { contentHandler_.setContentHandler(handler); }
|
||||||
virtual SAX::basic_ContentHandler<stringT>* getContentHandler() const { return contentHandler_.getContentHandler(); }
|
virtual SAX::basic_ContentHandler<string_type>* getContentHandler() const { return contentHandler_.getContentHandler(); }
|
||||||
virtual void setErrorHandler(SAX::basic_ErrorHandler<stringT>& handler);
|
virtual void setErrorHandler(SAX::basic_ErrorHandler<string_type>& handler);
|
||||||
virtual SAX::basic_ErrorHandler<stringT>* getErrorHandler() const;
|
virtual SAX::basic_ErrorHandler<string_type>* getErrorHandler() const;
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// Parsing
|
// Parsing
|
||||||
virtual void parse(SAX::basic_InputSource<stringT>& input);
|
virtual void parse(SAX::basic_InputSource<string_type>& input);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual std::auto_ptr<SAX::basic_XMLReader<stringT>::PropertyBase> doGetProperty(const stringT& name);
|
virtual std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase> doGetProperty(const string_type& name);
|
||||||
virtual void doSetProperty(const stringT& name, std::auto_ptr<SAX::basic_XMLReader<stringT>::PropertyBase> value);
|
virtual void doSetProperty(const string_type& name, std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase> value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
// COM interface -> C++ interface adaptors
|
// COM interface -> C++ interface adaptors
|
||||||
class LocatorAdaptor : public SAX::basic_Locator<stringT>
|
class LocatorAdaptor : public SAX::basic_Locator<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LocatorAdaptor() : locator_(0) { }
|
LocatorAdaptor() : locator_(0) { }
|
||||||
LocatorAdaptor(ISAXLocator __RPC_FAR* locator) : locator_(0) { setLocator(locator); }
|
LocatorAdaptor(ISAXLocator __RPC_FAR* locator) : locator_(0) { setLocator(locator); }
|
||||||
~LocatorAdaptor() { setLocator(0); }
|
~LocatorAdaptor() { setLocator(0); }
|
||||||
|
|
||||||
stringT getPublicId() const
|
string_type getPublicId() const
|
||||||
{
|
{
|
||||||
if(!locator_)
|
if(!locator_)
|
||||||
return stringT();
|
return string_type();
|
||||||
|
|
||||||
const wchar_t* pwchPublicId;
|
const wchar_t* pwchPublicId;
|
||||||
locator_->getPublicId(&pwchPublicId);
|
locator_->getPublicId(&pwchPublicId);
|
||||||
stringT publicId(string_adaptorT::construct_from_utf16(pwchPublicId));
|
string_type publicId(string_adaptor_type::construct_from_utf16(pwchPublicId));
|
||||||
return publicId;
|
return publicId;
|
||||||
} // getPublicId
|
} // getPublicId
|
||||||
|
|
||||||
stringT getSystemId() const
|
string_type getSystemId() const
|
||||||
{
|
{
|
||||||
if(!locator_)
|
if(!locator_)
|
||||||
return stringT();
|
return string_type();
|
||||||
|
|
||||||
const wchar_t* pwchSystemId;
|
const wchar_t* pwchSystemId;
|
||||||
locator_->getSystemId(&pwchSystemId);
|
locator_->getSystemId(&pwchSystemId);
|
||||||
stringT systemId(string_adaptorT::construct_from_utf16(pwchSystemId));
|
string_type systemId(string_adaptor_type::construct_from_utf16(pwchSystemId));
|
||||||
return systemId;
|
return systemId;
|
||||||
} // getSystemId
|
} // getSystemId
|
||||||
|
|
||||||
|
@ -193,8 +196,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
DTDHandlerAdaptor() : dtdHandler_(0) { }
|
DTDHandlerAdaptor() : dtdHandler_(0) { }
|
||||||
~DTDHandlerAdaptor() { }
|
~DTDHandlerAdaptor() { }
|
||||||
|
|
||||||
void setDTDHandler(SAX::basic_DTDHandler<stringT>& handler) { dtdHandler_ = &handler; }
|
void setDTDHandler(SAX::basic_DTDHandler<string_type>& handler) { dtdHandler_ = &handler; }
|
||||||
SAX::basic_DTDHandler<stringT>* getDTDHandler() const { return dtdHandler_; }
|
SAX::basic_DTDHandler<string_type>* getDTDHandler() const { return dtdHandler_; }
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE notationDecl(
|
virtual HRESULT STDMETHODCALLTYPE notationDecl(
|
||||||
/* [in] */ const wchar_t *pwchName,
|
/* [in] */ const wchar_t *pwchName,
|
||||||
|
@ -205,9 +208,9 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchSystemId)
|
/* [in] */ int cchSystemId)
|
||||||
{
|
{
|
||||||
if(dtdHandler_)
|
if(dtdHandler_)
|
||||||
dtdHandler_->notationDecl(string_adaptorT::construct_from_utf16(pwchName, cchName),
|
dtdHandler_->notationDecl(string_adaptor_type::construct_from_utf16(pwchName, cchName),
|
||||||
string_adaptorT::construct_from_utf16(pwchPublicId, cchPublicId),
|
string_adaptor_type::construct_from_utf16(pwchPublicId, cchPublicId),
|
||||||
string_adaptorT::construct_from_utf16(pwchSystemId, cchSystemId));
|
string_adaptor_type::construct_from_utf16(pwchSystemId, cchSystemId));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // notationDecl
|
} // notationDecl
|
||||||
|
|
||||||
|
@ -222,10 +225,10 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchNotationName)
|
/* [in] */ int cchNotationName)
|
||||||
{
|
{
|
||||||
if(dtdHandler_)
|
if(dtdHandler_)
|
||||||
dtdHandler_->unparsedEntityDecl(string_adaptorT::construct_from_utf16(pwchName, cchName),
|
dtdHandler_->unparsedEntityDecl(string_adaptor_type::construct_from_utf16(pwchName, cchName),
|
||||||
string_adaptorT::construct_from_utf16(pwchPublicId, cchPublicId),
|
string_adaptor_type::construct_from_utf16(pwchPublicId, cchPublicId),
|
||||||
string_adaptorT::construct_from_utf16(pwchSystemId, cchSystemId),
|
string_adaptor_type::construct_from_utf16(pwchSystemId, cchSystemId),
|
||||||
string_adaptorT::construct_from_utf16(pwchNotationName, cchNotationName));
|
string_adaptor_type::construct_from_utf16(pwchNotationName, cchNotationName));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // unparsedEntityDecl
|
} // unparsedEntityDecl
|
||||||
|
|
||||||
|
@ -235,7 +238,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
unsigned long __stdcall Release() { return 0; }
|
unsigned long __stdcall Release() { return 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SAX::basic_DTDHandler<stringT>* dtdHandler_;
|
SAX::basic_DTDHandler<string_type>* dtdHandler_;
|
||||||
}; // class DTDHandlerAdaptor
|
}; // class DTDHandlerAdaptor
|
||||||
|
|
||||||
class ContentHandlerAdaptor : public ISAXContentHandler
|
class ContentHandlerAdaptor : public ISAXContentHandler
|
||||||
|
@ -244,8 +247,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
ContentHandlerAdaptor() : contentHandler_(0) { }
|
ContentHandlerAdaptor() : contentHandler_(0) { }
|
||||||
~ContentHandlerAdaptor() { }
|
~ContentHandlerAdaptor() { }
|
||||||
|
|
||||||
void setContentHandler(SAX::basic_ContentHandler<stringT>& handler) { contentHandler_ = &handler; }
|
void setContentHandler(SAX::basic_ContentHandler<string_type>& handler) { contentHandler_ = &handler; }
|
||||||
SAX::basic_ContentHandler<stringT>* getContentHandler() const { return contentHandler_; }
|
SAX::basic_ContentHandler<string_type>* getContentHandler() const { return contentHandler_; }
|
||||||
|
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE putDocumentLocator(
|
virtual HRESULT STDMETHODCALLTYPE putDocumentLocator(
|
||||||
|
@ -276,8 +279,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
|
|
||||||
{
|
{
|
||||||
if(contentHandler_)
|
if(contentHandler_)
|
||||||
contentHandler_->startPrefixMapping(string_adaptorT::construct_from_utf16(pwchPrefix, cchPrefix),
|
contentHandler_->startPrefixMapping(string_adaptor_type::construct_from_utf16(pwchPrefix, cchPrefix),
|
||||||
string_adaptorT::construct_from_utf16(pwchUri, cchUri));
|
string_adaptor_type::construct_from_utf16(pwchUri, cchUri));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // startPrefixMapping
|
} // startPrefixMapping
|
||||||
|
|
||||||
|
@ -285,7 +288,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ const wchar_t *pwchPrefix,
|
/* [in] */ const wchar_t *pwchPrefix,
|
||||||
/* [in] */ int cchPrefix)
|
/* [in] */ int cchPrefix)
|
||||||
{
|
{
|
||||||
if(contentHandler_) contentHandler_->endPrefixMapping(string_adaptorT::construct_from_utf16(pwchPrefix, cchPrefix));
|
if(contentHandler_) contentHandler_->endPrefixMapping(string_adaptor_type::construct_from_utf16(pwchPrefix, cchPrefix));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // endPrefixMapping
|
} // endPrefixMapping
|
||||||
|
|
||||||
|
@ -301,9 +304,9 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
if(contentHandler_)
|
if(contentHandler_)
|
||||||
{
|
{
|
||||||
AttributesAdaptor attrs(pAttributes);
|
AttributesAdaptor attrs(pAttributes);
|
||||||
contentHandler_->startElement(string_adaptorT::construct_from_utf16(pwchNamespaceUri, cchNamespaceUri),
|
contentHandler_->startElement(string_adaptor_type::construct_from_utf16(pwchNamespaceUri, cchNamespaceUri),
|
||||||
string_adaptorT::construct_from_utf16(pwchLocalName, cchLocalName),
|
string_adaptor_type::construct_from_utf16(pwchLocalName, cchLocalName),
|
||||||
string_adaptorT::construct_from_utf16(pwchQName, cchQName),
|
string_adaptor_type::construct_from_utf16(pwchQName, cchQName),
|
||||||
attrs);
|
attrs);
|
||||||
} // if ...
|
} // if ...
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -318,9 +321,9 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchQName)
|
/* [in] */ int cchQName)
|
||||||
{
|
{
|
||||||
if(contentHandler_)
|
if(contentHandler_)
|
||||||
contentHandler_->endElement(string_adaptorT::construct_from_utf16(pwchNamespaceUri, cchNamespaceUri),
|
contentHandler_->endElement(string_adaptor_type::construct_from_utf16(pwchNamespaceUri, cchNamespaceUri),
|
||||||
string_adaptorT::construct_from_utf16(pwchLocalName, cchLocalName),
|
string_adaptor_type::construct_from_utf16(pwchLocalName, cchLocalName),
|
||||||
string_adaptorT::construct_from_utf16(pwchQName, cchQName));
|
string_adaptor_type::construct_from_utf16(pwchQName, cchQName));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // endElement
|
} // endElement
|
||||||
|
|
||||||
|
@ -328,7 +331,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ const wchar_t *pwchChars,
|
/* [in] */ const wchar_t *pwchChars,
|
||||||
/* [in] */ int cchChars)
|
/* [in] */ int cchChars)
|
||||||
{
|
{
|
||||||
if(contentHandler_) contentHandler_->characters(string_adaptorT::construct_from_utf16(pwchChars, cchChars));
|
if(contentHandler_) contentHandler_->characters(string_adaptor_type::construct_from_utf16(pwchChars, cchChars));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
|
@ -337,7 +340,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchChars)
|
/* [in] */ int cchChars)
|
||||||
{
|
{
|
||||||
if(contentHandler_)
|
if(contentHandler_)
|
||||||
contentHandler_->ignorableWhitespace(string_adaptorT::construct_from_utf16(pwchChars, cchChars));
|
contentHandler_->ignorableWhitespace(string_adaptor_type::construct_from_utf16(pwchChars, cchChars));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // ignorableWhitespace
|
} // ignorableWhitespace
|
||||||
|
|
||||||
|
@ -348,8 +351,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchData)
|
/* [in] */ int cchData)
|
||||||
{
|
{
|
||||||
if(contentHandler_)
|
if(contentHandler_)
|
||||||
contentHandler_->processingInstruction(string_adaptorT::construct_from_utf16(pwchTarget, cchTarget),
|
contentHandler_->processingInstruction(string_adaptor_type::construct_from_utf16(pwchTarget, cchTarget),
|
||||||
string_adaptorT::construct_from_utf16(pwchData, cchData));
|
string_adaptor_type::construct_from_utf16(pwchData, cchData));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // processingInstruction
|
} // processingInstruction
|
||||||
|
|
||||||
|
@ -358,7 +361,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchName)
|
/* [in] */ int cchName)
|
||||||
{
|
{
|
||||||
if(contentHandler_)
|
if(contentHandler_)
|
||||||
contentHandler_->skippedEntity(string_adaptorT::construct_from_utf16(pwchName, cchName));
|
contentHandler_->skippedEntity(string_adaptor_type::construct_from_utf16(pwchName, cchName));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // skippedEntity
|
} // skippedEntity
|
||||||
|
|
||||||
|
@ -370,12 +373,12 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
private:
|
private:
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
// member varaibles
|
// member varaibles
|
||||||
SAX::basic_ContentHandler<stringT>* contentHandler_;
|
SAX::basic_ContentHandler<string_type>* contentHandler_;
|
||||||
LocatorAdaptor locator_;
|
LocatorAdaptor locator_;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
// COM interface -> C++ interface adaptors
|
// COM interface -> C++ interface adaptors
|
||||||
class AttributesAdaptor : public SAX::basic_Attributes<stringT>
|
class AttributesAdaptor : public SAX::basic_Attributes<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AttributesAdaptor(ISAXAttributes __RPC_FAR *pAttributes) : attributes_(pAttributes) { }
|
AttributesAdaptor(ISAXAttributes __RPC_FAR *pAttributes) : attributes_(pAttributes) { }
|
||||||
|
@ -390,135 +393,135 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
return length;
|
return length;
|
||||||
} // getLength
|
} // getLength
|
||||||
|
|
||||||
virtual stringT getURI(unsigned int index) const
|
virtual string_type getURI(unsigned int index) const
|
||||||
{
|
{
|
||||||
const wchar_t* pwchUri;
|
const wchar_t* pwchUri;
|
||||||
int cchUri;
|
int cchUri;
|
||||||
HRESULT hr = attributes_->getURI(index, &pwchUri, &cchUri);
|
HRESULT hr = attributes_->getURI(index, &pwchUri, &cchUri);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return stringT();
|
return string_type();
|
||||||
stringT uri(string_adaptorT::construct_from_utf16(pwchUri, cchUri));
|
string_type uri(string_adaptor_type::construct_from_utf16(pwchUri, cchUri));
|
||||||
return uri;
|
return uri;
|
||||||
} // getURI
|
} // getURI
|
||||||
|
|
||||||
virtual stringT getLocalName(unsigned int index) const
|
virtual string_type getLocalName(unsigned int index) const
|
||||||
{
|
{
|
||||||
const wchar_t* pwchLocalName;
|
const wchar_t* pwchLocalName;
|
||||||
int cchLocalName;
|
int cchLocalName;
|
||||||
HRESULT hr = attributes_->getLocalName(index, &pwchLocalName, &cchLocalName);
|
HRESULT hr = attributes_->getLocalName(index, &pwchLocalName, &cchLocalName);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return stringT();
|
return string_type();
|
||||||
stringT localName(string_adaptorT::construct_from_utf16(pwchLocalName, cchLocalName));
|
string_type localName(string_adaptor_type::construct_from_utf16(pwchLocalName, cchLocalName));
|
||||||
return localName;
|
return localName;
|
||||||
} // getLocalName
|
} // getLocalName
|
||||||
|
|
||||||
virtual stringT getQName(unsigned int index) const
|
virtual string_type getQName(unsigned int index) const
|
||||||
{
|
{
|
||||||
const wchar_t* pwchQName;
|
const wchar_t* pwchQName;
|
||||||
int cchQName;
|
int cchQName;
|
||||||
HRESULT hr = attributes_->getQName(index, &pwchQName, &cchQName);
|
HRESULT hr = attributes_->getQName(index, &pwchQName, &cchQName);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return stringT();
|
return string_type();
|
||||||
stringT qName(string_adaptorT::construct_from_utf16(pwchQName, cchQName));
|
string_type qName(string_adaptor_type::construct_from_utf16(pwchQName, cchQName));
|
||||||
return qName;
|
return qName;
|
||||||
} // getQName
|
} // getQName
|
||||||
|
|
||||||
virtual stringT getType(unsigned int index) const
|
virtual string_type getType(unsigned int index) const
|
||||||
{
|
{
|
||||||
const wchar_t* pwchType;
|
const wchar_t* pwchType;
|
||||||
int cchType;
|
int cchType;
|
||||||
HRESULT hr = attributes_->getType(index, &pwchType, &cchType);
|
HRESULT hr = attributes_->getType(index, &pwchType, &cchType);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return stringT();
|
return string_type();
|
||||||
stringT type(string_adaptorT::construct_from_utf16(pwchType, cchType));
|
string_type type(string_adaptor_type::construct_from_utf16(pwchType, cchType));
|
||||||
return type;
|
return type;
|
||||||
} // getType
|
} // getType
|
||||||
|
|
||||||
virtual stringT getValue(unsigned int index) const
|
virtual string_type getValue(unsigned int index) const
|
||||||
{
|
{
|
||||||
const wchar_t* pwchValue;
|
const wchar_t* pwchValue;
|
||||||
int cchValue;
|
int cchValue;
|
||||||
HRESULT hr = attributes_->getValue(index, &pwchValue, &cchValue);
|
HRESULT hr = attributes_->getValue(index, &pwchValue, &cchValue);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return stringT();
|
return string_type();
|
||||||
stringT value(string_adaptorT::construct_from_utf16(pwchValue, cchValue));
|
string_type value(string_adaptor_type::construct_from_utf16(pwchValue, cchValue));
|
||||||
return value;
|
return value;
|
||||||
} // getValue
|
} // getValue
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// name based query
|
// name based query
|
||||||
virtual int getIndex(const stringT& uri, const stringT& localName) const
|
virtual int getIndex(const string_type& uri, const string_type& localName) const
|
||||||
{
|
{
|
||||||
int index = -1;
|
int index = -1;
|
||||||
std::wstring wUri(string_adaptorT::asStdWString(uri));
|
std::wstring wUri(string_adaptor_type::asStdWString(uri));
|
||||||
std::wstring wLocalName(string_adaptorT::asStdWString(localName));
|
std::wstring wLocalName(string_adaptor_type::asStdWString(localName));
|
||||||
HRESULT hr = attributes_->getIndexFromName(wUri.data(), static_cast<int>(wUri.length()),
|
HRESULT hr = attributes_->getIndexFromName(wUri.data(), static_cast<int>(wUri.length()),
|
||||||
wLocalName.data(), static_cast<int>(wLocalName.length()),
|
wLocalName.data(), static_cast<int>(wLocalName.length()),
|
||||||
&index);
|
&index);
|
||||||
return index;
|
return index;
|
||||||
} // getIndex
|
} // getIndex
|
||||||
|
|
||||||
virtual int getIndex(const stringT& qName) const
|
virtual int getIndex(const string_type& qName) const
|
||||||
{
|
{
|
||||||
int index = -1;
|
int index = -1;
|
||||||
std::wstring wQName(string_adaptorT::asStdWString(qName));
|
std::wstring wQName(string_adaptor_type::asStdWString(qName));
|
||||||
attributes_->getIndexFromQName(wQName.data(), static_cast<int>(wQName.length()), &index);
|
attributes_->getIndexFromQName(wQName.data(), static_cast<int>(wQName.length()), &index);
|
||||||
return index;
|
return index;
|
||||||
} // getIndex
|
} // getIndex
|
||||||
|
|
||||||
virtual stringT getType(const stringT& uri, const stringT& localName) const
|
virtual string_type getType(const string_type& uri, const string_type& localName) const
|
||||||
{
|
{
|
||||||
const wchar_t* pwchType;
|
const wchar_t* pwchType;
|
||||||
int cchType;
|
int cchType;
|
||||||
std::wstring wUri(string_adaptorT::asStdWString(uri));
|
std::wstring wUri(string_adaptor_type::asStdWString(uri));
|
||||||
std::wstring wLocalName(string_adaptorT::asStdWString(localName));
|
std::wstring wLocalName(string_adaptor_type::asStdWString(localName));
|
||||||
HRESULT hr = attributes_->getTypeFromName(wUri.data(), static_cast<int>(wUri.length()),
|
HRESULT hr = attributes_->getTypeFromName(wUri.data(), static_cast<int>(wUri.length()),
|
||||||
wLocalName.data(), static_cast<int>(wLocalName.length()),
|
wLocalName.data(), static_cast<int>(wLocalName.length()),
|
||||||
&pwchType, &cchType);
|
&pwchType, &cchType);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return stringT();
|
return string_type();
|
||||||
stringT type(string_adaptorT::construct_from_utf16(pwchType, cchType));
|
string_type type(string_adaptor_type::construct_from_utf16(pwchType, cchType));
|
||||||
return type;
|
return type;
|
||||||
} // getType
|
} // getType
|
||||||
|
|
||||||
virtual stringT getType(const stringT& qName) const
|
virtual string_type getType(const string_type& qName) const
|
||||||
{
|
{
|
||||||
const wchar_t* pwchType;
|
const wchar_t* pwchType;
|
||||||
int cchType;
|
int cchType;
|
||||||
std::wstring wQName(string_adaptorT::asStdWString(qName));
|
std::wstring wQName(string_adaptor_type::asStdWString(qName));
|
||||||
HRESULT hr = attributes_->getTypeFromQName(wQName.data(), static_cast<int>(wQName.length()),
|
HRESULT hr = attributes_->getTypeFromQName(wQName.data(), static_cast<int>(wQName.length()),
|
||||||
&pwchType, &cchType);
|
&pwchType, &cchType);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return stringT();
|
return string_type();
|
||||||
stringT type(string_adaptorT::construct_from_utf16(pwchType, cchType));
|
string_type type(string_adaptor_type::construct_from_utf16(pwchType, cchType));
|
||||||
return type;
|
return type;
|
||||||
} // getType
|
} // getType
|
||||||
|
|
||||||
virtual stringT getValue(const stringT& uri, const stringT& localName) const
|
virtual string_type getValue(const string_type& uri, const string_type& localName) const
|
||||||
{
|
{
|
||||||
const wchar_t* pwchValue;
|
const wchar_t* pwchValue;
|
||||||
int cchValue;
|
int cchValue;
|
||||||
std::wstring wUri(string_adaptorT::asStdWString(uri));
|
std::wstring wUri(string_adaptor_type::asStdWString(uri));
|
||||||
std::wstring wLocalName(string_adaptorT::asStdWString(localName));
|
std::wstring wLocalName(string_adaptor_type::asStdWString(localName));
|
||||||
HRESULT hr = attributes_->getValueFromName(wUri.data(), static_cast<int>(wUri.length()),
|
HRESULT hr = attributes_->getValueFromName(wUri.data(), static_cast<int>(wUri.length()),
|
||||||
wLocalName.data(), static_cast<int>(wLocalName.length()),
|
wLocalName.data(), static_cast<int>(wLocalName.length()),
|
||||||
&pwchValue, &cchValue);
|
&pwchValue, &cchValue);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return stringT();
|
return string_type();
|
||||||
stringT value(string_adaptorT::construct_from_utf16(pwchValue, cchValue));
|
string_type value(string_adaptor_type::construct_from_utf16(pwchValue, cchValue));
|
||||||
return value;
|
return value;
|
||||||
} // getValue
|
} // getValue
|
||||||
|
|
||||||
virtual stringT getValue(const stringT& qname) const
|
virtual string_type getValue(const string_type& qname) const
|
||||||
{
|
{
|
||||||
const wchar_t* pwchValue;
|
const wchar_t* pwchValue;
|
||||||
int cchValue;
|
int cchValue;
|
||||||
std::wstring wQName(string_adaptorT::asStdWString(qname));
|
std::wstring wQName(string_adaptor_type::asStdWString(qname));
|
||||||
HRESULT hr = attributes_->getValueFromQName(wQName.data(), static_cast<int>(wQName.length()),
|
HRESULT hr = attributes_->getValueFromQName(wQName.data(), static_cast<int>(wQName.length()),
|
||||||
&pwchValue, &cchValue);
|
&pwchValue, &cchValue);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return stringT();
|
return string_type();
|
||||||
stringT value(string_adaptorT::construct_from_utf16(pwchValue, cchValue));
|
string_type value(string_adaptor_type::construct_from_utf16(pwchValue, cchValue));
|
||||||
return value;
|
return value;
|
||||||
} // getValue
|
} // getValue
|
||||||
|
|
||||||
|
@ -538,8 +541,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
{ }
|
{ }
|
||||||
virtual ~ErrorHandlerAdaptor() { }
|
virtual ~ErrorHandlerAdaptor() { }
|
||||||
|
|
||||||
void setErrorHandler(SAX::basic_ErrorHandler<stringT>& handler) { errorHandler_ = &handler; }
|
void setErrorHandler(SAX::basic_ErrorHandler<string_type>& handler) { errorHandler_ = &handler; }
|
||||||
SAX::basic_ErrorHandler<stringT>* getErrorHandler() const { return errorHandler_; }
|
SAX::basic_ErrorHandler<string_type>* getErrorHandler() const { return errorHandler_; }
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE error(
|
virtual HRESULT STDMETHODCALLTYPE error(
|
||||||
/* [in] */ ISAXLocator *pLocator,
|
/* [in] */ ISAXLocator *pLocator,
|
||||||
|
@ -547,8 +550,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ HRESULT hrErrorCode)
|
/* [in] */ HRESULT hrErrorCode)
|
||||||
{
|
{
|
||||||
bError_ = true;
|
bError_ = true;
|
||||||
stringT errorMsg(string_adaptorT::construct_from_utf16(pwchErrorMessage));
|
string_type errorMsg(string_adaptor_type::construct_from_utf16(pwchErrorMessage));
|
||||||
eError_ = SAXParseExceptionT(string_adaptorT::asStdString(errorMsg), LocatorAdaptor(pLocator));
|
eError_ = SAXParseExceptionT(string_adaptor_type::asStdString(errorMsg), LocatorAdaptor(pLocator));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // error
|
} // error
|
||||||
|
|
||||||
|
@ -558,8 +561,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ HRESULT hrErrorCode)
|
/* [in] */ HRESULT hrErrorCode)
|
||||||
{
|
{
|
||||||
bFatal_ = true;
|
bFatal_ = true;
|
||||||
stringT errorMsg(string_adaptorT::construct_from_utf16(pwchErrorMessage));
|
string_type errorMsg(string_adaptor_type::construct_from_utf16(pwchErrorMessage));
|
||||||
eFatal_ = SAXParseExceptionT(string_adaptorT::asStdString(errorMsg), LocatorAdaptor(pLocator));
|
eFatal_ = SAXParseExceptionT(string_adaptor_type::asStdString(errorMsg), LocatorAdaptor(pLocator));
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
} // fatalError
|
} // fatalError
|
||||||
|
|
||||||
|
@ -569,8 +572,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ HRESULT hrErrorCode)
|
/* [in] */ HRESULT hrErrorCode)
|
||||||
{
|
{
|
||||||
bWarning_ = true;
|
bWarning_ = true;
|
||||||
stringT errorMsg(string_adaptorT::construct_from_utf16(pwchErrorMessage));
|
string_type errorMsg(string_adaptor_type::construct_from_utf16(pwchErrorMessage));
|
||||||
eWarning_ = SAXParseExceptionT(string_adaptorT::asStdString(errorMsg), LocatorAdaptor(pLocator));
|
eWarning_ = SAXParseExceptionT(string_adaptor_type::asStdString(errorMsg), LocatorAdaptor(pLocator));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // ignorableWarning
|
} // ignorableWarning
|
||||||
|
|
||||||
|
@ -599,7 +602,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
unsigned long __stdcall Release() { return 0; }
|
unsigned long __stdcall Release() { return 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef SAX::basic_SAXParseException<stringT> SAXParseExceptionT;
|
typedef SAX::basic_SAXParseException<string_type> SAXParseExceptionT;
|
||||||
bool bWarning_;
|
bool bWarning_;
|
||||||
bool bError_;
|
bool bError_;
|
||||||
bool bFatal_;
|
bool bFatal_;
|
||||||
|
@ -607,7 +610,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
SAXParseExceptionT eError_;
|
SAXParseExceptionT eError_;
|
||||||
SAXParseExceptionT eFatal_;
|
SAXParseExceptionT eFatal_;
|
||||||
|
|
||||||
SAX::basic_ErrorHandler<stringT>* errorHandler_;
|
SAX::basic_ErrorHandler<string_type>* errorHandler_;
|
||||||
}; // class ErrorHandlerAdaptor
|
}; // class ErrorHandlerAdaptor
|
||||||
|
|
||||||
class LexicalHandlerAdaptor : public ISAXLexicalHandler
|
class LexicalHandlerAdaptor : public ISAXLexicalHandler
|
||||||
|
@ -616,8 +619,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
LexicalHandlerAdaptor() : lexicalHandler_(0) { }
|
LexicalHandlerAdaptor() : lexicalHandler_(0) { }
|
||||||
virtual ~LexicalHandlerAdaptor() { }
|
virtual ~LexicalHandlerAdaptor() { }
|
||||||
|
|
||||||
void setLexicalHandler(SAX::basic_LexicalHandler<stringT>& handler) { lexicalHandler_ = &handler; }
|
void setLexicalHandler(SAX::basic_LexicalHandler<string_type>& handler) { lexicalHandler_ = &handler; }
|
||||||
SAX::basic_LexicalHandler<stringT>* getLexicalHandler() const { return lexicalHandler_; }
|
SAX::basic_LexicalHandler<string_type>* getLexicalHandler() const { return lexicalHandler_; }
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE startDTD(
|
virtual HRESULT STDMETHODCALLTYPE startDTD(
|
||||||
/* [in] */ const wchar_t *pwchName,
|
/* [in] */ const wchar_t *pwchName,
|
||||||
|
@ -628,9 +631,9 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchSystemId)
|
/* [in] */ int cchSystemId)
|
||||||
{
|
{
|
||||||
if(lexicalHandler_)
|
if(lexicalHandler_)
|
||||||
lexicalHandler_->startDTD(string_adaptorT::construct_from_utf16(pwchName, cchName),
|
lexicalHandler_->startDTD(string_adaptor_type::construct_from_utf16(pwchName, cchName),
|
||||||
string_adaptorT::construct_from_utf16(pwchPublicId, cchPublicId),
|
string_adaptor_type::construct_from_utf16(pwchPublicId, cchPublicId),
|
||||||
string_adaptorT::construct_from_utf16(pwchSystemId, cchSystemId));
|
string_adaptor_type::construct_from_utf16(pwchSystemId, cchSystemId));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // startDTD
|
} // startDTD
|
||||||
|
|
||||||
|
@ -646,7 +649,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchName)
|
/* [in] */ int cchName)
|
||||||
{
|
{
|
||||||
if(lexicalHandler_)
|
if(lexicalHandler_)
|
||||||
lexicalHandler_->startEntity(string_adaptorT::construct_from_utf16(pwchName, cchName));
|
lexicalHandler_->startEntity(string_adaptor_type::construct_from_utf16(pwchName, cchName));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // startEntity
|
} // startEntity
|
||||||
|
|
||||||
|
@ -655,7 +658,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchName)
|
/* [in] */ int cchName)
|
||||||
{
|
{
|
||||||
if(lexicalHandler_)
|
if(lexicalHandler_)
|
||||||
lexicalHandler_->endEntity(string_adaptorT::construct_from_utf16(pwchName, cchName));
|
lexicalHandler_->endEntity(string_adaptor_type::construct_from_utf16(pwchName, cchName));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // endEntity
|
} // endEntity
|
||||||
|
|
||||||
|
@ -678,7 +681,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchChars)
|
/* [in] */ int cchChars)
|
||||||
{
|
{
|
||||||
if(lexicalHandler_)
|
if(lexicalHandler_)
|
||||||
lexicalHandler_->comment(string_adaptorT::construct_from_utf16(pwchChars, cchChars));
|
lexicalHandler_->comment(string_adaptor_type::construct_from_utf16(pwchChars, cchChars));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // comment
|
} // comment
|
||||||
|
|
||||||
|
@ -695,7 +698,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
unsigned long __stdcall Release() { return 0; }
|
unsigned long __stdcall Release() { return 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SAX::basic_LexicalHandler<stringT>* lexicalHandler_;
|
SAX::basic_LexicalHandler<string_type>* lexicalHandler_;
|
||||||
}; // class LexicalHandlerAdaptor
|
}; // class LexicalHandlerAdaptor
|
||||||
|
|
||||||
class DeclHandlerAdaptor : public ISAXDeclHandler
|
class DeclHandlerAdaptor : public ISAXDeclHandler
|
||||||
|
@ -704,8 +707,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
DeclHandlerAdaptor() : declHandler_(0) { }
|
DeclHandlerAdaptor() : declHandler_(0) { }
|
||||||
virtual ~DeclHandlerAdaptor() { }
|
virtual ~DeclHandlerAdaptor() { }
|
||||||
|
|
||||||
void setDeclHandler(SAX::basic_DeclHandler<stringT>& handler) { declHandler_ = &handler; }
|
void setDeclHandler(SAX::basic_DeclHandler<string_type>& handler) { declHandler_ = &handler; }
|
||||||
SAX::basic_DeclHandler<stringT>* getDeclHandler() const { return declHandler_; }
|
SAX::basic_DeclHandler<string_type>* getDeclHandler() const { return declHandler_; }
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE elementDecl(
|
virtual HRESULT STDMETHODCALLTYPE elementDecl(
|
||||||
/* [in] */ const wchar_t *pwchName,
|
/* [in] */ const wchar_t *pwchName,
|
||||||
|
@ -714,8 +717,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchModel)
|
/* [in] */ int cchModel)
|
||||||
{
|
{
|
||||||
if(declHandler_)
|
if(declHandler_)
|
||||||
declHandler_->elementDecl(string_adaptorT::construct_from_utf16(pwchName, cchName),
|
declHandler_->elementDecl(string_adaptor_type::construct_from_utf16(pwchName, cchName),
|
||||||
string_adaptorT::construct_from_utf16(pwchModel, cchModel));
|
string_adaptor_type::construct_from_utf16(pwchModel, cchModel));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // elementDecl
|
} // elementDecl
|
||||||
|
|
||||||
|
@ -732,11 +735,11 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchValue)
|
/* [in] */ int cchValue)
|
||||||
{
|
{
|
||||||
if(declHandler_)
|
if(declHandler_)
|
||||||
declHandler_->attributeDecl(string_adaptorT::construct_from_utf16(pwchElementName, cchElementName),
|
declHandler_->attributeDecl(string_adaptor_type::construct_from_utf16(pwchElementName, cchElementName),
|
||||||
string_adaptorT::construct_from_utf16(pwchAttributeName, cchAttributeName),
|
string_adaptor_type::construct_from_utf16(pwchAttributeName, cchAttributeName),
|
||||||
string_adaptorT::construct_from_utf16(pwchType, cchType),
|
string_adaptor_type::construct_from_utf16(pwchType, cchType),
|
||||||
string_adaptorT::construct_from_utf16(pwchValueDefault, cchValueDefault),
|
string_adaptor_type::construct_from_utf16(pwchValueDefault, cchValueDefault),
|
||||||
string_adaptorT::construct_from_utf16(pwchValue, cchValue));
|
string_adaptor_type::construct_from_utf16(pwchValue, cchValue));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // attributeDecl
|
} // attributeDecl
|
||||||
|
|
||||||
|
@ -747,8 +750,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchValue)
|
/* [in] */ int cchValue)
|
||||||
{
|
{
|
||||||
if(declHandler_)
|
if(declHandler_)
|
||||||
declHandler_->internalEntityDecl(string_adaptorT::construct_from_utf16(pwchName, cchName),
|
declHandler_->internalEntityDecl(string_adaptor_type::construct_from_utf16(pwchName, cchName),
|
||||||
string_adaptorT::construct_from_utf16(pwchValue, cchValue));
|
string_adaptor_type::construct_from_utf16(pwchValue, cchValue));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // internalEntityDecl
|
} // internalEntityDecl
|
||||||
|
|
||||||
|
@ -761,9 +764,9 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/* [in] */ int cchSystemId)
|
/* [in] */ int cchSystemId)
|
||||||
{
|
{
|
||||||
if(declHandler_)
|
if(declHandler_)
|
||||||
declHandler_->externalEntityDecl(string_adaptorT::construct_from_utf16(pwchName, cchName),
|
declHandler_->externalEntityDecl(string_adaptor_type::construct_from_utf16(pwchName, cchName),
|
||||||
string_adaptorT::construct_from_utf16(pwchPublicId, cchPublicId),
|
string_adaptor_type::construct_from_utf16(pwchPublicId, cchPublicId),
|
||||||
string_adaptorT::construct_from_utf16(pwchSystemId, cchSystemId));
|
string_adaptor_type::construct_from_utf16(pwchSystemId, cchSystemId));
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} // externalEntityDecl
|
} // externalEntityDecl
|
||||||
|
|
||||||
|
@ -781,13 +784,13 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
unsigned long __stdcall Release() { return 0; }
|
unsigned long __stdcall Release() { return 0; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SAX::basic_DeclHandler<stringT>* declHandler_;
|
SAX::basic_DeclHandler<string_type>* declHandler_;
|
||||||
}; // class DeclHandlerAdaptor
|
}; // class DeclHandlerAdaptor
|
||||||
|
|
||||||
class StreamAdaptor : public ISequentialStream
|
class StreamAdaptor : public ISequentialStream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StreamAdaptor(SAX::basic_InputSource<stringT>& source) :
|
StreamAdaptor(SAX::basic_InputSource<string_type>& source) :
|
||||||
source_(source)
|
source_(source)
|
||||||
{
|
{
|
||||||
} // StreamAdaptor
|
} // StreamAdaptor
|
||||||
|
@ -821,7 +824,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
unsigned long __stdcall Release() { return 1; }
|
unsigned long __stdcall Release() { return 1; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SAX::basic_InputSource<stringT>& source_;
|
SAX::basic_InputSource<string_type>& source_;
|
||||||
}; // StreamAdaptor
|
}; // StreamAdaptor
|
||||||
|
|
||||||
|
|
||||||
|
@ -835,11 +838,11 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
DeclHandlerAdaptor declHandler_;
|
DeclHandlerAdaptor declHandler_;
|
||||||
|
|
||||||
ISAXXMLReaderPtr reader_;
|
ISAXXMLReaderPtr reader_;
|
||||||
SAX::PropertyNames<stringT, string_adaptorT> properties_;
|
SAX::PropertyNames<string_type, string_adaptor_type> properties_;
|
||||||
}; // class msxml
|
}; // class msxml
|
||||||
|
|
||||||
template<class stringT, class COMInitializerT, class string_adaptorT>
|
template<class string_type, class T0, class T1>
|
||||||
msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::msxml2_wrapper()
|
msxml2_wrapper<string_type, T0, T1>::msxml2_wrapper()
|
||||||
{
|
{
|
||||||
reader_.CreateInstance("Msxml2.SAXXMLReader.4.0");
|
reader_.CreateInstance("Msxml2.SAXXMLReader.4.0");
|
||||||
if(reader_.GetInterfacePtr() == 0)
|
if(reader_.GetInterfacePtr() == 0)
|
||||||
|
@ -862,67 +865,67 @@ msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::msxml2_wrapper()
|
||||||
reader_->putProperty(L"http://xml.org/sax/properties/declaration-handler", wrapper);
|
reader_->putProperty(L"http://xml.org/sax/properties/declaration-handler", wrapper);
|
||||||
} // msxml2_wrapper
|
} // msxml2_wrapper
|
||||||
|
|
||||||
template<class stringT, class COMInitializerT, class string_adaptorT>
|
template<class string_type, class T0, class T1>
|
||||||
msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::~msxml2_wrapper()
|
msxml2_wrapper<string_type, T0, T1>::~msxml2_wrapper()
|
||||||
{
|
{
|
||||||
if(reader_.GetInterfacePtr())
|
if(reader_.GetInterfacePtr())
|
||||||
reader_.Release();
|
reader_.Release();
|
||||||
} // ~msxml2_wrapper
|
} // ~msxml2_wrapper
|
||||||
|
|
||||||
template<class stringT, class COMInitializerT, class string_adaptorT>
|
template<class string_type, class T0, class T1>
|
||||||
bool msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::getFeature(const stringT& name) const
|
bool msxml2_wrapper<string_type, T0, T1>::getFeature(const string_type& name) const
|
||||||
{
|
{
|
||||||
VARIANT_BOOL feature;
|
VARIANT_BOOL feature;
|
||||||
std::wstring wName(string_adaptorT::asStdWString(name));
|
std::wstring wName(string_adaptor_type::asStdWString(name));
|
||||||
reader_->getFeature(wName.c_str(), &feature);
|
reader_->getFeature(wName.c_str(), &feature);
|
||||||
return (feature == VARIANT_TRUE) ? true : false;
|
return (feature == VARIANT_TRUE) ? true : false;
|
||||||
} // msxml2_wrapper::getFeature
|
} // msxml2_wrapper::getFeature
|
||||||
|
|
||||||
template<class stringT, class COMInitializerT, class string_adaptorT>
|
template<class string_type, class T0, class T1>
|
||||||
void msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::setFeature(const stringT& name, bool value)
|
void msxml2_wrapper<string_type, T0, T1>::setFeature(const string_type& name, bool value)
|
||||||
{
|
{
|
||||||
std::wstring wName(string_adaptorT::asStdWString(name));
|
std::wstring wName(string_adaptor_type::asStdWString(name));
|
||||||
reader_->putFeature(wName.c_str(), value);
|
reader_->putFeature(wName.c_str(), value);
|
||||||
} // setFeature
|
} // setFeature
|
||||||
|
|
||||||
template<class stringT, class COMInitializerT, class string_adaptorT>
|
template<class string_type, class T0, class T1>
|
||||||
void msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::setErrorHandler(SAX::basic_ErrorHandler<stringT>& handler)
|
void msxml2_wrapper<string_type, T0, T1>::setErrorHandler(SAX::basic_ErrorHandler<string_type>& handler)
|
||||||
{
|
{
|
||||||
errorHandler_.setErrorHandler(handler);
|
errorHandler_.setErrorHandler(handler);
|
||||||
} // setErrorHandler
|
} // setErrorHandler
|
||||||
|
|
||||||
template<class stringT, class COMInitializerT, class string_adaptorT>
|
template<class string_type, class T0, class T1>
|
||||||
SAX::basic_ErrorHandler<stringT>* msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::getErrorHandler() const
|
SAX::basic_ErrorHandler<string_type>* msxml2_wrapper<string_type, T0, T1>::getErrorHandler() const
|
||||||
{
|
{
|
||||||
return errorHandler_.getErrorHandler();
|
return errorHandler_.getErrorHandler();
|
||||||
} // getErrorHandler
|
} // getErrorHandler
|
||||||
|
|
||||||
template<class stringT, class COMInitializerT, class string_adaptorT>
|
template<class string_type, class T0, class T1>
|
||||||
#ifndef ARABICA_VS6_WORKAROUND
|
#ifndef ARABICA_VS6_WORKAROUND
|
||||||
std::auto_ptr<typename SAX::basic_XMLReader<stringT>::PropertyBase> msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::doGetProperty(const stringT& name)
|
std::auto_ptr<typename SAX::basic_XMLReader<string_type>::PropertyBase> msxml2_wrapper<string_type, T0, T1>::doGetProperty(const string_type& name)
|
||||||
#else
|
#else
|
||||||
std::auto_ptr<SAX::basic_XMLReader<stringT>::PropertyBase> msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::doGetProperty(const stringT& name)
|
std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase> msxml2_wrapper<string_type, T0, T1>::doGetProperty(const string_type& name)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if(name == properties_.lexicalHandler)
|
if(name == properties_.lexicalHandler)
|
||||||
{
|
{
|
||||||
Property<SAX::basic_LexicalHandler<stringT>*>* prop = new Property<SAX::basic_LexicalHandler<stringT>*>(lexicalHandler_.getLexicalHandler());
|
Property<SAX::basic_LexicalHandler<string_type>*>* prop = new Property<SAX::basic_LexicalHandler<string_type>*>(lexicalHandler_.getLexicalHandler());
|
||||||
return std::auto_ptr<SAX::basic_XMLReader<stringT>::PropertyBase>(prop);
|
return std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase>(prop);
|
||||||
}
|
}
|
||||||
if(name == properties_.declHandler)
|
if(name == properties_.declHandler)
|
||||||
{
|
{
|
||||||
Property<SAX::basic_DeclHandler<stringT>*>* prop = new Property<SAX::basic_DeclHandler<stringT>*>(declHandler_.getDeclHandler());
|
Property<SAX::basic_DeclHandler<string_type>*>* prop = new Property<SAX::basic_DeclHandler<string_type>*>(declHandler_.getDeclHandler());
|
||||||
return std::auto_ptr<SAX::basic_XMLReader<stringT>::PropertyBase>(prop);
|
return std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase>(prop);
|
||||||
}
|
}
|
||||||
throw SAX::SAXNotRecognizedException("Property not recognized ");
|
throw SAX::SAXNotRecognizedException("Property not recognized ");
|
||||||
} // doGetProperty
|
} // doGetProperty
|
||||||
|
|
||||||
template<class stringT, class COMInitializerT, class string_adaptorT>
|
template<class string_type, class T0, class T1>
|
||||||
void msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::doSetProperty(const stringT& name, std::auto_ptr<SAX::basic_XMLReader<stringT>::PropertyBase> value)
|
void msxml2_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name, std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase> value)
|
||||||
{
|
{
|
||||||
if(name == properties_.lexicalHandler)
|
if(name == properties_.lexicalHandler)
|
||||||
{
|
{
|
||||||
Property<SAX::basic_LexicalHandler<stringT>&>* prop = dynamic_cast<Property<SAX::basic_LexicalHandler<stringT>&>*>(value.get());
|
Property<SAX::basic_LexicalHandler<string_type>&>* prop = dynamic_cast<Property<SAX::basic_LexicalHandler<string_type>&>*>(value.get());
|
||||||
|
|
||||||
if(!prop)
|
if(!prop)
|
||||||
throw std::runtime_error("bad_cast: Property LexicalHandler is wrong type, should be SAX::LexicalHandler&");
|
throw std::runtime_error("bad_cast: Property LexicalHandler is wrong type, should be SAX::LexicalHandler&");
|
||||||
|
@ -932,7 +935,7 @@ void msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::doSetProperty(co
|
||||||
} // if ...
|
} // if ...
|
||||||
if(name == properties_.declHandler)
|
if(name == properties_.declHandler)
|
||||||
{
|
{
|
||||||
Property<SAX::basic_DeclHandler<stringT>&>* prop = dynamic_cast<Property<SAX::basic_DeclHandler<stringT>&>*>(value.get());
|
Property<SAX::basic_DeclHandler<string_type>&>* prop = dynamic_cast<Property<SAX::basic_DeclHandler<string_type>&>*>(value.get());
|
||||||
|
|
||||||
if(!prop)
|
if(!prop)
|
||||||
throw std::runtime_error("bad_cast: Property DeclHandler is wrong type, should be SAX::DeclHandler&");
|
throw std::runtime_error("bad_cast: Property DeclHandler is wrong type, should be SAX::DeclHandler&");
|
||||||
|
@ -943,12 +946,12 @@ void msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::doSetProperty(co
|
||||||
throw SAX::SAXNotRecognizedException("Property not recognized ");
|
throw SAX::SAXNotRecognizedException("Property not recognized ");
|
||||||
} // doSetProperty
|
} // doSetProperty
|
||||||
|
|
||||||
template<class stringT, class COMInitializerT, class string_adaptorT>
|
template<class string_type, class T0, class T1>
|
||||||
void msxml2_wrapper<stringT, COMInitializerT, string_adaptorT>::parse(SAX::basic_InputSource<stringT>& source)
|
void msxml2_wrapper<string_type, T0, T1>::parse(SAX::basic_InputSource<string_type>& source)
|
||||||
{
|
{
|
||||||
if(source.getByteStream() == 0)
|
if(source.getByteStream() == 0)
|
||||||
{
|
{
|
||||||
std::wstring wSysId(string_adaptorT::asStdWString(source.getSystemId()));
|
std::wstring wSysId(string_adaptor_type::asStdWString(source.getSystemId()));
|
||||||
reader_->parseURL(wSysId.c_str());
|
reader_->parseURL(wSysId.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue