mirror of
https://github.com/jezhiggins/arabica
synced 2024-12-26 21:58:39 +01:00
removed basic_ prefixes from SAX classes, removed typedefs
This commit is contained in:
parent
7d46f6f4e2
commit
a76b137b60
89 changed files with 819 additions and 975 deletions
|
@ -27,7 +27,7 @@ int main(int argc, char* argv[])
|
||||||
for(int i = 1; i < argc; ++i)
|
for(int i = 1; i < argc; ++i)
|
||||||
{
|
{
|
||||||
std::string file(argv[i]);
|
std::string file(argv[i]);
|
||||||
Arabica::SAX::InputSource is;
|
Arabica::SAX::InputSource<std::string> is;
|
||||||
is.setSystemId(file);
|
is.setSystemId(file);
|
||||||
|
|
||||||
if(file != "-")
|
if(file != "-")
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
// EntityResolver
|
// EntityResolver
|
||||||
Arabica::SAX::InputSource SimpleHandler::resolveEntity(const std::string& publicId, const std::string& systemId)
|
Arabica::SAX::InputSource<std::string> SimpleHandler::resolveEntity(const std::string& publicId, const std::string& systemId)
|
||||||
{
|
{
|
||||||
return Arabica::SAX::InputSource();
|
return Arabica::SAX::InputSource<std::string>();
|
||||||
} // resolveEntity
|
} // resolveEntity
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
|
@ -57,7 +57,7 @@ void SimpleHandler::endPrefixMapping(const std::string& prefix)
|
||||||
} // startPrefixMapping
|
} // startPrefixMapping
|
||||||
|
|
||||||
void SimpleHandler::startElement(const std::string& namespaceURI, const std::string& localName,
|
void SimpleHandler::startElement(const std::string& namespaceURI, const std::string& localName,
|
||||||
const std::string& qName, const Arabica::SAX::Attributes& atts)
|
const std::string& qName, const Arabica::SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(localName.length())
|
if(localName.length())
|
||||||
std::cout << "Start Element: " << namespaceURI << ":" << localName << std::endl;
|
std::cout << "Start Element: " << namespaceURI << ":" << localName << std::endl;
|
||||||
|
@ -93,17 +93,17 @@ void SimpleHandler::skippedEntity(const std::string& name)
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
// ErrorHandler
|
// ErrorHandler
|
||||||
void SimpleHandler::warning(const Arabica::SAX::SAXParseException& exception)
|
void SimpleHandler::warning(const Arabica::SAX::SAXParseException<std::string>& exception)
|
||||||
{
|
{
|
||||||
std::cerr << "WARNING: " << exception.what() << std::endl;
|
std::cerr << "WARNING: " << exception.what() << std::endl;
|
||||||
} // warning
|
} // warning
|
||||||
|
|
||||||
void SimpleHandler::error(const Arabica::SAX::SAXParseException& exception)
|
void SimpleHandler::error(const Arabica::SAX::SAXParseException<std::string>& exception)
|
||||||
{
|
{
|
||||||
std::cerr << "ERROR : " << exception.what() << std::endl;
|
std::cerr << "ERROR : " << exception.what() << std::endl;
|
||||||
} // error
|
} // error
|
||||||
|
|
||||||
void SimpleHandler::fatalError(const Arabica::SAX::SAXParseException& exception)
|
void SimpleHandler::fatalError(const Arabica::SAX::SAXParseException<std::string>& exception)
|
||||||
{
|
{
|
||||||
std::cerr << "FATAL : " << exception.what() << std::endl;
|
std::cerr << "FATAL : " << exception.what() << std::endl;
|
||||||
} // fatalError
|
} // fatalError
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
#include <SAX/ext/DeclHandler.hpp>
|
#include <SAX/ext/DeclHandler.hpp>
|
||||||
#include <SAX/SAXException.hpp>
|
#include <SAX/SAXException.hpp>
|
||||||
|
|
||||||
class SimpleHandler : public Arabica::SAX::EntityResolver,
|
class SimpleHandler : public Arabica::SAX::EntityResolver<std::string>,
|
||||||
public Arabica::SAX::DTDHandler,
|
public Arabica::SAX::DTDHandler<std::string>,
|
||||||
public Arabica::SAX::ContentHandler,
|
public Arabica::SAX::ContentHandler<std::string>,
|
||||||
public Arabica::SAX::ErrorHandler,
|
public Arabica::SAX::ErrorHandler<std::string>,
|
||||||
public Arabica::SAX::LexicalHandler,
|
public Arabica::SAX::LexicalHandler<std::string>,
|
||||||
public Arabica::SAX::DeclHandler
|
public Arabica::SAX::DeclHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SimpleHandler() { }
|
SimpleHandler() { }
|
||||||
|
@ -26,7 +26,7 @@ public:
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
// EntityResolver
|
// EntityResolver
|
||||||
virtual Arabica::SAX::InputSource resolveEntity(const std::string& publicId, const std::string& systemId);
|
virtual Arabica::SAX::InputSource<std::string> resolveEntity(const std::string& publicId, const std::string& systemId);
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
// DTDHandler
|
// DTDHandler
|
||||||
|
@ -56,9 +56,9 @@ public:
|
||||||
|
|
||||||
/////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////
|
||||||
// ErrorHandler
|
// ErrorHandler
|
||||||
virtual void warning(const Arabica::SAX::SAXParseException&);
|
virtual void warning(const Arabica::SAX::SAXParseException<std::string>&);
|
||||||
virtual void error(const Arabica::SAX::SAXParseException&);
|
virtual void error(const Arabica::SAX::SAXParseException<std::string>&);
|
||||||
virtual void fatalError(const Arabica::SAX::SAXParseException& exception);
|
virtual void fatalError(const Arabica::SAX::SAXParseException<std::string>& exception);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////
|
||||||
// LexicalHandler
|
// LexicalHandler
|
||||||
|
|
|
@ -19,18 +19,18 @@
|
||||||
#include <SAX/XMLReader.hpp>
|
#include <SAX/XMLReader.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
class SAX2PYX : public Arabica::SAX::DefaultHandler
|
class SAX2PYX : public Arabica::SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void startElement(const std::string& namespaceURI, const std::string& localName,
|
virtual void startElement(const std::string& namespaceURI, const std::string& localName,
|
||||||
const std::string& qName, const Arabica::SAX::Attributes& atts);
|
const std::string& qName, const Arabica::SAX::Attributes<std::string>& atts);
|
||||||
virtual void endElement(const std::string& namespaceURI, const std::string& localName,
|
virtual void endElement(const std::string& namespaceURI, const std::string& localName,
|
||||||
const std::string& qName);
|
const std::string& qName);
|
||||||
virtual void characters(const std::string& ch);
|
virtual void characters(const std::string& ch);
|
||||||
virtual void processingInstruction(const std::string& target, const std::string& data);
|
virtual void processingInstruction(const std::string& target, const std::string& data);
|
||||||
|
|
||||||
virtual void warning(const Arabica::SAX::SAXParseException& e) { fatalError(e); }
|
virtual void warning(const Arabica::SAX::SAXParseException<std::string>& e) { fatalError(e); }
|
||||||
virtual void error(const Arabica::SAX::SAXParseException& e) { fatalError(e); }
|
virtual void error(const Arabica::SAX::SAXParseException<std::string>& e) { fatalError(e); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string escape(const std::string& str) const;
|
std::string escape(const std::string& str) const;
|
||||||
|
@ -55,7 +55,7 @@ int main(int argc, char* argv[])
|
||||||
myParser.setErrorHandler(handler);
|
myParser.setErrorHandler(handler);
|
||||||
myParser.setFeature("prohibit-dtd", false);
|
myParser.setFeature("prohibit-dtd", false);
|
||||||
|
|
||||||
Arabica::SAX::InputSource is(argv[i]);
|
Arabica::SAX::InputSource<std::string> is(argv[i]);
|
||||||
myParser.parse(is);
|
myParser.parse(is);
|
||||||
} // try
|
} // try
|
||||||
catch(std::runtime_error& e)
|
catch(std::runtime_error& e)
|
||||||
|
@ -69,7 +69,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
|
|
||||||
void SAX2PYX::startElement(const std::string&, const std::string& localName,
|
void SAX2PYX::startElement(const std::string&, const std::string& localName,
|
||||||
const std::string&, const Arabica::SAX::Attributes& atts)
|
const std::string&, const Arabica::SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
std::cout << '(' << localName << std::endl;
|
std::cout << '(' << localName << std::endl;
|
||||||
|
|
||||||
|
|
|
@ -49,12 +49,12 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
if(file != "-")
|
if(file != "-")
|
||||||
{
|
{
|
||||||
Arabica::SAX::InputSource is(file);
|
Arabica::SAX::InputSource<std::string> is(file);
|
||||||
parser.parse(is);
|
parser.parse(is);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Arabica::SAX::InputSource is;
|
Arabica::SAX::InputSource<std::string> is;
|
||||||
is.setSystemId("stdin");
|
is.setSystemId("stdin");
|
||||||
is.setByteStream(std::cin);
|
is.setByteStream(std::cin);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ int main(int argc, char* argv[])
|
||||||
{ // narrow
|
{ // narrow
|
||||||
Arabica::SAX::FeatureNames<std::string> fNames;
|
Arabica::SAX::FeatureNames<std::string> fNames;
|
||||||
Arabica::SAX::XMLReader<std::string> parser;
|
Arabica::SAX::XMLReader<std::string> parser;
|
||||||
Arabica::SAX::Writer writer(std::cout, 4);
|
Arabica::SAX::Writer<std::string> writer(std::cout, 4);
|
||||||
Arabica::SAX::CatchErrorHandler<std::string> eh;
|
Arabica::SAX::CatchErrorHandler<std::string> eh;
|
||||||
|
|
||||||
writer.setParent(parser);
|
writer.setParent(parser);
|
||||||
|
@ -30,7 +30,7 @@ int main(int argc, char* argv[])
|
||||||
for(int i = 1; i < argc; ++i)
|
for(int i = 1; i < argc; ++i)
|
||||||
{
|
{
|
||||||
std::string file(argv[i]);
|
std::string file(argv[i]);
|
||||||
Arabica::SAX::InputSource is;
|
Arabica::SAX::InputSource<std::string> is;
|
||||||
is.setSystemId(file);
|
is.setSystemId(file);
|
||||||
|
|
||||||
if(file != "-")
|
if(file != "-")
|
||||||
|
|
|
@ -18,19 +18,19 @@
|
||||||
#include <SAX/helpers/XMLBaseSupport.hpp>
|
#include <SAX/helpers/XMLBaseSupport.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
class hrefPrinter : public Arabica::SAX::DefaultHandler
|
class hrefPrinter : public Arabica::SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void startElement(const std::string& namespaceURI, const std::string& localName,
|
virtual void startElement(const std::string& namespaceURI, const std::string& localName,
|
||||||
const std::string& qName, const Arabica::SAX::Attributes& atts);
|
const std::string& qName, const Arabica::SAX::Attributes<std::string>& atts);
|
||||||
virtual void endElement(const std::string& namespaceURI, const std::string& localName,
|
virtual void endElement(const std::string& namespaceURI, const std::string& localName,
|
||||||
const std::string& qName);
|
const std::string& qName);
|
||||||
|
|
||||||
virtual void warning(const Arabica::SAX::SAXParseException& e) { fatalError(e); }
|
virtual void warning(const Arabica::SAX::SAXParseException<std::string>& e) { fatalError(e); }
|
||||||
virtual void error(const Arabica::SAX::SAXParseException& e) { fatalError(e); }
|
virtual void error(const Arabica::SAX::SAXParseException<std::string>& e) { fatalError(e); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Arabica::SAX::XMLBaseSupport xmlbaseTracker_;
|
Arabica::SAX::XMLBaseSupport<std::string> xmlbaseTracker_;
|
||||||
}; // class SimpleHandler
|
}; // class SimpleHandler
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
|
@ -51,7 +51,7 @@ int main(int argc, char* argv[])
|
||||||
myParser.setContentHandler(handler);
|
myParser.setContentHandler(handler);
|
||||||
myParser.setErrorHandler(handler);
|
myParser.setErrorHandler(handler);
|
||||||
|
|
||||||
Arabica::SAX::InputSource is(argv[i]);
|
Arabica::SAX::InputSource<std::string> is(argv[i]);
|
||||||
myParser.parse(is);
|
myParser.parse(is);
|
||||||
} // try
|
} // try
|
||||||
catch(std::runtime_error& e)
|
catch(std::runtime_error& e)
|
||||||
|
@ -65,7 +65,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
|
|
||||||
void hrefPrinter::startElement(const std::string&, const std::string& localName,
|
void hrefPrinter::startElement(const std::string&, const std::string& localName,
|
||||||
const std::string&, const Arabica::SAX::Attributes& atts)
|
const std::string&, const Arabica::SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
xmlbaseTracker_.startElement(atts);
|
xmlbaseTracker_.startElement(atts);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ int main(int argc, char* argv[])
|
||||||
for(int i = 2; i < argc; ++i)
|
for(int i = 2; i < argc; ++i)
|
||||||
{
|
{
|
||||||
std::string file(argv[i]);
|
std::string file(argv[i]);
|
||||||
Arabica::SAX::InputSource is;
|
Arabica::SAX::InputSource<std::string> is;
|
||||||
is.setSystemId(file);
|
is.setSystemId(file);
|
||||||
|
|
||||||
if(file != "-")
|
if(file != "-")
|
||||||
|
|
|
@ -33,7 +33,7 @@ int main(int argc, const char* argv[])
|
||||||
std::ostringstream errors;
|
std::ostringstream errors;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Arabica::SAX::InputSource source(argv[2]);
|
Arabica::SAX::InputSource<std::string> source(argv[2]);
|
||||||
std::auto_ptr<Arabica::XSLT::Stylesheet> stylesheet = compiler.compile(source);
|
std::auto_ptr<Arabica::XSLT::Stylesheet> stylesheet = compiler.compile(source);
|
||||||
if(stylesheet.get() == 0)
|
if(stylesheet.get() == 0)
|
||||||
{
|
{
|
||||||
|
@ -64,7 +64,7 @@ int main(int argc, const char* argv[])
|
||||||
|
|
||||||
Arabica::DOM::Document<std::string> buildDOM(const std::string& filename)
|
Arabica::DOM::Document<std::string> buildDOM(const std::string& filename)
|
||||||
{
|
{
|
||||||
Arabica::SAX::InputSource is(filename);
|
Arabica::SAX::InputSource<std::string> is(filename);
|
||||||
Arabica::SAX2DOM::Parser<std::string> parser;
|
Arabica::SAX2DOM::Parser<std::string> parser;
|
||||||
parser.parse(is);
|
parser.parse(is);
|
||||||
|
|
||||||
|
|
|
@ -23,17 +23,17 @@ namespace SAX2DOM
|
||||||
template<class stringT,
|
template<class stringT,
|
||||||
class string_adaptorT = Arabica::default_string_adaptor<stringT>,
|
class string_adaptorT = Arabica::default_string_adaptor<stringT>,
|
||||||
class SAX_parser = Arabica::SAX::XMLReader<stringT, string_adaptorT> >
|
class SAX_parser = Arabica::SAX::XMLReader<stringT, string_adaptorT> >
|
||||||
class Parser : protected Arabica::SAX::basic_DefaultHandler<stringT>
|
class Parser : protected Arabica::SAX::DefaultHandler<stringT>
|
||||||
{
|
{
|
||||||
typedef Arabica::SAX::basic_EntityResolver<stringT> EntityResolverT;
|
typedef Arabica::SAX::EntityResolver<stringT> EntityResolverT;
|
||||||
typedef Arabica::SAX::basic_ErrorHandler<stringT> ErrorHandlerT;
|
typedef Arabica::SAX::ErrorHandler<stringT> ErrorHandlerT;
|
||||||
typedef Arabica::SAX::basic_LexicalHandler<stringT> LexicalHandlerT;
|
typedef Arabica::SAX::LexicalHandler<stringT> LexicalHandlerT;
|
||||||
typedef Arabica::SAX::basic_DeclHandler<stringT> DeclHandlerT;
|
typedef Arabica::SAX::DeclHandler<stringT> DeclHandlerT;
|
||||||
typedef Arabica::SAX::basic_InputSource<stringT> InputSourceT;
|
typedef Arabica::SAX::InputSource<stringT> InputSourceT;
|
||||||
typedef Arabica::SimpleDOM::EntityImpl<stringT, string_adaptorT> EntityT;
|
typedef Arabica::SimpleDOM::EntityImpl<stringT, string_adaptorT> EntityT;
|
||||||
typedef Arabica::SimpleDOM::NotationImpl<stringT, string_adaptorT> NotationT;
|
typedef Arabica::SimpleDOM::NotationImpl<stringT, string_adaptorT> NotationT;
|
||||||
typedef Arabica::SimpleDOM::ElementImpl<stringT, string_adaptorT> ElementT;
|
typedef Arabica::SimpleDOM::ElementImpl<stringT, string_adaptorT> ElementT;
|
||||||
typedef typename Arabica::SAX::basic_ErrorHandler<stringT>::SAXParseExceptionT SAXParseExceptionT;
|
typedef typename Arabica::SAX::ErrorHandler<stringT>::SAXParseExceptionT SAXParseExceptionT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Parser() :
|
Parser() :
|
||||||
|
@ -187,7 +187,7 @@ class Parser : protected Arabica::SAX::basic_DefaultHandler<stringT>
|
||||||
} // endDocument
|
} // endDocument
|
||||||
|
|
||||||
virtual void startElement(const stringT& namespaceURI, const stringT& localName,
|
virtual void startElement(const stringT& namespaceURI, const stringT& localName,
|
||||||
const stringT& qName, const Arabica::SAX::basic_Attributes<stringT>& atts)
|
const stringT& qName, const Arabica::SAX::Attributes<stringT>& atts)
|
||||||
{
|
{
|
||||||
if(currentNode_ == 0)
|
if(currentNode_ == 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -17,16 +17,16 @@ namespace SAX
|
||||||
* Interface for an element's attribute specifications.
|
* Interface for an element's attribute specifications.
|
||||||
*
|
*
|
||||||
* <p>This is the original SAX1 interface for reporting an element's
|
* <p>This is the original SAX1 interface for reporting an element's
|
||||||
* attributes. Unlike the new {@link basic_Attributes Attributes}
|
* attributes. Unlike the new {@link Attributes Attributes}
|
||||||
* interface, it does not support Namespace-related information.</p>
|
* interface, it does not support Namespace-related information.</p>
|
||||||
*
|
*
|
||||||
* <p>When an attribute list is supplied as part of a
|
* <p>When an attribute list is supplied as part of a
|
||||||
* {@link basic_DocumentHandler#startElement startElement}
|
* {@link DocumentHandler#startElement startElement}
|
||||||
* event, the list will return valid results only during the
|
* event, the list will return valid results only during the
|
||||||
* scope of the event; once the event handler returns control
|
* scope of the event; once the event handler returns control
|
||||||
* to the parser, the attribute list is invalid. To save a
|
* to the parser, the attribute list is invalid. To save a
|
||||||
* persistent copy of the attribute list, use the SAX1
|
* persistent copy of the attribute list, use the SAX1
|
||||||
* {@link basic_AttributeListImpl AttributeListImpl}
|
* {@link AttributeListImpl AttributeListImpl}
|
||||||
* helper class.</p>
|
* helper class.</p>
|
||||||
*
|
*
|
||||||
* <p>An attribute list includes only attributes that have been
|
* <p>An attribute list includes only attributes that have been
|
||||||
|
@ -65,22 +65,22 @@ namespace SAX
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @deprecated This interface has been replaced by the SAX2
|
* @deprecated This interface has been replaced by the SAX2
|
||||||
* {@link basic_Attributes Attributes}
|
* {@link Attributes Attributes}
|
||||||
* interface, which includes Namespace support.
|
* interface, which includes Namespace support.
|
||||||
* @since SAX 1.0
|
* @since SAX 1.0
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_DocumentHandler#startElement startElement
|
* @see DocumentHandler#startElement startElement
|
||||||
* @see basic_AttributeListImpl
|
* @see AttributeListImpl
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_AttributeList
|
class AttributeList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
|
|
||||||
virtual ~basic_AttributeList() { }
|
virtual ~AttributeList() { }
|
||||||
|
|
||||||
//
|
//
|
||||||
// Iteration methods.
|
// Iteration methods.
|
||||||
|
@ -186,11 +186,6 @@ public:
|
||||||
|
|
||||||
}; // class AttributeList
|
}; // class AttributeList
|
||||||
|
|
||||||
typedef basic_AttributeList<std::string> AttributeList;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_AttributeList<std::wstring> wAttributeList;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace SAX
|
||||||
* may not be available.</p>
|
* may not be available.</p>
|
||||||
*
|
*
|
||||||
* <p>This interface replaces the now-deprecated SAX1 {@link
|
* <p>This interface replaces the now-deprecated SAX1 {@link
|
||||||
* basic_AttributeList AttributeList} interface, which does not
|
* AttributeList AttributeList} interface, which does not
|
||||||
* contain Namespace support. In addition to Namespace support, it
|
* contain Namespace support. In addition to Namespace support, it
|
||||||
* adds the <var>getIndex</var> methods (below).</p>
|
* adds the <var>getIndex</var> methods (below).</p>
|
||||||
*
|
*
|
||||||
|
@ -50,15 +50,15 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_AttributesImpl
|
* @see AttributesImpl
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_Attributes
|
class Attributes
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
|
|
||||||
virtual ~basic_Attributes() { }
|
virtual ~Attributes() { }
|
||||||
|
|
||||||
//
|
//
|
||||||
// indexed access
|
// indexed access
|
||||||
|
@ -227,11 +227,6 @@ public:
|
||||||
|
|
||||||
}; // class Attributes
|
}; // class Attributes
|
||||||
|
|
||||||
typedef basic_Attributes<std::string> Attributes;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_Attributes<std::wstring> wAttributes;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ namespace Arabica
|
||||||
namespace SAX
|
namespace SAX
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class string_type> class basic_Locator;
|
template<class string_type> class Locator;
|
||||||
template<class string_type> class basic_Attributes;
|
template<class string_type> class Attributes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive notification of the logical content of a document.
|
* Receive notification of the logical content of a document.
|
||||||
|
@ -22,7 +22,7 @@ template<class string_type> class basic_Attributes;
|
||||||
* <p>This is the main interface that most SAX applications
|
* <p>This is the main interface that most SAX applications
|
||||||
* implement: if the application needs to be informed of basic parsing
|
* implement: if the application needs to be informed of basic parsing
|
||||||
* events, it implements this interface and registers an instance with
|
* events, it implements this interface and registers an instance with
|
||||||
* the SAX parser using the {@link basic_XMLReader#setContentHandler
|
* the SAX parser using the {@link XMLReader#setContentHandler
|
||||||
* setContentHandler} method. The parser uses the instance to report
|
* setContentHandler} method. The parser uses the instance to report
|
||||||
* basic document-related events like the start and end of elements
|
* basic document-related events like the start and end of elements
|
||||||
* and character data.</p>
|
* and character data.</p>
|
||||||
|
@ -42,19 +42,19 @@ template<class string_type> class basic_Attributes;
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_XMLReader
|
* @see XMLReader
|
||||||
* @see basic_DTDHandler
|
* @see DTDHandler
|
||||||
* @see basic_ErrorHandler
|
* @see ErrorHandler
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_ContentHandler
|
class ContentHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef basic_Locator<stringT> LocatorT;
|
typedef Locator<stringT> LocatorT;
|
||||||
typedef basic_Attributes<stringT> AttributesT;
|
typedef Attributes<stringT> AttributesT;
|
||||||
|
|
||||||
virtual ~basic_ContentHandler() { }
|
virtual ~ContentHandler() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive an object for locating the origin of SAX document events.
|
* Receive an object for locating the origin of SAX document events.
|
||||||
|
@ -79,7 +79,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param locator An object that can return the location of
|
* @param locator An object that can return the location of
|
||||||
* any SAX document event.
|
* any SAX document event.
|
||||||
* @see basic_Locator
|
* @see Locator
|
||||||
*/
|
*/
|
||||||
virtual void setDocumentLocator(const LocatorT& locator) = 0;
|
virtual void setDocumentLocator(const LocatorT& locator) = 0;
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ public:
|
||||||
* Receive notification of the beginning of a document.
|
* Receive notification of the beginning of a document.
|
||||||
*
|
*
|
||||||
* <p>The SAX parser will invoke this method only once, before any
|
* <p>The SAX parser will invoke this method only once, before any
|
||||||
* other methods in this interface or in {@link basic_DTDHandler
|
* other methods in this interface or in {@link DTDHandler
|
||||||
* DTDHandler} (except for {@link #setDocumentLocator
|
* DTDHandler} (except for {@link #setDocumentLocator
|
||||||
* setDocumentLocator}).</p>
|
* setDocumentLocator}).</p>
|
||||||
*
|
*
|
||||||
|
@ -219,7 +219,7 @@ public:
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see #endElement
|
* @see #endElement
|
||||||
* @see basic_Attributes
|
* @see Attributes
|
||||||
*/
|
*/
|
||||||
virtual void startElement(const stringT& namespaceURI, const stringT& localName,
|
virtual void startElement(const stringT& namespaceURI, const stringT& localName,
|
||||||
const stringT& qName, const AttributesT& atts) = 0;
|
const stringT& qName, const AttributesT& atts) = 0;
|
||||||
|
@ -267,7 +267,7 @@ public:
|
||||||
* @param ch The characters from the XML document.
|
* @param ch The characters from the XML document.
|
||||||
* @exception SAXException Any SAX exception.
|
* @exception SAXException Any SAX exception.
|
||||||
* @see #ignorableWhitespace
|
* @see #ignorableWhitespace
|
||||||
* @see basic_Locator
|
* @see Locator
|
||||||
*/
|
*/
|
||||||
virtual void characters(const stringT& ch) = 0;
|
virtual void characters(const stringT& ch) = 0;
|
||||||
/**
|
/**
|
||||||
|
@ -332,12 +332,7 @@ public:
|
||||||
* @exception SAXException Any SAX exception.
|
* @exception SAXException Any SAX exception.
|
||||||
*/
|
*/
|
||||||
virtual void skippedEntity(const stringT& name) = 0;
|
virtual void skippedEntity(const stringT& name) = 0;
|
||||||
}; // class basic_ContentHandler
|
}; // class ContentHandler
|
||||||
|
|
||||||
typedef basic_ContentHandler<std::string> ContentHandler;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_ContentHandler<std::wstring> wContentHandler;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace SAX
|
||||||
* declared; however, all DTD events must be reported after the
|
* declared; however, all DTD events must be reported after the
|
||||||
* document handler's startDocument event, and before the first
|
* document handler's startDocument event, and before the first
|
||||||
* startElement event.
|
* startElement event.
|
||||||
* (If the {@link basic_LexicalHandler LexicalHandler} is
|
* (If the {@link LexicalHandler LexicalHandler} is
|
||||||
* used, these events must also be reported before the endDTD event.)
|
* used, these events must also be reported before the endDTD event.)
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
|
@ -47,16 +47,16 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @see basic_XMLReader#setDTDHandler
|
* @see XMLReader#setDTDHandler
|
||||||
*/
|
*/
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_DTDHandler
|
class DTDHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
|
|
||||||
virtual ~basic_DTDHandler() { }
|
virtual ~DTDHandler() { }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,7 +70,7 @@ public:
|
||||||
* When a system identifier is present, applications are responsible
|
* When a system identifier is present, applications are responsible
|
||||||
* for knowing if it is used as a URL, and absolutizing it against
|
* for knowing if it is used as a URL, and absolutizing it against
|
||||||
* the appropriate URI when appropriate.
|
* the appropriate URI when appropriate.
|
||||||
* That base URI is available from {@link basic_Locator#getSystemId} during
|
* That base URI is available from {@link Locator#getSystemId} during
|
||||||
* this callback, assuming the parser provides a Locator.</p>
|
* this callback, assuming the parser provides a Locator.</p>
|
||||||
*
|
*
|
||||||
* <p>At least one of publicId and systemId must be non-empty. </p>
|
* <p>At least one of publicId and systemId must be non-empty. </p>
|
||||||
|
@ -85,7 +85,7 @@ public:
|
||||||
* none was given.
|
* none was given.
|
||||||
* @exception SAXException Any SAX exception.
|
* @exception SAXException Any SAX exception.
|
||||||
* @see #unparsedEntityDecl
|
* @see #unparsedEntityDecl
|
||||||
* @see basic_Attributes
|
* @see Attributes
|
||||||
*/
|
*/
|
||||||
virtual void notationDecl(const stringT& name,
|
virtual void notationDecl(const stringT& name,
|
||||||
const stringT& publicId,
|
const stringT& publicId,
|
||||||
|
@ -112,19 +112,14 @@ public:
|
||||||
* @param systemId The entity's system identifier.
|
* @param systemId The entity's system identifier.
|
||||||
* @param notationName The name of the associated notation.
|
* @param notationName The name of the associated notation.
|
||||||
* @see #notationDecl
|
* @see #notationDecl
|
||||||
* @see basic_Attributes
|
* @see Attributes
|
||||||
*/
|
*/
|
||||||
virtual void unparsedEntityDecl(const stringT& name,
|
virtual void unparsedEntityDecl(const stringT& name,
|
||||||
const stringT& publicId,
|
const stringT& publicId,
|
||||||
const stringT& systemId,
|
const stringT& systemId,
|
||||||
const stringT& notationName) = 0;
|
const stringT& notationName) = 0;
|
||||||
|
|
||||||
}; // class basic_DTDHandler
|
}; // class DTDHandler
|
||||||
|
|
||||||
typedef basic_DTDHandler<std::string> DTDHandler;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_DTDHandler<std::wstring> wDTDHandler;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -10,8 +10,8 @@ namespace Arabica
|
||||||
namespace SAX
|
namespace SAX
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class string_type> class basic_Locator;
|
template<class string_type> class Locator;
|
||||||
template<class string_type> class basic_AttributeList;
|
template<class string_type> class AttributeList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive notification of general document events.
|
* Receive notification of general document events.
|
||||||
|
@ -38,19 +38,19 @@ template<class string_type> class basic_AttributeList;
|
||||||
*
|
*
|
||||||
* @author Jez Higgins, jez@jezuk.co.uk
|
* @author Jez Higgins, jez@jezuk.co.uk
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @see basic_Parser#setDocumentHandler
|
* @see Parser#setDocumentHandler
|
||||||
* @see basic_Locator
|
* @see Locator
|
||||||
* @see basic_HandlerBase
|
* @see HandlerBase
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_DocumentHandler
|
class DocumentHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef basic_Locator<stringT> LocatorT;
|
typedef Locator<stringT> LocatorT;
|
||||||
typedef basic_AttributeList<stringT> AttributeListT;
|
typedef AttributeList<stringT> AttributeListT;
|
||||||
|
|
||||||
virtual ~basic_DocumentHandler() { }
|
virtual ~DocumentHandler() { }
|
||||||
|
|
||||||
virtual void setDocumentLocator(const LocatorT& locator) = 0;
|
virtual void setDocumentLocator(const LocatorT& locator) = 0;
|
||||||
|
|
||||||
|
@ -67,12 +67,7 @@ public:
|
||||||
|
|
||||||
virtual void processingInstruction(const stringT& target,
|
virtual void processingInstruction(const stringT& target,
|
||||||
const stringT& data) = 0;
|
const stringT& data) = 0;
|
||||||
}; // class basic_DocumentHandler
|
}; // class DocumentHandler
|
||||||
|
|
||||||
typedef basic_DocumentHandler<std::string> DocumentHandler;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_DocumentHandler<std::wstring> wDocumentHandler;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace SAX
|
||||||
* <p>If a SAX application needs to implement customized handling
|
* <p>If a SAX application needs to implement customized handling
|
||||||
* for external entities, it must implement this interface and
|
* for external entities, it must implement this interface and
|
||||||
* register an instance with the SAX driver using the
|
* register an instance with the SAX driver using the
|
||||||
* {@link basic_XMLReader#setEntityResolver setEntityResolver}
|
* {@link XMLReader#setEntityResolver setEntityResolver}
|
||||||
* method.</p>
|
* method.</p>
|
||||||
*
|
*
|
||||||
* <p>The XML reader will then allow the application to intercept any
|
* <p>The XML reader will then allow the application to intercept any
|
||||||
|
@ -66,17 +66,17 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_Parser#setEntityResolver
|
* @see Parser#setEntityResolver
|
||||||
* @see basic_InputSource
|
* @see InputSource
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_EntityResolver
|
class EntityResolver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef basic_InputSource<stringT> InputSourceT;
|
typedef InputSource<stringT> InputSourceT;
|
||||||
|
|
||||||
virtual ~basic_EntityResolver() { };
|
virtual ~EntityResolver() { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow the application to resolve external entities.
|
* Allow the application to resolve external entities.
|
||||||
|
@ -106,16 +106,11 @@ public:
|
||||||
* or a default-constructed <code>InputSource</code> to request that
|
* or a default-constructed <code>InputSource</code> to request that
|
||||||
* the parser open a regular URI connection to the system identifier.
|
* the parser open a regular URI connection to the system identifier.
|
||||||
* @exception SAXException Any SAX exception.
|
* @exception SAXException Any SAX exception.
|
||||||
* @see basic_InputSource
|
* @see InputSource
|
||||||
*/
|
*/
|
||||||
virtual InputSourceT resolveEntity(const stringT& publicId, const stringT& systemId) = 0;
|
virtual InputSourceT resolveEntity(const stringT& publicId, const stringT& systemId) = 0;
|
||||||
}; // class EntityResolver
|
}; // class EntityResolver
|
||||||
|
|
||||||
typedef basic_EntityResolver<std::string> EntityResolver;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_EntityResolver<std::wstring> wEntityResolver;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace SAX
|
||||||
* <p>If a SAX application needs to implement customized error
|
* <p>If a SAX application needs to implement customized error
|
||||||
* handling, it must implement this interface and then register an
|
* handling, it must implement this interface and then register an
|
||||||
* instance with the XML reader using the
|
* instance with the XML reader using the
|
||||||
* {@link basic_XMLReader#setErrorHandler setErrorHandler}
|
* {@link XMLReader#setErrorHandler setErrorHandler}
|
||||||
* method. The parser will then report all errors and warnings
|
* method. The parser will then report all errors and warnings
|
||||||
* through this interface.</p>
|
* through this interface.</p>
|
||||||
*
|
*
|
||||||
|
@ -41,17 +41,17 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_Parser#setErrorHandler
|
* @see Parser#setErrorHandler
|
||||||
* @see basic_SAXParseException
|
* @see SAXParseException
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_ErrorHandler
|
class ErrorHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef basic_SAXParseException<stringT> SAXParseExceptionT;
|
typedef SAXParseException<stringT> SAXParseExceptionT;
|
||||||
|
|
||||||
virtual ~basic_ErrorHandler() { };
|
virtual ~ErrorHandler() { };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receive notification of a warning.
|
* Receive notification of a warning.
|
||||||
|
@ -69,7 +69,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param exception The warning information encapsulated in a
|
* @param exception The warning information encapsulated in a
|
||||||
* SAX parse exception.
|
* SAX parse exception.
|
||||||
* @see basic_SAXParseException
|
* @see SAXParseException
|
||||||
*/
|
*/
|
||||||
virtual void warning(const SAXParseExceptionT& exception) = 0;
|
virtual void warning(const SAXParseExceptionT& exception) = 0;
|
||||||
/**
|
/**
|
||||||
|
@ -93,7 +93,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param exception The error information encapsulated in a
|
* @param exception The error information encapsulated in a
|
||||||
* SAX parse exception.
|
* SAX parse exception.
|
||||||
* @see basic_SAXParseException
|
* @see SAXParseException
|
||||||
*/
|
*/
|
||||||
virtual void error(const SAXParseExceptionT& exception) = 0;
|
virtual void error(const SAXParseExceptionT& exception) = 0;
|
||||||
/**
|
/**
|
||||||
|
@ -112,16 +112,11 @@ public:
|
||||||
*
|
*
|
||||||
* @param exception The error information encapsulated in a
|
* @param exception The error information encapsulated in a
|
||||||
* SAX parse exception.
|
* SAX parse exception.
|
||||||
* @see basic_SAXParseException
|
* @see SAXParseException
|
||||||
*/
|
*/
|
||||||
virtual void fatalError(const SAXParseExceptionT& exception) = 0;
|
virtual void fatalError(const SAXParseExceptionT& exception) = 0;
|
||||||
}; // class ErrorHandler
|
}; // class ErrorHandler
|
||||||
|
|
||||||
typedef basic_ErrorHandler<std::string> ErrorHandler;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_ErrorHandler<std::wstring> wErrorHandler;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace SAX
|
||||||
* interfaces: EntityResolver, DTDHandler, DocumentHandler,
|
* interfaces: EntityResolver, DTDHandler, DocumentHandler,
|
||||||
* and ErrorHandler. It is now obsolete, but is included in SAX2 to
|
* and ErrorHandler. It is now obsolete, but is included in SAX2 to
|
||||||
* support legacy SAX1 applications. SAX2 applications should use
|
* support legacy SAX1 applications. SAX2 applications should use
|
||||||
* the {@link basic_DefaultHandler DefaultHandler}
|
* the {@link DefaultHandler DefaultHandler}
|
||||||
* class instead.</p>
|
* class instead.</p>
|
||||||
*
|
*
|
||||||
* <p>Application writers can extend this class when they need to
|
* <p>Application writers can extend this class when they need to
|
||||||
|
@ -38,32 +38,32 @@ namespace SAX
|
||||||
* <p>Note that the use of this class is optional.</p>
|
* <p>Note that the use of this class is optional.</p>
|
||||||
*
|
*
|
||||||
* @deprecated This class works with the deprecated
|
* @deprecated This class works with the deprecated
|
||||||
* {@link basic_DocumentHandler DocumentHandler}
|
* {@link DocumentHandler DocumentHandler}
|
||||||
* interface. It has been replaced by the SAX2
|
* interface. It has been replaced by the SAX2
|
||||||
* {@link basic_DefaultHandler DefaultHandler}
|
* {@link DefaultHandler DefaultHandler}
|
||||||
* class.
|
* class.
|
||||||
* @since SAX 1.0
|
* @since SAX 1.0
|
||||||
* @author Jez Higgins, <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* @author Jez Higgins, <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @see basic_EntityResolver
|
* @see EntityResolver
|
||||||
* @see basic_DTDHandler
|
* @see DTDHandler
|
||||||
* @see basic_DocumentHandler
|
* @see DocumentHandler
|
||||||
* @see basic_ErrorHandler
|
* @see ErrorHandler
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_HandlerBase : public basic_EntityResolver<string_type>,
|
class HandlerBase : public EntityResolver<string_type>,
|
||||||
public basic_DTDHandler<string_type>,
|
public DTDHandler<string_type>,
|
||||||
public basic_DocumentHandler<string_type>,
|
public DocumentHandler<string_type>,
|
||||||
public basic_ErrorHandler<string_type>
|
public ErrorHandler<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_name stringT;
|
typedef string_name stringT;
|
||||||
typedef basic_Locator<stringT> LocatorT;
|
typedef Locator<stringT> LocatorT;
|
||||||
typedef basic_AttributeList<stringT> AttributeListT;
|
typedef AttributeList<stringT> AttributeListT;
|
||||||
typedef basic_InputSource<stringT> InputSourceT;
|
typedef InputSource<stringT> InputSourceT;
|
||||||
typedef basic_ErrorHandler<stringT>::SAXParseExceptionT SAXParseExceptionT;
|
typedef ErrorHandler<stringT>::SAXParseExceptionT SAXParseExceptionT;
|
||||||
|
|
||||||
virtual ~basic_HandlerBase() { }
|
virtual ~HandlerBase() { }
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Default implementation of the EntityResolver interface.
|
// Default implementation of the EntityResolver interface.
|
||||||
|
@ -83,7 +83,7 @@ public:
|
||||||
* document.
|
* document.
|
||||||
* @return The new input source, or an empty string to require the
|
* @return The new input source, or an empty string to require the
|
||||||
* default behaviour.
|
* default behaviour.
|
||||||
* @see basic_EntityResolver#resolveEntity
|
* @see EntityResolver#resolveEntity
|
||||||
*/
|
*/
|
||||||
virtual InputSourceT resolveEntity(const stringT& publicId,
|
virtual InputSourceT resolveEntity(const stringT& publicId,
|
||||||
const stringT& systemId)
|
const stringT& systemId)
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
* @param publicId The notation public identifier, or an empty string if not
|
* @param publicId The notation public identifier, or an empty string if not
|
||||||
* available.
|
* available.
|
||||||
* @param systemId The notation system identifier.
|
* @param systemId The notation system identifier.
|
||||||
* @see basic_DTDHandler#notationDecl
|
* @see DTDHandler#notationDecl
|
||||||
*/
|
*/
|
||||||
virtual void notationDecl(const stringT& name,
|
virtual void notationDecl(const stringT& name,
|
||||||
const stringT& publicId,
|
const stringT& publicId,
|
||||||
|
@ -123,7 +123,7 @@ public:
|
||||||
* available.
|
* available.
|
||||||
* @param systemId The entity system identifier.
|
* @param systemId The entity system identifier.
|
||||||
* @param notationName The name of the associated notation.
|
* @param notationName The name of the associated notation.
|
||||||
* @see basic_DTDHandler#unparsedEntityDecl
|
* @see DTDHandler#unparsedEntityDecl
|
||||||
*/
|
*/
|
||||||
virtual void unparsedEntityDecl(const stringT& name,
|
virtual void unparsedEntityDecl(const stringT& name,
|
||||||
const stringT& publicId,
|
const stringT& publicId,
|
||||||
|
@ -141,8 +141,8 @@ public:
|
||||||
* with other document events.</p>
|
* with other document events.</p>
|
||||||
*
|
*
|
||||||
* @param locator A locator for all SAX document events.
|
* @param locator A locator for all SAX document events.
|
||||||
* @see basic_DocumentHandler#setDocumentLocator
|
* @see DocumentHandler#setDocumentLocator
|
||||||
* @see basic_Locator
|
* @see Locator
|
||||||
*/
|
*/
|
||||||
virtual void setDocumentLocator(const LocatorT& locator) { }
|
virtual void setDocumentLocator(const LocatorT& locator) { }
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ public:
|
||||||
* of a document (such as allocating the root node of a tree or
|
* of a document (such as allocating the root node of a tree or
|
||||||
* creating an output file).</p>
|
* creating an output file).</p>
|
||||||
*
|
*
|
||||||
* @see basic_DocumentHandler#startDocument
|
* @see DocumentHandler#startDocument
|
||||||
*/
|
*/
|
||||||
virtual void startDocument() { }
|
virtual void startDocument() { }
|
||||||
/**
|
/**
|
||||||
|
@ -165,7 +165,7 @@ public:
|
||||||
* of a document (such as finalising a tree or closing an output
|
* of a document (such as finalising a tree or closing an output
|
||||||
* file).</p>
|
* file).</p>
|
||||||
*
|
*
|
||||||
* @see basic_DocumentHandler#endDocument
|
* @see DocumentHandler#endDocument
|
||||||
*/
|
*/
|
||||||
virtual void endDocument() { }
|
virtual void endDocument() { }
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param name The element type name.
|
* @param name The element type name.
|
||||||
* @param attributes The specified or defaulted attributes.
|
* @param attributes The specified or defaulted attributes.
|
||||||
* @see basic_DocumentHandler#startElement
|
* @see DocumentHandler#startElement
|
||||||
*/
|
*/
|
||||||
virtual void startElement(const stringT& name,
|
virtual void startElement(const stringT& name,
|
||||||
const AttributeListT& attributes) { }
|
const AttributeListT& attributes) { }
|
||||||
|
@ -192,7 +192,7 @@ public:
|
||||||
* output to a file).</p>
|
* output to a file).</p>
|
||||||
*
|
*
|
||||||
* @param name The element type name.
|
* @param name The element type name.
|
||||||
* @see basic_DocumentHandler#endElement
|
* @see DocumentHandler#endElement
|
||||||
*/
|
*/
|
||||||
virtual void endElement(const stringT& name) { }
|
virtual void endElement(const stringT& name) { }
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ public:
|
||||||
* a file).</p>
|
* a file).</p>
|
||||||
*
|
*
|
||||||
* @param ch The characters.
|
* @param ch The characters.
|
||||||
* @see basic_DocumentHandler#characters
|
* @see DocumentHandler#characters
|
||||||
*/
|
*/
|
||||||
virtual void characters(const stringT& ch) { }
|
virtual void characters(const stringT& ch) { }
|
||||||
/**
|
/**
|
||||||
|
@ -217,7 +217,7 @@ public:
|
||||||
* it to a file).</p>
|
* it to a file).</p>
|
||||||
*
|
*
|
||||||
* @param ch The whitespace characters.
|
* @param ch The whitespace characters.
|
||||||
* @see basic_DocumentHandler#ignorableWhitespace
|
* @see DocumentHandler#ignorableWhitespace
|
||||||
*/
|
*/
|
||||||
virtual void ignorableWhitespace(const stringT& ch) { }
|
virtual void ignorableWhitespace(const stringT& ch) { }
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ public:
|
||||||
* @param target The processing instruction target.
|
* @param target The processing instruction target.
|
||||||
* @param data The processing instruction data, or an empty string if
|
* @param data The processing instruction data, or an empty string if
|
||||||
* none is supplied.
|
* none is supplied.
|
||||||
* @see basic_DocumentHandler#processingInstruction
|
* @see DocumentHandler#processingInstruction
|
||||||
*/
|
*/
|
||||||
virtual void processingInstruction(const stringT& target,
|
virtual void processingInstruction(const stringT& target,
|
||||||
const stringT& data) { }
|
const stringT& data) { }
|
||||||
|
@ -249,8 +249,8 @@ public:
|
||||||
* printing it to the console.</p>
|
* printing it to the console.</p>
|
||||||
*
|
*
|
||||||
* @param e The warning information encoded as an exception.
|
* @param e The warning information encoded as an exception.
|
||||||
* @see basic_ErrorHandler#warning
|
* @see ErrorHandler#warning
|
||||||
* @see basic_SAXParseException
|
* @see SAXParseException
|
||||||
*/
|
*/
|
||||||
virtual void warning(const SAXParseExceptionT& e) { }
|
virtual void warning(const SAXParseExceptionT& e) { }
|
||||||
/**
|
/**
|
||||||
|
@ -262,8 +262,8 @@ public:
|
||||||
* printing it to the console.</p>
|
* printing it to the console.</p>
|
||||||
*
|
*
|
||||||
* @param e The warning information encoded as an exception.
|
* @param e The warning information encoded as an exception.
|
||||||
* @see basic_ErrorHandler#warning
|
* @see ErrorHandler#warning
|
||||||
* @see basic_SAXParseException
|
* @see SAXParseException
|
||||||
*/
|
*/
|
||||||
virtual void error(const SAXParseExceptionT& e) { }
|
virtual void error(const SAXParseExceptionT& e) { }
|
||||||
/**
|
/**
|
||||||
|
@ -278,17 +278,12 @@ public:
|
||||||
* the parser may no longer report parsing events.</p>
|
* the parser may no longer report parsing events.</p>
|
||||||
*
|
*
|
||||||
* @param e The error information encoded as an exception.
|
* @param e The error information encoded as an exception.
|
||||||
* @see basic_ErrorHandler#fatalError
|
* @see ErrorHandler#fatalError
|
||||||
* @see basic_SAXParseException
|
* @see SAXParseException
|
||||||
*/
|
*/
|
||||||
virtual void fatalError(const SAXParseExceptionT& e) { throw e; }
|
virtual void fatalError(const SAXParseExceptionT& e) { throw e; }
|
||||||
}; // class HandlerBase
|
}; // class HandlerBase
|
||||||
|
|
||||||
typedef basic_HandlerBase<std::string> HandlerBase;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_HandlerBase<std::wstring> wHandlerBase;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,11 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_Parser#parse
|
* @see Parser#parse
|
||||||
* @see basic_EntityResolver#resolveEntity
|
* @see EntityResolver#resolveEntity
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_InputSource
|
class InputSource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
|
@ -62,7 +62,7 @@ public:
|
||||||
* @see #setByteStream
|
* @see #setByteStream
|
||||||
* @see #setEncoding
|
* @see #setEncoding
|
||||||
*/
|
*/
|
||||||
basic_InputSource() :
|
InputSource() :
|
||||||
byteStream_(),
|
byteStream_(),
|
||||||
publicId_(),
|
publicId_(),
|
||||||
systemId_(),
|
systemId_(),
|
||||||
|
@ -83,13 +83,13 @@ public:
|
||||||
* @see #setByteStream
|
* @see #setByteStream
|
||||||
* @see #setEncoding
|
* @see #setEncoding
|
||||||
*/
|
*/
|
||||||
basic_InputSource(const stringT& systemId) :
|
InputSource(const stringT& systemId) :
|
||||||
byteStream_(),
|
byteStream_(),
|
||||||
publicId_(),
|
publicId_(),
|
||||||
systemId_(systemId),
|
systemId_(systemId),
|
||||||
encoding_()
|
encoding_()
|
||||||
{ }
|
{ }
|
||||||
basic_InputSource(const basic_InputSource& rhs) :
|
InputSource(const InputSource& rhs) :
|
||||||
byteStream_(rhs.byteStream_),
|
byteStream_(rhs.byteStream_),
|
||||||
publicId_(rhs.publicId_),
|
publicId_(rhs.publicId_),
|
||||||
systemId_(rhs.systemId_),
|
systemId_(rhs.systemId_),
|
||||||
|
@ -104,15 +104,15 @@ public:
|
||||||
* character encoding.</p>
|
* character encoding.</p>
|
||||||
*
|
*
|
||||||
* @param byteStream The raw byte stream containing the document. The
|
* @param byteStream The raw byte stream containing the document. The
|
||||||
* basic_InputSource does not assume ownership of
|
* InputSource does not assume ownership of
|
||||||
* this byteStream.
|
* this byteStream.
|
||||||
* @see #basic_InputSource(std::auto_ptr<std::istream>)
|
* @see #InputSource(std::auto_ptr<std::istream>)
|
||||||
* @see #setPublicId
|
* @see #setPublicId
|
||||||
* @see #setSystemId
|
* @see #setSystemId
|
||||||
* @see #setEncoding
|
* @see #setEncoding
|
||||||
* @see #setByteStream
|
* @see #setByteStream
|
||||||
*/
|
*/
|
||||||
basic_InputSource(std::istream& byteStream) :
|
InputSource(std::istream& byteStream) :
|
||||||
byteStream_(byteStream),
|
byteStream_(byteStream),
|
||||||
publicId_(),
|
publicId_(),
|
||||||
systemId_(),
|
systemId_(),
|
||||||
|
@ -129,22 +129,22 @@ public:
|
||||||
* character encoding.</p>
|
* character encoding.</p>
|
||||||
*
|
*
|
||||||
* @param byteStream The raw byte stream containing the document. The
|
* @param byteStream The raw byte stream containing the document. The
|
||||||
* basic_InputSource assumes ownership of the byteStream
|
* InputSource assumes ownership of the byteStream
|
||||||
* and will delete it when no-longer required.
|
* and will delete it when no-longer required.
|
||||||
* @see basic_InputSource(std::istream&)
|
* @see InputSource(std::istream&)
|
||||||
* @see #setPublicId
|
* @see #setPublicId
|
||||||
* @see #setSystemId
|
* @see #setSystemId
|
||||||
* @see #setEncoding
|
* @see #setEncoding
|
||||||
* @see #setByteStream
|
* @see #setByteStream
|
||||||
*/
|
*/
|
||||||
basic_InputSource(std::auto_ptr<std::istream> byteStream) :
|
InputSource(std::auto_ptr<std::istream> byteStream) :
|
||||||
byteStream_(byteStream),
|
byteStream_(byteStream),
|
||||||
publicId_(),
|
publicId_(),
|
||||||
systemId_(),
|
systemId_(),
|
||||||
encoding_()
|
encoding_()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
basic_InputSource(std::auto_ptr<std::iostream> byteStream) :
|
InputSource(std::auto_ptr<std::iostream> byteStream) :
|
||||||
byteStream_(byteStream),
|
byteStream_(byteStream),
|
||||||
publicId_(),
|
publicId_(),
|
||||||
systemId_(),
|
systemId_(),
|
||||||
|
@ -152,9 +152,9 @@ public:
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
||||||
virtual ~basic_InputSource() { }
|
virtual ~InputSource() { }
|
||||||
|
|
||||||
basic_InputSource& operator=(const basic_InputSource& rhs)
|
InputSource& operator=(const InputSource& rhs)
|
||||||
{
|
{
|
||||||
byteStream_ = rhs.byteStream_;
|
byteStream_ = rhs.byteStream_;
|
||||||
publicId_ = rhs.publicId_;
|
publicId_ = rhs.publicId_;
|
||||||
|
@ -173,8 +173,8 @@ public:
|
||||||
*
|
*
|
||||||
* @param publicId The public identifier as a string.
|
* @param publicId The public identifier as a string.
|
||||||
* @see #getPublicId
|
* @see #getPublicId
|
||||||
* @see basic_Locator#getPublicId
|
* @see Locator#getPublicId
|
||||||
* @see basic_SAXParseException#getPublicId
|
* @see SAXParseException#getPublicId
|
||||||
*/
|
*/
|
||||||
void setPublicId(const stringT& publicId) { publicId_ = publicId; }
|
void setPublicId(const stringT& publicId) { publicId_ = publicId; }
|
||||||
/**
|
/**
|
||||||
|
@ -204,8 +204,8 @@ public:
|
||||||
* @param systemId The system identifier as a string.
|
* @param systemId The system identifier as a string.
|
||||||
* @see #setEncoding
|
* @see #setEncoding
|
||||||
* @see #getSystemId
|
* @see #getSystemId
|
||||||
* @see basic_Locator#getSystemId
|
* @see Locator#getSystemId
|
||||||
* @see basic_SAXParseException#getSystemId
|
* @see SAXParseException#getSystemId
|
||||||
*/
|
*/
|
||||||
void setSystemId(const stringT& systemId) { systemId_ = systemId; }
|
void setSystemId(const stringT& systemId) { systemId_ = systemId; }
|
||||||
/**
|
/**
|
||||||
|
@ -232,7 +232,7 @@ public:
|
||||||
* byte stream, it should set it with the setEncoding method.</p>
|
* byte stream, it should set it with the setEncoding method.</p>
|
||||||
*
|
*
|
||||||
* @param byteStream A byte stream containing an XML document or
|
* @param byteStream A byte stream containing an XML document or
|
||||||
* other entity. The basic_InputSource does not assume
|
* other entity. The InputSource does not assume
|
||||||
* ownership of byteStream.
|
* ownership of byteStream.
|
||||||
* @see #setByteStream(std::auto_ptr<std::istream>) To transfer ownership of
|
* @see #setByteStream(std::auto_ptr<std::istream>) To transfer ownership of
|
||||||
* an std::istream to an InputSource
|
* an std::istream to an InputSource
|
||||||
|
@ -255,7 +255,7 @@ public:
|
||||||
* byte stream, it should set it with the setEncoding method.</p>
|
* byte stream, it should set it with the setEncoding method.</p>
|
||||||
*
|
*
|
||||||
* @param byteStream A byte stream containing an XML document or
|
* @param byteStream A byte stream containing an XML document or
|
||||||
* other entity. The basic_InputSource assumes
|
* other entity. The InputSource assumes
|
||||||
* ownership of byteStream.
|
* ownership of byteStream.
|
||||||
* @see #setByteStream(std::istream&)
|
* @see #setByteStream(std::istream&)
|
||||||
* @see #setEncoding
|
* @see #setEncoding
|
||||||
|
@ -328,13 +328,8 @@ private:
|
||||||
stringT systemId_;
|
stringT systemId_;
|
||||||
stringT encoding_;
|
stringT encoding_;
|
||||||
|
|
||||||
bool operator==(const basic_InputSource&); // no implementation
|
bool operator==(const InputSource&); // no implementation
|
||||||
}; // class basic_InputSource
|
}; // class InputSource
|
||||||
|
|
||||||
typedef basic_InputSource<std::string> InputSource;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_InputSource<std::wstring> wInputSource;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace SAX
|
||||||
* <p>If a SAX parser provides location information to the SAX
|
* <p>If a SAX parser provides location information to the SAX
|
||||||
* application, it does so by implementing this interface and then
|
* application, it does so by implementing this interface and then
|
||||||
* passing an instance to the application using the content
|
* passing an instance to the application using the content
|
||||||
* handler's {@link basic_ContentHandler#setDocumentLocator
|
* handler's {@link ContentHandler#setDocumentLocator
|
||||||
* setDocumentLocator} method. The application can use the
|
* setDocumentLocator} method. The application can use the
|
||||||
* object to obtain the location of any other content handler event
|
* object to obtain the location of any other content handler event
|
||||||
* in the XML source document.</p>
|
* in the XML source document.</p>
|
||||||
|
@ -33,7 +33,7 @@ namespace SAX
|
||||||
* very strongly encouraged to do so. If the parser supplies a
|
* very strongly encouraged to do so. If the parser supplies a
|
||||||
* locator, it must do so before reporting any other document events.
|
* locator, it must do so before reporting any other document events.
|
||||||
* If no locator has been set by the time the application receives
|
* If no locator has been set by the time the application receives
|
||||||
* the {@link basic_ContentHandler#startDocument startDocument}
|
* the {@link ContentHandler#startDocument startDocument}
|
||||||
* event, the application should assume that a locator is not
|
* event, the application should assume that a locator is not
|
||||||
* available.</p>
|
* available.</p>
|
||||||
*
|
*
|
||||||
|
@ -41,15 +41,15 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_ContentHandler#setDocumentLocator
|
* @see ContentHandler#setDocumentLocator
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_Locator
|
class Locator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
|
|
||||||
virtual ~basic_Locator() { }
|
virtual ~Locator() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the public identifier for the current document event.
|
* Return the public identifier for the current document event.
|
||||||
|
@ -124,11 +124,6 @@ public:
|
||||||
virtual int getColumnNumber() const = 0;
|
virtual int getColumnNumber() const = 0;
|
||||||
}; // class Locator
|
}; // class Locator
|
||||||
|
|
||||||
typedef basic_Locator<std::string> Locator;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_Locator<std::wstring> wLocator;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace SAX
|
||||||
* Basic interface for SAX (Simple API for XML) parsers.
|
* Basic interface for SAX (Simple API for XML) parsers.
|
||||||
*
|
*
|
||||||
* <p>This was the main event supplier interface for SAX1; it has
|
* <p>This was the main event supplier interface for SAX1; it has
|
||||||
* been replaced in SAX2 by {@link basic_XMLReader XMLReader},
|
* been replaced in SAX2 by {@link XMLReader XMLReader},
|
||||||
* which includes Namespace support and sophisticated configurability
|
* which includes Namespace support and sophisticated configurability
|
||||||
* and extensibility.</p>
|
* and extensibility.</p>
|
||||||
*
|
*
|
||||||
|
@ -38,30 +38,30 @@ namespace SAX
|
||||||
* invoke the parse() methods recursively within a parse.</p>
|
* invoke the parse() methods recursively within a parse.</p>
|
||||||
*
|
*
|
||||||
* @deprecated This interface has been replaced by the SAX2
|
* @deprecated This interface has been replaced by the SAX2
|
||||||
* {@link basic_XMLReader XMLReader}
|
* {@link XMLReader XMLReader}
|
||||||
* interface, which includes Namespace support.
|
* interface, which includes Namespace support.
|
||||||
* @since SAX 1.0
|
* @since SAX 1.0
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_EntityResolver
|
* @see EntityResolver
|
||||||
* @see basic_DTDHandler
|
* @see DTDHandler
|
||||||
* @see basic_DocumentHandler
|
* @see DocumentHandler
|
||||||
* @see basic_ErrorHandler
|
* @see ErrorHandler
|
||||||
* @see basic_HandlerBase
|
* @see HandlerBase
|
||||||
* @see basic_InputSource
|
* @see InputSource
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_Parser
|
class Parser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_name stringT;
|
typedef string_name stringT;
|
||||||
typedef basic_EntityResolver<stringT> EntityResolverT;
|
typedef EntityResolver<stringT> EntityResolverT;
|
||||||
typedef basic_DTDHandler<stringT> DTDHandlerT;
|
typedef DTDHandler<stringT> DTDHandlerT;
|
||||||
typedef basic_DocumentHandler<stringT> DocumentHandlerT;
|
typedef DocumentHandler<stringT> DocumentHandlerT;
|
||||||
typedef basic_InputSource<stringT> InputSourceT;
|
typedef InputSource<stringT> InputSourceT;
|
||||||
|
|
||||||
virtual ~basic_Parser() { }
|
virtual ~Parser() { }
|
||||||
|
|
||||||
// virtual void setLocale(Locale locale) throws SAXException = 0;
|
// virtual void setLocale(Locale locale) throws SAXException = 0;
|
||||||
/**
|
/**
|
||||||
|
@ -77,8 +77,8 @@ public:
|
||||||
* the new resolver immediately.</p>
|
* the new resolver immediately.</p>
|
||||||
*
|
*
|
||||||
* @param resolver The object for resolving entities.
|
* @param resolver The object for resolving entities.
|
||||||
* @see basic_EntityResolver
|
* @see EntityResolver
|
||||||
* @see basic_HandlerBase
|
* @see HandlerBase
|
||||||
*/
|
*/
|
||||||
virtual void setEntityResolver(EntityResolverT& resolver) = 0;
|
virtual void setEntityResolver(EntityResolverT& resolver) = 0;
|
||||||
/**
|
/**
|
||||||
|
@ -94,8 +94,8 @@ public:
|
||||||
* begin using the new handler immediately.</p>
|
* begin using the new handler immediately.</p>
|
||||||
*
|
*
|
||||||
* @param handler The DTD handler.
|
* @param handler The DTD handler.
|
||||||
* @see basic_DTDHandler
|
* @see DTDHandler
|
||||||
* @see basic_HandlerBase
|
* @see HandlerBase
|
||||||
*/
|
*/
|
||||||
virtual void setDTDHandler(DTDHandlerT& handler) = 0;
|
virtual void setDTDHandler(DTDHandlerT& handler) = 0;
|
||||||
/**
|
/**
|
||||||
|
@ -111,8 +111,8 @@ public:
|
||||||
* handler immediately.</p>
|
* handler immediately.</p>
|
||||||
*
|
*
|
||||||
* @param handler The document handler.
|
* @param handler The document handler.
|
||||||
* @see basic_DocumentHandler
|
* @see DocumentHandler
|
||||||
* @see basic_HandlerBase
|
* @see HandlerBase
|
||||||
*/
|
*/
|
||||||
virtual void setDocumentHandler(DocumentHandlerT& handler) = 0;
|
virtual void setDocumentHandler(DocumentHandlerT& handler) = 0;
|
||||||
/**
|
/**
|
||||||
|
@ -128,9 +128,9 @@ public:
|
||||||
* handler immediately.</p>
|
* handler immediately.</p>
|
||||||
*
|
*
|
||||||
* @param handler The error handler.
|
* @param handler The error handler.
|
||||||
* @see basic_ErrorHandler
|
* @see ErrorHandler
|
||||||
* @see basic_SAXException
|
* @see SAXException
|
||||||
* @see basic_HandlerBase
|
* @see HandlerBase
|
||||||
*/
|
*/
|
||||||
virtual void setErrorHandler(ErrorHandler& handler) = 0;
|
virtual void setErrorHandler(ErrorHandler& handler) = 0;
|
||||||
|
|
||||||
|
@ -149,19 +149,14 @@ public:
|
||||||
*
|
*
|
||||||
* @param source The input source for the top-level of the
|
* @param source The input source for the top-level of the
|
||||||
* XML document.
|
* XML document.
|
||||||
* @see basic_InputSource
|
* @see InputSource
|
||||||
* @see #setEntityResolver
|
* @see #setEntityResolver
|
||||||
* @see #setDTDHandler
|
* @see #setDTDHandler
|
||||||
* @see #setDocumentHandler
|
* @see #setDocumentHandler
|
||||||
* @see #setErrorHandler
|
* @see #setErrorHandler
|
||||||
*/
|
*/
|
||||||
virtual void parse(InputSourceT& source) = 0;
|
virtual void parse(InputSourceT& source) = 0;
|
||||||
}; // class basic_Parser
|
}; // class Parser
|
||||||
|
|
||||||
typedef basic_Parser<std::string> Parser;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_Parser<std::wstring> wParser;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -24,13 +24,13 @@ namespace SAX
|
||||||
*
|
*
|
||||||
* <p>If the parser or application needs to include information about a
|
* <p>If the parser or application needs to include information about a
|
||||||
* specific location in an XML document, it should use the
|
* specific location in an XML document, it should use the
|
||||||
* {@link basic_SAXParseException SAXParseException} subclass.</p>
|
* {@link SAXParseException SAXParseException} subclass.</p>
|
||||||
*
|
*
|
||||||
* @since SAX 1.0
|
* @since SAX 1.0
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_SAXParseException
|
* @see SAXParseException
|
||||||
*/
|
*/
|
||||||
class SAXException : public std::runtime_error
|
class SAXException : public std::runtime_error
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,16 +34,16 @@ namespace SAX
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see SAXException
|
* @see SAXException
|
||||||
* @see Locator
|
* @see Locator
|
||||||
* @see basic_ErrorHandler
|
* @see ErrorHandler
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_SAXParseException : public SAXException
|
class SAXParseException : public SAXException
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef basic_Locator<stringT> LocatorT;
|
typedef Locator<stringT> LocatorT;
|
||||||
|
|
||||||
basic_SAXParseException(const std::string& message) :
|
SAXParseException(const std::string& message) :
|
||||||
SAXException(message),
|
SAXException(message),
|
||||||
publicId_(),
|
publicId_(),
|
||||||
systemId_(),
|
systemId_(),
|
||||||
|
@ -51,9 +51,9 @@ public:
|
||||||
columnNumber_(-1)
|
columnNumber_(-1)
|
||||||
{
|
{
|
||||||
setMsg();
|
setMsg();
|
||||||
} // basic_SAXParseException
|
} // SAXParseException
|
||||||
|
|
||||||
basic_SAXParseException(const std::string& message,
|
SAXParseException(const std::string& message,
|
||||||
const LocatorT& locator) :
|
const LocatorT& locator) :
|
||||||
SAXException(message),
|
SAXException(message),
|
||||||
publicId_(locator.getPublicId()),
|
publicId_(locator.getPublicId()),
|
||||||
|
@ -62,9 +62,9 @@ public:
|
||||||
columnNumber_(locator.getColumnNumber())
|
columnNumber_(locator.getColumnNumber())
|
||||||
{
|
{
|
||||||
setMsg();
|
setMsg();
|
||||||
} // basic_SAXParseException
|
} // SAXParseException
|
||||||
|
|
||||||
basic_SAXParseException(const std::string& message,
|
SAXParseException(const std::string& message,
|
||||||
const stringT& publicId,
|
const stringT& publicId,
|
||||||
const stringT& systemId,
|
const stringT& systemId,
|
||||||
int lineNumber,
|
int lineNumber,
|
||||||
|
@ -76,9 +76,9 @@ public:
|
||||||
columnNumber_(columnNumber)
|
columnNumber_(columnNumber)
|
||||||
{
|
{
|
||||||
setMsg();
|
setMsg();
|
||||||
} // basic_SAXParseException
|
} // SAXParseException
|
||||||
|
|
||||||
basic_SAXParseException(const basic_SAXParseException& rhs) :
|
SAXParseException(const SAXParseException& rhs) :
|
||||||
SAXException(rhs),
|
SAXException(rhs),
|
||||||
msg_(rhs.msg_),
|
msg_(rhs.msg_),
|
||||||
publicId_(rhs.publicId_),
|
publicId_(rhs.publicId_),
|
||||||
|
@ -86,9 +86,9 @@ public:
|
||||||
lineNumber_(rhs.lineNumber_),
|
lineNumber_(rhs.lineNumber_),
|
||||||
columnNumber_(rhs.columnNumber_)
|
columnNumber_(rhs.columnNumber_)
|
||||||
{
|
{
|
||||||
} // basic_SAXParseException
|
} // SAXParseException
|
||||||
|
|
||||||
basic_SAXParseException& operator=(const basic_SAXParseException& rhs)
|
SAXParseException& operator=(const SAXParseException& rhs)
|
||||||
{
|
{
|
||||||
SAXException::operator=(rhs);
|
SAXException::operator=(rhs);
|
||||||
|
|
||||||
|
@ -101,14 +101,14 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
} // operator=
|
} // operator=
|
||||||
|
|
||||||
virtual ~basic_SAXParseException() throw() { }
|
virtual ~SAXParseException() throw() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the public identifier of the entity where the exception occurred.
|
* Get the public identifier of the entity where the exception occurred.
|
||||||
*
|
*
|
||||||
* @return A string containing the public identifier, or an empty string
|
* @return A string containing the public identifier, or an empty string
|
||||||
* if none is available.
|
* if none is available.
|
||||||
* @see basic_Locator#getPublicId
|
* @see Locator#getPublicId
|
||||||
*/
|
*/
|
||||||
const stringT& getPublicId() const { return publicId_; }
|
const stringT& getPublicId() const { return publicId_; }
|
||||||
/**
|
/**
|
||||||
|
@ -119,7 +119,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return A string containing the system identifier, or an empty string
|
* @return A string containing the system identifier, or an empty string
|
||||||
* if none is available.
|
* if none is available.
|
||||||
* @see basic_Locator#getSystemId
|
* @see Locator#getSystemId
|
||||||
*/
|
*/
|
||||||
const stringT& getSystemId() const { return systemId_; }
|
const stringT& getSystemId() const { return systemId_; }
|
||||||
/**
|
/**
|
||||||
|
@ -127,7 +127,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return An integer representing the line number, or -1
|
* @return An integer representing the line number, or -1
|
||||||
* if none is available.
|
* if none is available.
|
||||||
* @see basic_Locator#getLineNumber
|
* @see Locator#getLineNumber
|
||||||
*/
|
*/
|
||||||
int getLineNumber() const { return lineNumber_; }
|
int getLineNumber() const { return lineNumber_; }
|
||||||
/**
|
/**
|
||||||
|
@ -137,7 +137,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return An integer representing the column number, or -1
|
* @return An integer representing the column number, or -1
|
||||||
* if none is available.
|
* if none is available.
|
||||||
* @see basic_Locator#getColumnNumber
|
* @see Locator#getColumnNumber
|
||||||
*/
|
*/
|
||||||
int getColumnNumber() const { return columnNumber_; }
|
int getColumnNumber() const { return columnNumber_; }
|
||||||
|
|
||||||
|
@ -162,13 +162,8 @@ private:
|
||||||
int lineNumber_;
|
int lineNumber_;
|
||||||
int columnNumber_;
|
int columnNumber_;
|
||||||
|
|
||||||
basic_SAXParseException();
|
SAXParseException();
|
||||||
}; // class basic_SAXParseException
|
}; // class SAXParseException
|
||||||
|
|
||||||
typedef basic_SAXParseException<std::string> SAXParseException;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_SAXParseException<std::wstring> wSAXParseException;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -23,25 +23,25 @@ namespace SAX
|
||||||
* events as they pass on to the final application.</p>
|
* events as they pass on to the final application.</p>
|
||||||
*
|
*
|
||||||
* <p>The XMLFilterImpl helper class provides a convenient base
|
* <p>The XMLFilterImpl helper class provides a convenient base
|
||||||
* for creating SAX2 filters, by passing on all {@link basic_EntityResolver
|
* for creating SAX2 filters, by passing on all {@link EntityResolver
|
||||||
* EntityResolver}, {@link basic_DTDHandler DTDHandler},
|
* EntityResolver}, {@link DTDHandler DTDHandler},
|
||||||
* {@link basic_ContentHandler ContentHandler} and {@link ErrorHandler
|
* {@link ContentHandler ContentHandler} and {@link ErrorHandler
|
||||||
* ErrorHandler} events automatically.</p>
|
* ErrorHandler} events automatically.</p>
|
||||||
*
|
*
|
||||||
* @since SAX 2.0
|
* @since SAX 2.0
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_XMLFilterImpl
|
* @see XMLFilterImpl
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_XMLFilter : public basic_XMLReader<string_type>
|
class XMLFilter : public XMLReaderInterface<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef basic_XMLReader<stringT> XMLReaderT;
|
typedef XMLReaderInterface<stringT> XMLReaderT;
|
||||||
|
|
||||||
virtual ~basic_XMLFilter() { }
|
virtual ~XMLFilter() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the parent reader.
|
* Set the parent reader.
|
||||||
|
@ -63,12 +63,7 @@ public:
|
||||||
* @return The parent filter, or 0 if none has been set.
|
* @return The parent filter, or 0 if none has been set.
|
||||||
*/
|
*/
|
||||||
virtual XMLReaderT* getParent() const = 0;
|
virtual XMLReaderT* getParent() const = 0;
|
||||||
}; // class basic_XMLFilter
|
}; // class XMLFilter
|
||||||
|
|
||||||
typedef basic_XMLFilter<std::string> XMLFilter;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_XMLFilter<std::wstring> wXMLFilter;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace SAX
|
||||||
* to return before reporting the next event.</p>
|
* to return before reporting the next event.</p>
|
||||||
*
|
*
|
||||||
* <p>This interface replaces the (now deprecated) SAX 1.0 {@link
|
* <p>This interface replaces the (now deprecated) SAX 1.0 {@link
|
||||||
* basic_Parser Parser} interface. The XMLReader interface
|
* Parser Parser} interface. The XMLReader interface
|
||||||
* contains two important enhancements over the old Parser
|
* contains two important enhancements over the old Parser
|
||||||
* interface:</p>
|
* interface:</p>
|
||||||
*
|
*
|
||||||
|
@ -56,24 +56,24 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_XMLFilter
|
* @see XMLFilter
|
||||||
* @see basic_helpers.ParserAdapter
|
* @see helpers.ParserAdapter
|
||||||
* @see basic_helpers.XMLReaderAdapter
|
* @see helpers.XMLReaderAdapter
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_XMLReader
|
class XMLReaderInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef basic_EntityResolver<stringT> EntityResolverT;
|
typedef EntityResolver<stringT> EntityResolverT;
|
||||||
typedef basic_DTDHandler<stringT> DTDHandlerT;
|
typedef DTDHandler<stringT> DTDHandlerT;
|
||||||
typedef basic_ContentHandler<stringT> ContentHandlerT;
|
typedef ContentHandler<stringT> ContentHandlerT;
|
||||||
typedef basic_InputSource<stringT> InputSourceT;
|
typedef InputSource<stringT> InputSourceT;
|
||||||
typedef basic_ErrorHandler<stringT> ErrorHandlerT;
|
typedef ErrorHandler<stringT> ErrorHandlerT;
|
||||||
typedef basic_DeclHandler<stringT> DeclHandlerT;
|
typedef DeclHandler<stringT> DeclHandlerT;
|
||||||
typedef basic_LexicalHandler<stringT> LexicalHandlerT;
|
typedef LexicalHandler<stringT> LexicalHandlerT;
|
||||||
|
|
||||||
virtual ~basic_XMLReader() { }
|
virtual ~XMLReaderInterface() { }
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
// Configuration
|
// Configuration
|
||||||
|
@ -134,7 +134,7 @@ public:
|
||||||
* <p>The feature name is any fully-qualified URI. It is
|
* <p>The feature name is any fully-qualified URI. It is
|
||||||
* possible for an XMLReader to recognize a feature name but
|
* possible for an XMLReader to recognize a feature name but
|
||||||
* to be unable to set its value; this is especially true
|
* to be unable to set its value; this is especially true
|
||||||
* in the case of an adapter for a SAX1 {@link basic_Parser Parser},
|
* in the case of an adapter for a SAX1 {@link Parser Parser},
|
||||||
* which has no way of affecting whether the underlying parser is
|
* which has no way of affecting whether the underlying parser is
|
||||||
* validating, for example.</p>
|
* validating, for example.</p>
|
||||||
*
|
*
|
||||||
|
@ -293,7 +293,7 @@ public:
|
||||||
* by the application before it is passed to the parser.</p>
|
* by the application before it is passed to the parser.</p>
|
||||||
*
|
*
|
||||||
* @param systemId The system identifier (URI).
|
* @param systemId The system identifier (URI).
|
||||||
* @see #parse(basic_InputSource&)
|
* @see #parse(InputSource&)
|
||||||
*/
|
*/
|
||||||
void parse(const stringT& systemId)
|
void parse(const stringT& systemId)
|
||||||
{
|
{
|
||||||
|
@ -323,7 +323,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param input The input source for the top-level of the
|
* @param input The input source for the top-level of the
|
||||||
* XML document.
|
* XML document.
|
||||||
* @see basic_InputSource
|
* @see InputSource
|
||||||
* @see #parse(const stringT&)
|
* @see #parse(const stringT&)
|
||||||
* @see #setEntityResolver
|
* @see #setEntityResolver
|
||||||
* @see #setDTDHandler
|
* @see #setDTDHandler
|
||||||
|
@ -363,7 +363,7 @@ public:
|
||||||
* <p>The property name is any fully-qualified URI. It is
|
* <p>The property name is any fully-qualified URI. It is
|
||||||
* possible for an XMLReader to recognize a property name but
|
* possible for an XMLReader to recognize a property name but
|
||||||
* to be unable to return its state; this is especially true
|
* to be unable to return its state; this is especially true
|
||||||
* in the case of an adapter for a SAX1 {@link basic_Parser
|
* in the case of an adapter for a SAX1 {@link Parser
|
||||||
* Parser}.</p>
|
* Parser}.</p>
|
||||||
*
|
*
|
||||||
* <p>XMLReaders are not required to recognize any specific
|
* <p>XMLReaders are not required to recognize any specific
|
||||||
|
@ -403,7 +403,7 @@ public:
|
||||||
* <p>The property name is any fully-qualified URI. It is
|
* <p>The property name is any fully-qualified URI. It is
|
||||||
* possible for an XMLReader to recognize a property name but
|
* possible for an XMLReader to recognize a property name but
|
||||||
* to be unable to set its value; this is especially true
|
* to be unable to set its value; this is especially true
|
||||||
* in the case of an adapter for a SAX1 {@link basic_Parser
|
* in the case of an adapter for a SAX1 {@link Parser
|
||||||
* Parser}.</p>
|
* Parser}.</p>
|
||||||
*
|
*
|
||||||
* <p>XMLReaders are not required to recognize setting
|
* <p>XMLReaders are not required to recognize setting
|
||||||
|
@ -431,7 +431,7 @@ public:
|
||||||
Property<propertyTypeT&>* prop = new Property<propertyTypeT&>(value);
|
Property<propertyTypeT&>* prop = new Property<propertyTypeT&>(value);
|
||||||
doSetProperty(name, std::auto_ptr<PropertyBase>(prop));
|
doSetProperty(name, std::auto_ptr<PropertyBase>(prop));
|
||||||
} // setProperty
|
} // setProperty
|
||||||
}; // class basic_XMLReader
|
}; // class XMLReaderInterface
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -25,16 +25,16 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_Attributes
|
* @see Attributes
|
||||||
* @see basic_Attributes2Impl
|
* @see Attributes2Impl
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_Attributes2 : public basic_Attributes<string_type>
|
class Attributes2 : public Attributes<string_type>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
virtual ~basic_Attributes2() { }
|
virtual ~Attributes2() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true unless the attribute value was provided by DTD defaulting.
|
* Returns true unless the attribute value was provided by DTD defaulting.
|
||||||
|
@ -70,12 +70,7 @@ public:
|
||||||
* does not identify an attribute
|
* does not identify an attribute
|
||||||
*/
|
*/
|
||||||
virtual bool isSpecified(const stringT& uri, const stringT& localName) const = 0;
|
virtual bool isSpecified(const stringT& uri, const stringT& localName) const = 0;
|
||||||
}; // class basic_Attributes2
|
}; // class Attributes2
|
||||||
|
|
||||||
typedef basic_Attributes2<std::string> Attributes2;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_Attributes2<std::wstring> wAttributes2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -22,15 +22,15 @@ namespace SAX
|
||||||
*
|
*
|
||||||
* <p>Note that data-related DTD declarations (unparsed entities and
|
* <p>Note that data-related DTD declarations (unparsed entities and
|
||||||
* notations) are already reported through the {@link
|
* notations) are already reported through the {@link
|
||||||
* basic_DTDHandler DTDHandler} interface.</p>
|
* DTDHandler DTDHandler} interface.</p>
|
||||||
*
|
*
|
||||||
* <p>If you are using the declaration handler together with a lexical
|
* <p>If you are using the declaration handler together with a lexical
|
||||||
* handler, all of the events will occur between the
|
* handler, all of the events will occur between the
|
||||||
* {@link basic_LexicalHandler#startDTD startDTD} and the
|
* {@link LexicalHandler#startDTD startDTD} and the
|
||||||
* {@link basic_LexicalHandler#endDTD endDTD} events.</p>
|
* {@link LexicalHandler#endDTD endDTD} events.</p>
|
||||||
*
|
*
|
||||||
* <p>To set the DeclHandler for an XML reader, use the
|
* <p>To set the DeclHandler for an XML reader, use the
|
||||||
* {@link basic_XMLReader#setProperty setProperty} method
|
* {@link XMLReader#setProperty setProperty} method
|
||||||
* with the propertyId "http://xml.org/sax/properties/declaration-handler".
|
* with the propertyId "http://xml.org/sax/properties/declaration-handler".
|
||||||
* If the reader does not support declaration events, it will throw a
|
* If the reader does not support declaration events, it will throw a
|
||||||
* {@link SAXNotRecognizedException SAXNotRecognizedException}
|
* {@link SAXNotRecognizedException SAXNotRecognizedException}
|
||||||
|
@ -42,14 +42,14 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @see basic_XMLReader
|
* @see XMLReader
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_DeclHandler
|
class DeclHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
virtual ~basic_DeclHandler() { }
|
virtual ~DeclHandler() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report an element type declaration.
|
* Report an element type declaration.
|
||||||
|
@ -106,7 +106,7 @@ public:
|
||||||
* entity, the name will begin with '%'.
|
* entity, the name will begin with '%'.
|
||||||
* @param value The replacement text of the entity.
|
* @param value The replacement text of the entity.
|
||||||
* @see #externalEntityDecl
|
* @see #externalEntityDecl
|
||||||
* @see basic_DTDHandler#unparsedEntityDecl
|
* @see DTDHandler#unparsedEntityDecl
|
||||||
*/
|
*/
|
||||||
virtual void internalEntityDecl(const stringT& name, const stringT& value) = 0;
|
virtual void internalEntityDecl(const stringT& name, const stringT& value) = 0;
|
||||||
/**
|
/**
|
||||||
|
@ -121,17 +121,12 @@ public:
|
||||||
* an empty string if none was declared.
|
* an empty string if none was declared.
|
||||||
* @param systemId The declared system identifier of the entity.
|
* @param systemId The declared system identifier of the entity.
|
||||||
* @see #internalEntityDecl
|
* @see #internalEntityDecl
|
||||||
* @see basic_DTDHandler#unparsedEntityDecl
|
* @see DTDHandler#unparsedEntityDecl
|
||||||
*/
|
*/
|
||||||
virtual void externalEntityDecl(const stringT& name,
|
virtual void externalEntityDecl(const stringT& name,
|
||||||
const stringT& publicId,
|
const stringT& publicId,
|
||||||
const stringT& systemId) = 0;
|
const stringT& systemId) = 0;
|
||||||
}; // class basic_DeclHandler
|
}; // class DeclHandler
|
||||||
|
|
||||||
typedef basic_DeclHandler<std::string> DeclHandler;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_DeclHandler<std::wstring> wDeclHandler;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -20,45 +20,40 @@ namespace SAX
|
||||||
* Default base class for SAX2 event handlers.
|
* Default base class for SAX2 event handlers.
|
||||||
*
|
*
|
||||||
* <p>This class extends the SAX2 base
|
* <p>This class extends the SAX2 base
|
||||||
* {@link basic_DefaultHandler} handler class to
|
* {@link DefaultHandler} handler class to
|
||||||
* support the SAX2 {@link basic_LexicalHandler LexicalHandler}
|
* support the SAX2 {@link LexicalHandler LexicalHandler}
|
||||||
* and {@link basic_DeclHandler DeclHandler} extensions.
|
* and {@link DeclHandler DeclHandler} extensions.
|
||||||
* The added handler methods just return; subclassers may
|
* The added handler methods just return; subclassers may
|
||||||
* override on a method-by-method basis.
|
* override on a method-by-method basis.
|
||||||
*
|
*
|
||||||
* Note: this class might yet learn that the
|
* Note: this class might yet learn that the
|
||||||
* ContentHandler.setDocumentLocator() call might be
|
* ContentHandler.setDocumentLocator() call might be
|
||||||
* passed a {@link basic_Locator2 Locator2} object, and
|
* passed a {@link Locator2 Locator2} object, and
|
||||||
* that the ContentHandler.startElement() call might be
|
* that the ContentHandler.startElement() call might be
|
||||||
* passed a {@link basic_Attributes2 Attributes2} object.
|
* passed a {@link Attributes2 Attributes2} object.
|
||||||
*
|
*
|
||||||
* @since SAX 2.0
|
* @since SAX 2.0
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_DefaultHandler
|
* @see DefaultHandler
|
||||||
* @see basic_LexicalHandler
|
* @see LexicalHandler
|
||||||
* @see basic_DeclHandler
|
* @see DeclHandler
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_DefaultHandler2 : public basic_DefaultHandler<string_type>
|
class DefaultHandler2 : public DefaultHandler<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
|
|
||||||
basic_DefaultHandler2() { }
|
DefaultHandler2() { }
|
||||||
virtual ~basic_DefaultHandler2() { }
|
virtual ~DefaultHandler2() { }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
basic_DefaultHandler2(const basic_DefaultHandler2&);
|
DefaultHandler2(const DefaultHandler2&);
|
||||||
basic_DefaultHandler2& operator=(const basic_DefaultHandler2&);
|
DefaultHandler2& operator=(const DefaultHandler2&);
|
||||||
bool operator==(const basic_DefaultHandler2&);
|
bool operator==(const DefaultHandler2&);
|
||||||
}; // class basic_DefaultHandler
|
}; // class DefaultHandler
|
||||||
|
|
||||||
typedef basic_DefaultHandler2<std::string> DefaultHandler2;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_DefaultHandler2<std::wstring> wDefaultHandler2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace SAX
|
||||||
* endDocument events.</p>
|
* endDocument events.</p>
|
||||||
*
|
*
|
||||||
* <p>To set the LexicalHandler for an XML reader, use the
|
* <p>To set the LexicalHandler for an XML reader, use the
|
||||||
* {@link basic_XMLReader#setProperty setProperty} method
|
* {@link XMLReader#setProperty setProperty} method
|
||||||
* with the propertyId "http://xml.org/sax/properties/lexical-handler".
|
* with the propertyId "http://xml.org/sax/properties/lexical-handler".
|
||||||
* If the reader does not support lexical events, it will throw a
|
* If the reader does not support lexical events, it will throw a
|
||||||
* {@link SAXNotRecognizedException SAXNotRecognizedException}
|
* {@link SAXNotRecognizedException SAXNotRecognizedException}
|
||||||
|
@ -39,17 +39,17 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @see basic_XMLReader#setProperty
|
* @see XMLReader#setProperty
|
||||||
* @see SAXNotRecognizedException
|
* @see SAXNotRecognizedException
|
||||||
* @see SAXNotSupportedException
|
* @see SAXNotSupportedException
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_LexicalHandler
|
class LexicalHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
|
|
||||||
virtual ~basic_LexicalHandler() { }
|
virtual ~LexicalHandler() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report the start of DTD declarations, if any.
|
* Report the start of DTD declarations, if any.
|
||||||
|
@ -59,8 +59,8 @@ public:
|
||||||
* this method will not be invoked.</p>
|
* this method will not be invoked.</p>
|
||||||
*
|
*
|
||||||
* <p>All declarations reported through
|
* <p>All declarations reported through
|
||||||
* {@link basic_DTDHandler DTDHandler} or
|
* {@link DTDHandler DTDHandler} or
|
||||||
* {@link basic_DeclHandler DeclHandler} events must appear
|
* {@link DeclHandler DeclHandler} events must appear
|
||||||
* between the startDTD and {@link #endDTD endDTD} events.
|
* between the startDTD and {@link #endDTD endDTD} events.
|
||||||
* Declarations are assumed to belong to the internal DTD subset
|
* Declarations are assumed to belong to the internal DTD subset
|
||||||
* unless they appear between {@link #startEntity startEntity}
|
* unless they appear between {@link #startEntity startEntity}
|
||||||
|
@ -74,7 +74,7 @@ public:
|
||||||
* <p>Note that the start/endDTD events will appear within
|
* <p>Note that the start/endDTD events will appear within
|
||||||
* the start/endDocument events from ContentHandler and
|
* the start/endDocument events from ContentHandler and
|
||||||
* before the first
|
* before the first
|
||||||
* {@link basic_ContentHandler#startElement startElement}
|
* {@link ContentHandler#startElement startElement}
|
||||||
* event.</p>
|
* event.</p>
|
||||||
*
|
*
|
||||||
* @param name The document type name.
|
* @param name The document type name.
|
||||||
|
@ -116,11 +116,11 @@ public:
|
||||||
* <p>When a SAX2 driver is providing these events, all other
|
* <p>When a SAX2 driver is providing these events, all other
|
||||||
* events must be properly nested within start/end entity
|
* events must be properly nested within start/end entity
|
||||||
* events. There is no additional requirement that events from
|
* events. There is no additional requirement that events from
|
||||||
* {@link basic_DeclHandler DeclHandler} or
|
* {@link DeclHandler DeclHandler} or
|
||||||
* {@link basic_DTDHandler DTDHandler} be properly ordered.</p>
|
* {@link DTDHandler DTDHandler} be properly ordered.</p>
|
||||||
*
|
*
|
||||||
* <p>Note that skipped entities will be reported through the
|
* <p>Note that skipped entities will be reported through the
|
||||||
* {@link basic_ContentHandler#skippedEntity skippedEntity}
|
* {@link ContentHandler#skippedEntity skippedEntity}
|
||||||
* event, which is part of the ContentHandler interface.</p>
|
* event, which is part of the ContentHandler interface.</p>
|
||||||
*
|
*
|
||||||
* <p>Because of the streaming event model that SAX uses, some
|
* <p>Because of the streaming event model that SAX uses, some
|
||||||
|
@ -144,8 +144,8 @@ public:
|
||||||
* entity, the name will begin with '%', and if it is the
|
* entity, the name will begin with '%', and if it is the
|
||||||
* external DTD subset, it will be "[dtd]".
|
* external DTD subset, it will be "[dtd]".
|
||||||
* @see #endEntity
|
* @see #endEntity
|
||||||
* @see basic_DeclHandler#internalEntityDecl
|
* @see DeclHandler#internalEntityDecl
|
||||||
* @see basic_DeclHandler#externalEntityDecl
|
* @see DeclHandler#externalEntityDecl
|
||||||
*/
|
*/
|
||||||
virtual void startEntity(const stringT& name) = 0;
|
virtual void startEntity(const stringT& name) = 0;
|
||||||
/**
|
/**
|
||||||
|
@ -160,7 +160,7 @@ public:
|
||||||
* Report the start of a CDATA section.
|
* Report the start of a CDATA section.
|
||||||
*
|
*
|
||||||
* <p>The contents of the CDATA section will be reported through
|
* <p>The contents of the CDATA section will be reported through
|
||||||
* the regular {@link basic_ContentHandler#characters
|
* the regular {@link ContentHandler#characters
|
||||||
* characters} event; this event is intended only to report
|
* characters} event; this event is intended only to report
|
||||||
* the boundary.</p>
|
* the boundary.</p>
|
||||||
*
|
*
|
||||||
|
@ -186,12 +186,7 @@ public:
|
||||||
* @param text A string holding the comment.
|
* @param text A string holding the comment.
|
||||||
*/
|
*/
|
||||||
virtual void comment(const stringT& text) = 0;
|
virtual void comment(const stringT& text) = 0;
|
||||||
}; // class basic_LexicalHandler
|
}; // class LexicalHandler
|
||||||
|
|
||||||
typedef basic_LexicalHandler<std::string> LexicalHandler;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_LexicalHandler<std::wstring> wLexicalHandler;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -26,12 +26,12 @@ namespace SAX
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_Locator2 : public basic_Locator<string_type>
|
class Locator2 : public Locator<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
|
|
||||||
virtual ~basic_Locator2() { }
|
virtual ~Locator2() { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the version of XML used for the entity. This will normally
|
* Returns the version of XML used for the entity. This will normally
|
||||||
|
@ -65,12 +65,7 @@ public:
|
||||||
* @return Name of the character encoding being used to interpret the entity's text.
|
* @return Name of the character encoding being used to interpret the entity's text.
|
||||||
*/
|
*/
|
||||||
virtual stringT getEncoding() const = 0;
|
virtual stringT getEncoding() const = 0;
|
||||||
}; // class basic_Locator2
|
}; // class Locator2
|
||||||
|
|
||||||
typedef basic_Locator2<std::string> Locator2;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_Locator2<std::wstring> wLocator2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -40,10 +40,10 @@ namespace SAX
|
||||||
}; // XMLPScanToken
|
}; // XMLPScanToken
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_ProgressiveParser : public basic_XMLReader<string_type>
|
class ProgressiveParser : public XMLReaderInterface<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename basic_XMLReader<string_type>::InputSourceT InputSourceT;
|
typedef typename XMLReaderInterface<string_type>::InputSourceT InputSourceT;
|
||||||
|
|
||||||
/** @name Progressive Parsing Methods */
|
/** @name Progressive Parsing Methods */
|
||||||
//@{
|
//@{
|
||||||
|
@ -153,12 +153,8 @@ namespace SAX
|
||||||
*/
|
*/
|
||||||
virtual void parseReset(XMLPScanToken& token) = 0;
|
virtual void parseReset(XMLPScanToken& token) = 0;
|
||||||
//@}
|
//@}
|
||||||
}; // basic_ProgressiveParser
|
}; // ProgressiveParser
|
||||||
|
|
||||||
typedef basic_ProgressiveParser<std::string> ProgressiveParser;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_ProgressiveParser<std::wstring> wProgressiveParser;
|
|
||||||
#endif
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -13,23 +13,23 @@ namespace SAX
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class string_type, class string_adaptor = Arabica::default_string_adaptor<string_type> >
|
template<class string_type, class string_adaptor = Arabica::default_string_adaptor<string_type> >
|
||||||
class NamespaceTracker : public basic_XMLFilterImpl<string_type>
|
class NamespaceTracker : public XMLFilterImpl<string_type>
|
||||||
{
|
{
|
||||||
typedef basic_NamespaceSupport<string_type, string_adaptor> NamespaceSupportT;
|
typedef NamespaceSupport<string_type, string_adaptor> NamespaceSupportT;
|
||||||
typedef typename NamespaceSupportT::stringListT stringListT;
|
typedef typename NamespaceSupportT::stringListT stringListT;
|
||||||
typedef basic_XMLFilterImpl<string_type> XMLFilterT;
|
typedef XMLFilterImpl<string_type> XMLFilterT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef basic_XMLReader<string_type> XMLReaderT;
|
typedef XMLReaderInterface<string_type> XMLReaderT;
|
||||||
typedef basic_Attributes<string_type> AttributesT;
|
typedef Attributes<string_type> AttributesT;
|
||||||
|
|
||||||
NamespaceTracker() :
|
NamespaceTracker() :
|
||||||
basic_XMLFilterImpl<string_type>()
|
XMLFilterImpl<string_type>()
|
||||||
{
|
{
|
||||||
} // NamespaceTracker
|
} // NamespaceTracker
|
||||||
|
|
||||||
NamespaceTracker(XMLReaderT& parent) :
|
NamespaceTracker(XMLReaderT& parent) :
|
||||||
basic_XMLFilterImpl<string_type>(parent)
|
XMLFilterImpl<string_type>(parent)
|
||||||
{
|
{
|
||||||
} // NamespaceTracker
|
} // NamespaceTracker
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ namespace SAX
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class PYXWriter : public basic_XMLFilterImpl<string_type>
|
class PYXWriter : public XMLFilterImpl<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
|
@ -20,9 +20,9 @@ class PYXWriter : public basic_XMLFilterImpl<string_type>
|
||||||
typedef typename string_type::value_type charT;
|
typedef typename string_type::value_type charT;
|
||||||
typedef typename string_type::traits_type traitsT;
|
typedef typename string_type::traits_type traitsT;
|
||||||
typedef std::basic_ostream<charT, traitsT> ostreamT;
|
typedef std::basic_ostream<charT, traitsT> ostreamT;
|
||||||
typedef basic_XMLReader<stringT> XMLReaderT;
|
typedef XMLReaderInterface<stringT> XMLReaderT;
|
||||||
typedef basic_XMLFilterImpl<stringT> XMLFilterT;
|
typedef XMLFilterImpl<stringT> XMLFilterT;
|
||||||
typedef typename basic_XMLFilterImpl<stringT>::AttributesT AttributesT;
|
typedef typename XMLFilterImpl<stringT>::AttributesT AttributesT;
|
||||||
typedef Arabica::Unicode<charT> UnicodeT;
|
typedef Arabica::Unicode<charT> UnicodeT;
|
||||||
private:
|
private:
|
||||||
using XMLFilterT::getParent;
|
using XMLFilterT::getParent;
|
||||||
|
|
|
@ -17,23 +17,23 @@ namespace SAX
|
||||||
This filter buffers up multiple calls to characters(...) and reports text in a single lump.
|
This filter buffers up multiple calls to characters(...) and reports text in a single lump.
|
||||||
*/
|
*/
|
||||||
template<class string_type, class string_adaptor = Arabica::default_string_adaptor<string_type> >
|
template<class string_type, class string_adaptor = Arabica::default_string_adaptor<string_type> >
|
||||||
class TextCoalescer : public basic_XMLFilterImpl<string_type>
|
class TextCoalescer : public XMLFilterImpl<string_type>
|
||||||
{
|
{
|
||||||
typedef basic_XMLFilterImpl<string_type> XMLFilterT;
|
typedef XMLFilterImpl<string_type> XMLFilterT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef basic_XMLReader<string_type> XMLReaderT;
|
typedef XMLReaderInterface<string_type> XMLReaderT;
|
||||||
typedef basic_Attributes<string_type> AttributesT;
|
typedef Attributes<string_type> AttributesT;
|
||||||
|
|
||||||
TextCoalescer() :
|
TextCoalescer() :
|
||||||
XMLFilterT()
|
XMLFilterT()
|
||||||
{
|
{
|
||||||
} // basic_TextCoalescer
|
} // TextCoalescer
|
||||||
|
|
||||||
TextCoalescer(XMLReaderT& parent) :
|
TextCoalescer(XMLReaderT& parent) :
|
||||||
XMLFilterT(parent)
|
XMLFilterT(parent)
|
||||||
{
|
{
|
||||||
} // basic_TextCoalescer
|
} // TextCoalescer
|
||||||
|
|
||||||
virtual void startElement(const string_type& namespaceURI, const string_type& localName,
|
virtual void startElement(const string_type& namespaceURI, const string_type& localName,
|
||||||
const string_type& qName, const AttributesT& atts)
|
const string_type& qName, const AttributesT& atts)
|
||||||
|
@ -93,7 +93,7 @@ private:
|
||||||
buffer_ = string_adaptor::empty_string();
|
buffer_ = string_adaptor::empty_string();
|
||||||
} // flush
|
} // flush
|
||||||
string_type buffer_;
|
string_type buffer_;
|
||||||
}; // class basic_TextCoalescer
|
}; // class TextCoalescer
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -14,12 +14,12 @@ namespace SAX
|
||||||
Strips out everything except startDocument, endDocument and text
|
Strips out everything except startDocument, endDocument and text
|
||||||
*/
|
*/
|
||||||
template<class string_type, class string_adaptor = Arabica::default_string_adaptor<string_type> >
|
template<class string_type, class string_adaptor = Arabica::default_string_adaptor<string_type> >
|
||||||
class TextOnly : public basic_XMLFilterImpl<string_type>
|
class TextOnly : public XMLFilterImpl<string_type>
|
||||||
{
|
{
|
||||||
typedef basic_XMLFilterImpl<string_type> XMLFilterT;
|
typedef XMLFilterImpl<string_type> XMLFilterT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef basic_XMLReader<string_type> XMLReaderT;
|
typedef XMLReaderInterface<string_type> XMLReaderT;
|
||||||
|
|
||||||
TextOnly() :
|
TextOnly() :
|
||||||
XMLFilterT(0)
|
XMLFilterT(0)
|
||||||
|
|
|
@ -11,12 +11,12 @@ namespace SAX
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class string_type, class string_adaptor = Arabica::default_string_adaptor<string_type> >
|
template<class string_type, class string_adaptor = Arabica::default_string_adaptor<string_type> >
|
||||||
class WhitespaceStripper : public SAX::basic_XMLFilterImpl<string_type>
|
class WhitespaceStripper : public SAX::XMLFilterImpl<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef SAX::basic_XMLFilterImpl<stringT> baseT;
|
typedef SAX::XMLFilterImpl<stringT> baseT;
|
||||||
typedef SAX::basic_XMLReader<stringT> XMLReaderT;
|
typedef SAX::XMLReader<stringT> XMLReaderT;
|
||||||
|
|
||||||
WhitespaceStripper() :
|
WhitespaceStripper() :
|
||||||
baseT()
|
baseT()
|
||||||
|
|
|
@ -18,29 +18,29 @@ namespace SAX
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_Writer : public basic_XMLFilterImpl<string_type>
|
class Writer : public XMLFilterImpl<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef basic_Writer<stringT> WriterT;
|
typedef Writer<stringT> WriterT;
|
||||||
typedef typename string_type::value_type charT;
|
typedef typename string_type::value_type charT;
|
||||||
typedef typename string_type::traits_type traitsT;
|
typedef typename string_type::traits_type traitsT;
|
||||||
typedef std::basic_ostream<charT, traitsT> ostreamT;
|
typedef std::basic_ostream<charT, traitsT> ostreamT;
|
||||||
typedef basic_XMLReader<stringT> XMLReaderT;
|
typedef XMLReaderInterface<stringT> XMLReaderT;
|
||||||
typedef basic_XMLFilterImpl<stringT> XMLFilterT;
|
typedef XMLFilterImpl<stringT> XMLFilterT;
|
||||||
typedef typename basic_XMLFilterImpl<stringT>::AttributesT AttributesT;
|
typedef typename XMLFilterImpl<stringT>::AttributesT AttributesT;
|
||||||
typedef Arabica::Unicode<charT> UnicodeT;
|
typedef Arabica::Unicode<charT> UnicodeT;
|
||||||
typedef Arabica::XML::text_escaper<charT, traitsT> text_escaperT;
|
typedef Arabica::XML::text_escaper<charT, traitsT> text_escaperT;
|
||||||
typedef Arabica::XML::attribute_escaper<charT, traitsT> attribute_escaperT;
|
typedef Arabica::XML::attribute_escaper<charT, traitsT> attribute_escaperT;
|
||||||
private:
|
private:
|
||||||
typedef basic_LexicalHandler<stringT> LexicalHandlerT;
|
typedef LexicalHandler<stringT> LexicalHandlerT;
|
||||||
typedef basic_DeclHandler<stringT> DeclHandlerT;
|
typedef DeclHandler<stringT> DeclHandlerT;
|
||||||
typedef typename XMLReaderT::InputSourceT InputSourceT;
|
typedef typename XMLReaderT::InputSourceT InputSourceT;
|
||||||
typedef typename XMLReaderT::PropertyBase PropertyBaseT;
|
typedef typename XMLReaderT::PropertyBase PropertyBaseT;
|
||||||
using XMLFilterT::getParent;
|
using XMLFilterT::getParent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
basic_Writer(ostreamT& stream, unsigned int indent = 2) :
|
Writer(ostreamT& stream, unsigned int indent = 2) :
|
||||||
inCDATA_(false),
|
inCDATA_(false),
|
||||||
inDTD_(false),
|
inDTD_(false),
|
||||||
internalSubset_(true),
|
internalSubset_(true),
|
||||||
|
@ -50,9 +50,9 @@ class basic_Writer : public basic_XMLFilterImpl<string_type>
|
||||||
encoding_(),
|
encoding_(),
|
||||||
lastTag_(startTag)
|
lastTag_(startTag)
|
||||||
{
|
{
|
||||||
} // basic_Writer
|
} // Writer
|
||||||
|
|
||||||
basic_Writer(ostreamT& stream, XMLReaderT& parent, unsigned int indent = 2) :
|
Writer(ostreamT& stream, XMLReaderT& parent, unsigned int indent = 2) :
|
||||||
XMLFilterT(parent),
|
XMLFilterT(parent),
|
||||||
inCDATA_(false),
|
inCDATA_(false),
|
||||||
inDTD_(false),
|
inDTD_(false),
|
||||||
|
@ -63,9 +63,9 @@ class basic_Writer : public basic_XMLFilterImpl<string_type>
|
||||||
encoding_(),
|
encoding_(),
|
||||||
lastTag_(startTag)
|
lastTag_(startTag)
|
||||||
{
|
{
|
||||||
} // basic_Writer
|
} // Writer
|
||||||
|
|
||||||
basic_Writer(ostreamT& stream, const stringT& encoding, unsigned int indent = 2) :
|
Writer(ostreamT& stream, const stringT& encoding, unsigned int indent = 2) :
|
||||||
inCDATA_(false),
|
inCDATA_(false),
|
||||||
inDTD_(false),
|
inDTD_(false),
|
||||||
internalSubset_(true),
|
internalSubset_(true),
|
||||||
|
@ -75,9 +75,9 @@ class basic_Writer : public basic_XMLFilterImpl<string_type>
|
||||||
encoding_(encoding),
|
encoding_(encoding),
|
||||||
lastTag_(startTag)
|
lastTag_(startTag)
|
||||||
{
|
{
|
||||||
} // basic_Writer
|
} // Writer
|
||||||
|
|
||||||
basic_Writer(ostreamT& stream, XMLReaderT& parent, const stringT& encoding, unsigned int indent = 2) :
|
Writer(ostreamT& stream, XMLReaderT& parent, const stringT& encoding, unsigned int indent = 2) :
|
||||||
XMLFilterT(parent),
|
XMLFilterT(parent),
|
||||||
inCDATA_(false),
|
inCDATA_(false),
|
||||||
inDTD_(false),
|
inDTD_(false),
|
||||||
|
@ -88,7 +88,7 @@ class basic_Writer : public basic_XMLFilterImpl<string_type>
|
||||||
encoding_(encoding),
|
encoding_(encoding),
|
||||||
lastTag_(startTag)
|
lastTag_(startTag)
|
||||||
{
|
{
|
||||||
} // basic_Writer
|
} // Writer
|
||||||
|
|
||||||
// setEncoding
|
// setEncoding
|
||||||
// Sets the encoding included in the XML declaration. If not set, then the encoding
|
// Sets the encoding included in the XML declaration. If not set, then the encoding
|
||||||
|
@ -149,10 +149,10 @@ class basic_Writer : public basic_XMLFilterImpl<string_type>
|
||||||
enum { startTag, endTag, docTag } lastTag_;
|
enum { startTag, endTag, docTag } lastTag_;
|
||||||
const SAX::PropertyNames<stringT> properties_;
|
const SAX::PropertyNames<stringT> properties_;
|
||||||
|
|
||||||
}; // class basic_Writer
|
}; // class Writer
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::startDocument()
|
void Writer<string_type>::startDocument()
|
||||||
{
|
{
|
||||||
*stream_ << UnicodeT::LESS_THAN_SIGN
|
*stream_ << UnicodeT::LESS_THAN_SIGN
|
||||||
<< UnicodeT::QUESTION_MARK
|
<< UnicodeT::QUESTION_MARK
|
||||||
|
@ -202,14 +202,14 @@ void basic_Writer<string_type>::startDocument()
|
||||||
} // startDocument
|
} // startDocument
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::endDocument()
|
void Writer<string_type>::endDocument()
|
||||||
{
|
{
|
||||||
XMLFilterT::endDocument();
|
XMLFilterT::endDocument();
|
||||||
lastTag_ = endTag;
|
lastTag_ = endTag;
|
||||||
} // endDocument
|
} // endDocument
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::startElement(
|
void Writer<string_type>::startElement(
|
||||||
const stringT& namespaceURI, const stringT& localName,
|
const stringT& namespaceURI, const stringT& localName,
|
||||||
const stringT& qName, const AttributesT& atts)
|
const stringT& qName, const AttributesT& atts)
|
||||||
{
|
{
|
||||||
|
@ -237,7 +237,7 @@ void basic_Writer<string_type>::startElement(
|
||||||
} // startElement
|
} // startElement
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::endElement(
|
void Writer<string_type>::endElement(
|
||||||
const stringT& namespaceURI, const stringT& localName,
|
const stringT& namespaceURI, const stringT& localName,
|
||||||
const stringT& qName)
|
const stringT& qName)
|
||||||
{
|
{
|
||||||
|
@ -256,7 +256,7 @@ void basic_Writer<string_type>::endElement(
|
||||||
} // endElement
|
} // endElement
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::characters(const stringT& ch)
|
void Writer<string_type>::characters(const stringT& ch)
|
||||||
{
|
{
|
||||||
if(!inCDATA_)
|
if(!inCDATA_)
|
||||||
std::for_each(ch.begin(), ch.end(), text_escaperT(*stream_));
|
std::for_each(ch.begin(), ch.end(), text_escaperT(*stream_));
|
||||||
|
@ -267,7 +267,7 @@ void basic_Writer<string_type>::characters(const stringT& ch)
|
||||||
} // characters
|
} // characters
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::ignorableWhitespace(const stringT& ch)
|
void Writer<string_type>::ignorableWhitespace(const stringT& ch)
|
||||||
{
|
{
|
||||||
*stream_ << ch;
|
*stream_ << ch;
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ void basic_Writer<string_type>::ignorableWhitespace(const stringT& ch)
|
||||||
} // ignorableWhitespace
|
} // ignorableWhitespace
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::processingInstruction(const stringT& target, const stringT& data)
|
void Writer<string_type>::processingInstruction(const stringT& target, const stringT& data)
|
||||||
{
|
{
|
||||||
if((!inDTD_) || (inDTD_ && internalSubset_))
|
if((!inDTD_) || (inDTD_ && internalSubset_))
|
||||||
{
|
{
|
||||||
|
@ -294,7 +294,7 @@ void basic_Writer<string_type>::processingInstruction(const stringT& target, con
|
||||||
} // processingInstruction
|
} // processingInstruction
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::skippedEntity(const stringT& name)
|
void Writer<string_type>::skippedEntity(const stringT& name)
|
||||||
{
|
{
|
||||||
if(!isDtd(name))
|
if(!isDtd(name))
|
||||||
*stream_ << UnicodeT::AMPERSAND << name << UnicodeT::SEMI_COLON;
|
*stream_ << UnicodeT::AMPERSAND << name << UnicodeT::SEMI_COLON;
|
||||||
|
@ -303,14 +303,14 @@ void basic_Writer<string_type>::skippedEntity(const stringT& name)
|
||||||
} // skippedEntity
|
} // skippedEntity
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::doIndent()
|
void Writer<string_type>::doIndent()
|
||||||
{
|
{
|
||||||
for(int i = 0; i < depth_; ++i)
|
for(int i = 0; i < depth_; ++i)
|
||||||
*stream_ << UnicodeT::SPACE;
|
*stream_ << UnicodeT::SPACE;
|
||||||
} // doIndent
|
} // doIndent
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
bool basic_Writer<string_type>::isDtd(const string_type& name)
|
bool Writer<string_type>::isDtd(const string_type& name)
|
||||||
{
|
{
|
||||||
return (name.length() == 5 &&
|
return (name.length() == 5 &&
|
||||||
name[0] == UnicodeT::LEFT_SQUARE_BRACKET &&
|
name[0] == UnicodeT::LEFT_SQUARE_BRACKET &&
|
||||||
|
@ -321,7 +321,7 @@ bool basic_Writer<string_type>::isDtd(const string_type& name)
|
||||||
} // isDtd
|
} // isDtd
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::startDTD(const stringT& name, const stringT& publicId, const stringT& systemId)
|
void Writer<string_type>::startDTD(const stringT& name, const stringT& publicId, const stringT& systemId)
|
||||||
{
|
{
|
||||||
inDTD_ = true;
|
inDTD_ = true;
|
||||||
depth_ += indent_;
|
depth_ += indent_;
|
||||||
|
@ -348,7 +348,7 @@ void basic_Writer<string_type>::startDTD(const stringT& name, const stringT& pub
|
||||||
} // startDTD
|
} // startDTD
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::endDTD()
|
void Writer<string_type>::endDTD()
|
||||||
{
|
{
|
||||||
*stream_ << UnicodeT::RIGHT_SQUARE_BRACKET
|
*stream_ << UnicodeT::RIGHT_SQUARE_BRACKET
|
||||||
<< UnicodeT::GREATER_THAN_SIGN
|
<< UnicodeT::GREATER_THAN_SIGN
|
||||||
|
@ -361,7 +361,7 @@ void basic_Writer<string_type>::endDTD()
|
||||||
} // endDTD
|
} // endDTD
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::startEntity(const stringT& name)
|
void Writer<string_type>::startEntity(const stringT& name)
|
||||||
{
|
{
|
||||||
if(isDtd(name))
|
if(isDtd(name))
|
||||||
internalSubset_ = false;
|
internalSubset_ = false;
|
||||||
|
@ -370,7 +370,7 @@ void basic_Writer<string_type>::startEntity(const stringT& name)
|
||||||
} // startEntity
|
} // startEntity
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::endEntity(const stringT& name)
|
void Writer<string_type>::endEntity(const stringT& name)
|
||||||
{
|
{
|
||||||
if(isDtd(name))
|
if(isDtd(name))
|
||||||
internalSubset_ = true;
|
internalSubset_ = true;
|
||||||
|
@ -379,7 +379,7 @@ void basic_Writer<string_type>::endEntity(const stringT& name)
|
||||||
} // endEntity
|
} // endEntity
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::startCDATA()
|
void Writer<string_type>::startCDATA()
|
||||||
{
|
{
|
||||||
inCDATA_ = true;
|
inCDATA_ = true;
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ void basic_Writer<string_type>::startCDATA()
|
||||||
} // startCDATA
|
} // startCDATA
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::endCDATA()
|
void Writer<string_type>::endCDATA()
|
||||||
{
|
{
|
||||||
*stream_ << UnicodeT::RIGHT_SQUARE_BRACKET
|
*stream_ << UnicodeT::RIGHT_SQUARE_BRACKET
|
||||||
<< UnicodeT::RIGHT_SQUARE_BRACKET
|
<< UnicodeT::RIGHT_SQUARE_BRACKET
|
||||||
|
@ -409,7 +409,7 @@ void basic_Writer<string_type>::endCDATA()
|
||||||
} // endCDATA
|
} // endCDATA
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::comment(const stringT& text)
|
void Writer<string_type>::comment(const stringT& text)
|
||||||
{
|
{
|
||||||
if((!inDTD_) || (inDTD_ && internalSubset_))
|
if((!inDTD_) || (inDTD_ && internalSubset_))
|
||||||
*stream_ << UnicodeT::LESS_THAN_SIGN
|
*stream_ << UnicodeT::LESS_THAN_SIGN
|
||||||
|
@ -425,7 +425,7 @@ void basic_Writer<string_type>::comment(const stringT& text)
|
||||||
} // comment
|
} // comment
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::notationDecl(const stringT& name, const stringT& publicId, const stringT& systemId)
|
void Writer<string_type>::notationDecl(const stringT& name, const stringT& publicId, const stringT& systemId)
|
||||||
{
|
{
|
||||||
if(inDTD_ && internalSubset_)
|
if(inDTD_ && internalSubset_)
|
||||||
{
|
{
|
||||||
|
@ -454,7 +454,7 @@ void basic_Writer<string_type>::notationDecl(const stringT& name, const stringT&
|
||||||
} // notationDecl
|
} // notationDecl
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::unparsedEntityDecl(const stringT& name, const stringT& publicId, const stringT& systemId, const stringT& notationName)
|
void Writer<string_type>::unparsedEntityDecl(const stringT& name, const stringT& publicId, const stringT& systemId, const stringT& notationName)
|
||||||
{
|
{
|
||||||
if(inDTD_ && internalSubset_)
|
if(inDTD_ && internalSubset_)
|
||||||
{
|
{
|
||||||
|
@ -479,7 +479,7 @@ void basic_Writer<string_type>::unparsedEntityDecl(const stringT& name, const st
|
||||||
} // unparsedEntityDecl
|
} // unparsedEntityDecl
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::elementDecl(const stringT& name, const stringT& model)
|
void Writer<string_type>::elementDecl(const stringT& name, const stringT& model)
|
||||||
{
|
{
|
||||||
if(inDTD_ && internalSubset_)
|
if(inDTD_ && internalSubset_)
|
||||||
{
|
{
|
||||||
|
@ -507,7 +507,7 @@ void basic_Writer<string_type>::elementDecl(const stringT& name, const stringT&
|
||||||
} // elementDecl
|
} // elementDecl
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::attributeDecl(const stringT& elementName, const stringT& attributeName,
|
void Writer<string_type>::attributeDecl(const stringT& elementName, const stringT& attributeName,
|
||||||
const stringT& type, const stringT& valueDefault, const stringT& value)
|
const stringT& type, const stringT& valueDefault, const stringT& value)
|
||||||
{
|
{
|
||||||
if(inDTD_ && internalSubset_)
|
if(inDTD_ && internalSubset_)
|
||||||
|
@ -548,7 +548,7 @@ void basic_Writer<string_type>::attributeDecl(const stringT& elementName, const
|
||||||
} // attributeDecl
|
} // attributeDecl
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::internalEntityDecl(const stringT& name, const stringT& value)
|
void Writer<string_type>::internalEntityDecl(const stringT& name, const stringT& value)
|
||||||
{
|
{
|
||||||
if(inDTD_ && internalSubset_)
|
if(inDTD_ && internalSubset_)
|
||||||
{
|
{
|
||||||
|
@ -566,7 +566,7 @@ void basic_Writer<string_type>::internalEntityDecl(const stringT& name, const st
|
||||||
} // internalEntityDecl
|
} // internalEntityDecl
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::externalEntityDecl(const stringT& name, const stringT& publicId, const stringT& systemId)
|
void Writer<string_type>::externalEntityDecl(const stringT& name, const stringT& publicId, const stringT& systemId)
|
||||||
{
|
{
|
||||||
if(inDTD_ && internalSubset_)
|
if(inDTD_ && internalSubset_)
|
||||||
{
|
{
|
||||||
|
@ -581,7 +581,7 @@ void basic_Writer<string_type>::externalEntityDecl(const stringT& name, const st
|
||||||
} // externalEntityDecl
|
} // externalEntityDecl
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::startEntityDecl(const stringT& name)
|
void Writer<string_type>::startEntityDecl(const stringT& name)
|
||||||
{
|
{
|
||||||
*stream_ << UnicodeT::LESS_THAN_SIGN
|
*stream_ << UnicodeT::LESS_THAN_SIGN
|
||||||
<< UnicodeT::EXCLAMATION_MARK
|
<< UnicodeT::EXCLAMATION_MARK
|
||||||
|
@ -596,7 +596,7 @@ void basic_Writer<string_type>::startEntityDecl(const stringT& name)
|
||||||
} // startEntityDecl
|
} // startEntityDecl
|
||||||
|
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
void basic_Writer<string_type>::publicAndSystem(const stringT& publicId, const stringT& systemId)
|
void Writer<string_type>::publicAndSystem(const stringT& publicId, const stringT& systemId)
|
||||||
{
|
{
|
||||||
*stream_ << UnicodeT::SPACE;
|
*stream_ << UnicodeT::SPACE;
|
||||||
|
|
||||||
|
@ -628,11 +628,6 @@ void basic_Writer<string_type>::publicAndSystem(const stringT& publicId, const s
|
||||||
} // if ...
|
} // if ...
|
||||||
} // publicAndSystem
|
} // publicAndSystem
|
||||||
|
|
||||||
typedef basic_Writer<std::string> Writer;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_Writer<std::wstring> wWriter;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -12,25 +12,25 @@ namespace SAX
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class string_type, class string_adaptor = Arabica::default_string_adaptor<string_type> >
|
template<class string_type, class string_adaptor = Arabica::default_string_adaptor<string_type> >
|
||||||
class XMLBaseTracker : public basic_XMLFilterImpl<string_type>
|
class XMLBaseTracker : public XMLFilterImpl<string_type>
|
||||||
{
|
{
|
||||||
typedef basic_XMLBaseSupport<string_type, string_adaptor> XMLBaseSupportT;
|
typedef XMLBaseSupport<string_type, string_adaptor> XMLBaseSupportT;
|
||||||
typedef basic_XMLFilterImpl<string_type> XMLFilterT;
|
typedef XMLFilterImpl<string_type> XMLFilterT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef basic_XMLReader<string_type> XMLReaderT;
|
typedef XMLReaderInterface<string_type> XMLReaderT;
|
||||||
typedef basic_Locator<string_type> LocatorT;
|
typedef Locator<string_type> LocatorT;
|
||||||
typedef basic_Attributes<string_type> AttributesT;
|
typedef Attributes<string_type> AttributesT;
|
||||||
|
|
||||||
XMLBaseTracker() :
|
XMLBaseTracker() :
|
||||||
basic_XMLFilterImpl<string_type>(),
|
XMLFilterImpl<string_type>(),
|
||||||
locator_(0),
|
locator_(0),
|
||||||
base_set_(false)
|
base_set_(false)
|
||||||
{
|
{
|
||||||
} // XMLBaseTracker
|
} // XMLBaseTracker
|
||||||
|
|
||||||
XMLBaseTracker(XMLReaderT& parent) :
|
XMLBaseTracker(XMLReaderT& parent) :
|
||||||
basic_XMLFilterImpl<string_type>(parent),
|
XMLFilterImpl<string_type>(parent),
|
||||||
locator_(0),
|
locator_(0),
|
||||||
base_set_(false)
|
base_set_(false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,12 +37,12 @@ const std::string const types[] = { empty_, "CDATA", "ID", "IDREF", "IDREFS", "N
|
||||||
* Default implementation for AttributeList.
|
* Default implementation for AttributeList.
|
||||||
*
|
*
|
||||||
* <p>AttributeList implements the deprecated SAX1 {@link
|
* <p>AttributeList implements the deprecated SAX1 {@link
|
||||||
* basic_AttributeList AttributeList} interface, and has been
|
* AttributeList AttributeList} interface, and has been
|
||||||
* replaced by the new SAX2 {@link basic_AttributesImpl
|
* replaced by the new SAX2 {@link AttributesImpl
|
||||||
* AttributesImpl} interface.</p>
|
* AttributesImpl} interface.</p>
|
||||||
*
|
*
|
||||||
* <p>This class provides a convenience implementation of the SAX
|
* <p>This class provides a convenience implementation of the SAX
|
||||||
* {@link basic_AttributeList AttributeList} interface. This
|
* {@link AttributeList AttributeList} interface. This
|
||||||
* implementation is useful both for SAX parser writers, who can use
|
* implementation is useful both for SAX parser writers, who can use
|
||||||
* it to provide attributes to the application, and for SAX application
|
* it to provide attributes to the application, and for SAX application
|
||||||
* writers, who can use it to create a persistent copy of an element's
|
* writers, who can use it to create a persistent copy of an element's
|
||||||
|
@ -67,38 +67,38 @@ const std::string const types[] = { empty_, "CDATA", "ID", "IDREF", "IDREFS", "N
|
||||||
* implementations.</p>
|
* implementations.</p>
|
||||||
*
|
*
|
||||||
* @deprecated This class implements a deprecated interface,
|
* @deprecated This class implements a deprecated interface,
|
||||||
* {@link basic_AttributeList AttributeList};
|
* {@link AttributeList AttributeList};
|
||||||
* that interface has been replaced by
|
* that interface has been replaced by
|
||||||
* {@link basic_Attributes Attributes},
|
* {@link Attributes Attributes},
|
||||||
* which is implemented in the
|
* which is implemented in the
|
||||||
* {@link basic_AttributesImpl
|
* {@link AttributesImpl
|
||||||
* AttributesImpl} helper class.
|
* AttributesImpl} helper class.
|
||||||
* @since SAX 1.0
|
* @since SAX 1.0
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_AttributeList
|
* @see AttributeList
|
||||||
* @see basic_DocumentHandler#startElement
|
* @see DocumentHandler#startElement
|
||||||
*/
|
*/
|
||||||
template<class stringT>
|
template<class stringT>
|
||||||
class basic_AttributeListImpl : public basic_AttributeList<stringT>
|
class AttributeListImpl : public AttributeList<stringT>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
basic_AttributeListImpl() : atts_() { }
|
AttributeListImpl() : atts_() { }
|
||||||
basic_AttributeListImpl(const basic_AttributeList& atts)
|
AttributeListImpl(const AttributeList& atts)
|
||||||
: atts_(atts.getLength())
|
: atts_(atts.getLength())
|
||||||
{
|
{
|
||||||
setAttributeList(atts);
|
setAttributeList(atts);
|
||||||
} // AttributeListImpl
|
} // AttributeListImpl
|
||||||
|
|
||||||
basic_AttributeListImpl& operator=(const basic_AttributeList& atts)
|
AttributeListImpl& operator=(const AttributeList& atts)
|
||||||
{
|
{
|
||||||
setAttributeList(atts);
|
setAttributeList(atts);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
} // operator=
|
} // operator=
|
||||||
|
|
||||||
virtual ~basic_AttributeListImpl() { clear(); }
|
virtual ~AttributeListImpl() { clear(); }
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Methods specific to this class.
|
// Methods specific to this class.
|
||||||
|
@ -132,7 +132,7 @@ public:
|
||||||
* @param type The attribute type ("NMTOKEN" for an enumeration).
|
* @param type The attribute type ("NMTOKEN" for an enumeration).
|
||||||
* @param value The attribute value.
|
* @param value The attribute value.
|
||||||
* @see #removeAttribute
|
* @see #removeAttribute
|
||||||
* @see basic_DocumentHandler#startElement
|
* @see DocumentHandler#startElement
|
||||||
*/
|
*/
|
||||||
void addAttribute(const stringT& name, const stringT& type, const stringT& value)
|
void addAttribute(const stringT& name, const stringT& type, const stringT& value)
|
||||||
{
|
{
|
||||||
|
@ -170,7 +170,7 @@ public:
|
||||||
* it will make sense to reuse the same AttributeListImpl object
|
* it will make sense to reuse the same AttributeListImpl object
|
||||||
* rather than allocating a new one each time.</p>
|
* rather than allocating a new one each time.</p>
|
||||||
*
|
*
|
||||||
* @see basic_DocumentHandler#startElement
|
* @see DocumentHandler#startElement
|
||||||
*/
|
*/
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
|
@ -188,7 +188,7 @@ public:
|
||||||
* Return the number of attributes in the list.
|
* Return the number of attributes in the list.
|
||||||
*
|
*
|
||||||
* @return The number of attributes in the list.
|
* @return The number of attributes in the list.
|
||||||
* @see basic_AttributeList#getLength
|
* @see AttributeList#getLength
|
||||||
*/
|
*/
|
||||||
virtual int getLength() const
|
virtual int getLength() const
|
||||||
{
|
{
|
||||||
|
@ -201,7 +201,7 @@ public:
|
||||||
* @param i The position of the attribute in the list.
|
* @param i The position of the attribute in the list.
|
||||||
* @return The attribute name as a string, or an empty string if there
|
* @return The attribute name as a string, or an empty string if there
|
||||||
* is no attribute at that position.
|
* is no attribute at that position.
|
||||||
* @see basic_AttributeList#getName(int)
|
* @see AttributeList#getName(int)
|
||||||
*/
|
*/
|
||||||
virtual const stringT& getName(int i) const
|
virtual const stringT& getName(int i) const
|
||||||
{
|
{
|
||||||
|
@ -218,7 +218,7 @@ public:
|
||||||
* enumeration, and "CDATA" if no declaration was
|
* enumeration, and "CDATA" if no declaration was
|
||||||
* read), or an empty string if there is no attribute at
|
* read), or an empty string if there is no attribute at
|
||||||
* that position.
|
* that position.
|
||||||
* @see basic_AttributeList#getType(int)
|
* @see AttributeList#getType(int)
|
||||||
*/
|
*/
|
||||||
virtual const stringT& getType(int i) const
|
virtual const stringT& getType(int i) const
|
||||||
{
|
{
|
||||||
|
@ -233,7 +233,7 @@ public:
|
||||||
* @param i The position of the attribute in the list.
|
* @param i The position of the attribute in the list.
|
||||||
* @return The attribute value as a string, or an empty string if
|
* @return The attribute value as a string, or an empty string if
|
||||||
* there is no attribute at that position.
|
* there is no attribute at that position.
|
||||||
* @see basic_AttributeList#getValue(int)
|
* @see AttributeList#getValue(int)
|
||||||
*/
|
*/
|
||||||
virtual const stringT& getValue(int i) const
|
virtual const stringT& getValue(int i) const
|
||||||
{
|
{
|
||||||
|
@ -249,7 +249,7 @@ public:
|
||||||
* @return The attribute type as a string ("NMTOKEN" for an
|
* @return The attribute type as a string ("NMTOKEN" for an
|
||||||
* enumeration, and "CDATA" if no declaration was
|
* enumeration, and "CDATA" if no declaration was
|
||||||
* read).
|
* read).
|
||||||
* @see basic_AttributeList#getType(java.lang.String)
|
* @see AttributeList#getType(java.lang.String)
|
||||||
*/
|
*/
|
||||||
virtual const stringT& getType(const stringT& name) const
|
virtual const stringT& getType(const stringT& name) const
|
||||||
{
|
{
|
||||||
|
@ -261,7 +261,7 @@ public:
|
||||||
* Get the value of an attribute (by name).
|
* Get the value of an attribute (by name).
|
||||||
*
|
*
|
||||||
* @param name The attribute name.
|
* @param name The attribute name.
|
||||||
* @see basic_AttributeList#getValue(java.lang.String)
|
* @see AttributeList#getValue(java.lang.String)
|
||||||
*/
|
*/
|
||||||
virtual const stringT& getValue(const stringT& name) const
|
virtual const stringT& getValue(const stringT& name) const
|
||||||
{
|
{
|
||||||
|
@ -287,14 +287,9 @@ private:
|
||||||
return res;
|
return res;
|
||||||
} // index
|
} // index
|
||||||
|
|
||||||
bool operator==(const basic_AttributeList&) const; // not implemented
|
bool operator==(const AttributeList&) const; // not implemented
|
||||||
}; // class AttributeListImpl
|
}; // class AttributeListImpl
|
||||||
|
|
||||||
typedef basic_AttributeListImpl<std::string> AttributeListImpl;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_AttributeListImpl<std::wstring> wAttributeListImpl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace SAX
|
||||||
* Default implementation of the Attributes interface.
|
* Default implementation of the Attributes interface.
|
||||||
*
|
*
|
||||||
* <p>This class provides a default implementation of the SAX2
|
* <p>This class provides a default implementation of the SAX2
|
||||||
* {@link basic_Attributes Attributes} interface, with the
|
* {@link Attributes Attributes} interface, with the
|
||||||
* addition of manipulators so that the list can be modified or
|
* addition of manipulators so that the list can be modified or
|
||||||
* reused.</p>
|
* reused.</p>
|
||||||
*
|
*
|
||||||
|
@ -25,12 +25,12 @@ namespace SAX
|
||||||
*
|
*
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>to take a persistent snapshot of an Attributes object
|
* <li>to take a persistent snapshot of an Attributes object
|
||||||
* in a {@link basic_ContentHandler#startElement startElement} event; or</li>
|
* in a {@link ContentHandler#startElement startElement} event; or</li>
|
||||||
* <li>to construct or modify an Attributes object in a SAX2 driver or filter.</li>
|
* <li>to construct or modify an Attributes object in a SAX2 driver or filter.</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
* <p>This class replaces the now-deprecated SAX1 {@link
|
* <p>This class replaces the now-deprecated SAX1 {@link
|
||||||
* basic_AttributeListImpl AttributeListImpl}
|
* AttributeListImpl AttributeListImpl}
|
||||||
* class.</p>
|
* class.</p>
|
||||||
*
|
*
|
||||||
* @since SAX 2.0
|
* @since SAX 2.0
|
||||||
|
@ -39,19 +39,19 @@ namespace SAX
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_AttributesImpl : public basic_Attributes<string_type>
|
class AttributesImpl : public Attributes<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef basic_Attributes<stringT> AttributesT;
|
typedef Attributes<stringT> AttributesT;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Constructors.
|
// Constructors.
|
||||||
basic_AttributesImpl() { }
|
AttributesImpl() { }
|
||||||
basic_AttributesImpl(const AttributesT& atts)
|
AttributesImpl(const AttributesT& atts)
|
||||||
{
|
{
|
||||||
setAttributes(atts);
|
setAttributes(atts);
|
||||||
} // basic_AttributesImpl
|
} // AttributesImpl
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Implementation of SAX::Attributes.
|
// Implementation of SAX::Attributes.
|
||||||
|
@ -59,7 +59,7 @@ public:
|
||||||
* Return the number of attributes in the list.
|
* Return the number of attributes in the list.
|
||||||
*
|
*
|
||||||
* @return The number of attributes in the list.
|
* @return The number of attributes in the list.
|
||||||
* @see basic_Attributes#getLength
|
* @see Attributes#getLength
|
||||||
*/
|
*/
|
||||||
virtual int getLength() const
|
virtual int getLength() const
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ public:
|
||||||
* @param index The attribute's index (zero-based).
|
* @param index The attribute's index (zero-based).
|
||||||
* @return The Namespace URI, the empty string if none is
|
* @return The Namespace URI, the empty string if none is
|
||||||
* available, or if the index is out of range.
|
* available, or if the index is out of range.
|
||||||
* @see basic_Attributes#getURI
|
* @see Attributes#getURI
|
||||||
*/
|
*/
|
||||||
virtual stringT getURI(unsigned int index) const
|
virtual stringT getURI(unsigned int index) const
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,7 @@ public:
|
||||||
* @param index The attribute's index (zero-based).
|
* @param index The attribute's index (zero-based).
|
||||||
* @return The attribute's local name, the empty string if
|
* @return The attribute's local name, the empty string if
|
||||||
* none is available, or if the index if out of range.
|
* none is available, or if the index if out of range.
|
||||||
* @see basic_Attributes#getLocalName
|
* @see Attributes#getLocalName
|
||||||
*/
|
*/
|
||||||
virtual stringT getLocalName(unsigned int index) const
|
virtual stringT getLocalName(unsigned int index) const
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ public:
|
||||||
* @param index The attribute's index (zero-based).
|
* @param index The attribute's index (zero-based).
|
||||||
* @return The attribute's qualified name, the empty string if
|
* @return The attribute's qualified name, the empty string if
|
||||||
* none is available, or if the index is out of bounds.
|
* none is available, or if the index is out of bounds.
|
||||||
* @see basic_Attributes#getQName
|
* @see Attributes#getQName
|
||||||
*/
|
*/
|
||||||
virtual stringT getQName(unsigned int index) const
|
virtual stringT getQName(unsigned int index) const
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ public:
|
||||||
* @param index The attribute's index (zero-based).
|
* @param index The attribute's index (zero-based).
|
||||||
* @return The attribute's type, "CDATA" if the type is unknown, or an empty
|
* @return The attribute's type, "CDATA" if the type is unknown, or an empty
|
||||||
* string if the index is out of bounds.
|
* string if the index is out of bounds.
|
||||||
* @see basic_Attributes#getType(int)
|
* @see Attributes#getType(int)
|
||||||
*/
|
*/
|
||||||
virtual stringT getType(unsigned int index) const
|
virtual stringT getType(unsigned int index) const
|
||||||
{
|
{
|
||||||
|
@ -134,7 +134,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param index The attribute's index (zero-based).
|
* @param index The attribute's index (zero-based).
|
||||||
* @return The attribute's value or an empty string if the index is out of bounds.
|
* @return The attribute's value or an empty string if the index is out of bounds.
|
||||||
* @see basic_Attributes#getValue(int)
|
* @see Attributes#getValue(int)
|
||||||
*/
|
*/
|
||||||
virtual stringT getValue(unsigned int index) const
|
virtual stringT getValue(unsigned int index) const
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@ public:
|
||||||
* string if none is available.
|
* string if none is available.
|
||||||
* @param localName The attribute's local name.
|
* @param localName The attribute's local name.
|
||||||
* @return The attribute's index, or -1 if none matches.
|
* @return The attribute's index, or -1 if none matches.
|
||||||
* @see basic_Attributes#getIndex(const stringT&,const stringT&)
|
* @see Attributes#getIndex(const stringT&,const stringT&)
|
||||||
*/
|
*/
|
||||||
virtual int getIndex(const stringT& uri, const stringT& localName) const
|
virtual int getIndex(const stringT& uri, const stringT& localName) const
|
||||||
{
|
{
|
||||||
|
@ -170,7 +170,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param qName The qualified name.
|
* @param qName The qualified name.
|
||||||
* @return The attribute's index, or -1 if none matches.
|
* @return The attribute's index, or -1 if none matches.
|
||||||
* @see basic_Attributes#getIndex(const stringT&)
|
* @see Attributes#getIndex(const stringT&)
|
||||||
*/
|
*/
|
||||||
virtual int getIndex(const stringT& qName) const
|
virtual int getIndex(const stringT& qName) const
|
||||||
{
|
{
|
||||||
|
@ -191,7 +191,7 @@ public:
|
||||||
* @param localName The local name.
|
* @param localName The local name.
|
||||||
* @return The attribute's type, or an empty string if there is no
|
* @return The attribute's type, or an empty string if there is no
|
||||||
* matching attribute.
|
* matching attribute.
|
||||||
* @see basic_Attributes#getType(const stringT&,const stringT&)
|
* @see Attributes#getType(const stringT&,const stringT&)
|
||||||
*/
|
*/
|
||||||
virtual stringT getType(const stringT& uri, const stringT& localName) const
|
virtual stringT getType(const stringT& uri, const stringT& localName) const
|
||||||
{
|
{
|
||||||
|
@ -207,7 +207,7 @@ public:
|
||||||
* @param qName The qualified name.
|
* @param qName The qualified name.
|
||||||
* @return The attribute's type, or an empty string if there is no
|
* @return The attribute's type, or an empty string if there is no
|
||||||
* matching attribute.
|
* matching attribute.
|
||||||
* @see basic_Attributes#getType(const stringT&)
|
* @see Attributes#getType(const stringT&)
|
||||||
*/
|
*/
|
||||||
virtual stringT getType(const stringT& qName) const
|
virtual stringT getType(const stringT& qName) const
|
||||||
{
|
{
|
||||||
|
@ -228,7 +228,7 @@ public:
|
||||||
* @param localName The local name.
|
* @param localName The local name.
|
||||||
* @return The attribute's value, or an empty string if there is no
|
* @return The attribute's value, or an empty string if there is no
|
||||||
* matching attribute.
|
* matching attribute.
|
||||||
* @see basic_Attributes#getValue(const stringT&,const stringT&)
|
* @see Attributes#getValue(const stringT&,const stringT&)
|
||||||
*/
|
*/
|
||||||
virtual stringT getValue(const stringT& uri, const stringT& localName) const
|
virtual stringT getValue(const stringT& uri, const stringT& localName) const
|
||||||
{
|
{
|
||||||
|
@ -244,7 +244,7 @@ public:
|
||||||
* @param qName The qualified name.
|
* @param qName The qualified name.
|
||||||
* @return The attribute's value, or an empty string if there is no
|
* @return The attribute's value, or an empty string if there is no
|
||||||
* matching attribute.
|
* matching attribute.
|
||||||
* @see basic_Attributes#getValue(const stringT&)
|
* @see Attributes#getValue(const stringT&)
|
||||||
*/
|
*/
|
||||||
virtual stringT getValue(const stringT& qName) const
|
virtual stringT getValue(const stringT& qName) const
|
||||||
{
|
{
|
||||||
|
@ -556,11 +556,6 @@ private:
|
||||||
stringT emptyString_;
|
stringT emptyString_;
|
||||||
}; // class AttributesImpl
|
}; // class AttributesImpl
|
||||||
|
|
||||||
typedef basic_AttributesImpl<std::string> AttributesImpl;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_AttributesImpl<std::wstring> wAttributesImpl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,10 @@ namespace Arabica
|
||||||
namespace SAX
|
namespace SAX
|
||||||
{
|
{
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class CatchErrorHandler : public SAX::basic_ErrorHandler<string_type>
|
class CatchErrorHandler : public SAX::ErrorHandler<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef SAX::basic_SAXParseException<string_type> SAXParseExceptionT;
|
typedef SAX::SAXParseException<string_type> SAXParseExceptionT;
|
||||||
|
|
||||||
CatchErrorHandler() : errors_() { }
|
CatchErrorHandler() : errors_() { }
|
||||||
virtual ~CatchErrorHandler() { }
|
virtual ~CatchErrorHandler() { }
|
||||||
|
|
|
@ -29,9 +29,9 @@ namespace SAX
|
||||||
* callbacks in the four core SAX2 handler classes:</p>
|
* callbacks in the four core SAX2 handler classes:</p>
|
||||||
*
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@link basic_EntityResolver EntityResolver}</li>
|
* <li>{@link EntityResolver EntityResolver}</li>
|
||||||
* <li>{@link basic_DTDHandler DTDHandler}</li>
|
* <li>{@link DTDHandler DTDHandler}</li>
|
||||||
* <li>{@link basic_ContentHandler ContentHandler}</li>
|
* <li>{@link ContentHandler ContentHandler}</li>
|
||||||
* <li>{@link ErrorHandler ErrorHandler}</li>
|
* <li>{@link ErrorHandler ErrorHandler}</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
|
@ -41,34 +41,34 @@ namespace SAX
|
||||||
* application has not supplied its own.</p>
|
* application has not supplied its own.</p>
|
||||||
*
|
*
|
||||||
* <p>This class replaces the deprecated SAX1
|
* <p>This class replaces the deprecated SAX1
|
||||||
* {@link basic_HandlerBase HandlerBase} class.</p>
|
* {@link HandlerBase HandlerBase} class.</p>
|
||||||
*
|
*
|
||||||
* @since SAX 2.0
|
* @since SAX 2.0
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_EntityResolver
|
* @see EntityResolver
|
||||||
* @see basic_DTDHandler
|
* @see DTDHandler
|
||||||
* @see basic_ContentHandler
|
* @see ContentHandler
|
||||||
* @see basic_ErrorHandler
|
* @see ErrorHandler
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_DefaultHandler : public basic_EntityResolver<string_type>,
|
class DefaultHandler : public EntityResolver<string_type>,
|
||||||
public basic_DTDHandler<string_type>,
|
public DTDHandler<string_type>,
|
||||||
public basic_ContentHandler<string_type>,
|
public ContentHandler<string_type>,
|
||||||
public basic_ErrorHandler<string_type>,
|
public ErrorHandler<string_type>,
|
||||||
public basic_LexicalHandler<string_type>,
|
public LexicalHandler<string_type>,
|
||||||
public basic_DeclHandler<string_type>
|
public DeclHandler<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef basic_InputSource<stringT> InputSourceT;
|
typedef InputSource<stringT> InputSourceT;
|
||||||
typedef basic_Locator<stringT> LocatorT;
|
typedef Locator<stringT> LocatorT;
|
||||||
typedef basic_Attributes<stringT> AttributesT;
|
typedef Attributes<stringT> AttributesT;
|
||||||
typedef basic_SAXParseException<stringT> SAXParseExceptionT;
|
typedef SAXParseException<stringT> SAXParseExceptionT;
|
||||||
|
|
||||||
basic_DefaultHandler() { }
|
DefaultHandler() { }
|
||||||
virtual ~basic_DefaultHandler() { }
|
virtual ~DefaultHandler() { }
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
// EntityResolver
|
// EntityResolver
|
||||||
|
@ -88,7 +88,7 @@ public:
|
||||||
* @return The new input source, (empty to require the
|
* @return The new input source, (empty to require the
|
||||||
* default behaviour).
|
* default behaviour).
|
||||||
* @exception SAXException Any SAX exception.
|
* @exception SAXException Any SAX exception.
|
||||||
* @see basic_EntityResolver#resolveEntity
|
* @see EntityResolver#resolveEntity
|
||||||
*/
|
*/
|
||||||
virtual InputSourceT resolveEntity(const stringT& /* publicId */, const stringT& /* systemId */)
|
virtual InputSourceT resolveEntity(const stringT& /* publicId */, const stringT& /* systemId */)
|
||||||
{
|
{
|
||||||
|
@ -110,7 +110,7 @@ public:
|
||||||
* @param systemId The notation system identifier.
|
* @param systemId The notation system identifier.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_DTDHandler#notationDecl
|
* @see DTDHandler#notationDecl
|
||||||
*/
|
*/
|
||||||
virtual void notationDecl(const stringT& /* name */,
|
virtual void notationDecl(const stringT& /* name */,
|
||||||
const stringT& /* publicId */,
|
const stringT& /* publicId */,
|
||||||
|
@ -132,7 +132,7 @@ public:
|
||||||
* @param notationName The name of the associated notation.
|
* @param notationName The name of the associated notation.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_DTDHandler#unparsedEntityDecl
|
* @see DTDHandler#unparsedEntityDecl
|
||||||
*/
|
*/
|
||||||
virtual void unparsedEntityDecl(const stringT& /* name */,
|
virtual void unparsedEntityDecl(const stringT& /* name */,
|
||||||
const stringT& /* publicId */,
|
const stringT& /* publicId */,
|
||||||
|
@ -151,8 +151,8 @@ public:
|
||||||
* with other document events.</p>
|
* with other document events.</p>
|
||||||
*
|
*
|
||||||
* @param locator A locator for all SAX document events.
|
* @param locator A locator for all SAX document events.
|
||||||
* @see basic_ContentHandler#setDocumentLocator
|
* @see ContentHandler#setDocumentLocator
|
||||||
* @see basic_Locator
|
* @see Locator
|
||||||
*/
|
*/
|
||||||
virtual void setDocumentLocator(const LocatorT& /* locator */) { }
|
virtual void setDocumentLocator(const LocatorT& /* locator */) { }
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ public:
|
||||||
*
|
*
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ContentHandler#startDocument
|
* @see ContentHandler#startDocument
|
||||||
*/
|
*/
|
||||||
virtual void startDocument() { }
|
virtual void startDocument() { }
|
||||||
/**
|
/**
|
||||||
|
@ -179,7 +179,7 @@ public:
|
||||||
*
|
*
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ContentHandler#endDocument
|
* @see ContentHandler#endDocument
|
||||||
*/
|
*/
|
||||||
virtual void endDocument() { }
|
virtual void endDocument() { }
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ public:
|
||||||
* @param uri The Namespace URI mapped to the prefix.
|
* @param uri The Namespace URI mapped to the prefix.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ContentHandler#startPrefixMapping
|
* @see ContentHandler#startPrefixMapping
|
||||||
*/
|
*/
|
||||||
virtual void startPrefixMapping(const stringT& /* prefix */, const stringT& /* uri */) { }
|
virtual void startPrefixMapping(const stringT& /* prefix */, const stringT& /* uri */) { }
|
||||||
/**
|
/**
|
||||||
|
@ -207,7 +207,7 @@ public:
|
||||||
* @param prefix The Namespace prefix being declared.
|
* @param prefix The Namespace prefix being declared.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ContentHandler#endPrefixMapping
|
* @see ContentHandler#endPrefixMapping
|
||||||
*/
|
*/
|
||||||
virtual void endPrefixMapping(const stringT& /* prefix */) { }
|
virtual void endPrefixMapping(const stringT& /* prefix */) { }
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ public:
|
||||||
* attributes, it shall be an empty Attributes object.
|
* attributes, it shall be an empty Attributes object.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ContentHandler#startElement
|
* @see ContentHandler#startElement
|
||||||
*/
|
*/
|
||||||
virtual void startElement(const stringT& /* namespaceURI */, const stringT& /* localName */,
|
virtual void startElement(const stringT& /* namespaceURI */, const stringT& /* localName */,
|
||||||
const stringT& /* qName */, const AttributesT& /* atts */) { }
|
const stringT& /* qName */, const AttributesT& /* atts */) { }
|
||||||
|
@ -251,7 +251,7 @@ public:
|
||||||
* qualified names are not available.
|
* qualified names are not available.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ContentHandler#endElement
|
* @see ContentHandler#endElement
|
||||||
*/
|
*/
|
||||||
virtual void endElement(const stringT& /* namespaceURI */, const stringT& /* localName */,
|
virtual void endElement(const stringT& /* namespaceURI */, const stringT& /* localName */,
|
||||||
const stringT& /* qName */) { }
|
const stringT& /* qName */) { }
|
||||||
|
@ -267,7 +267,7 @@ public:
|
||||||
* @param ch The characters.
|
* @param ch The characters.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ContentHandler#characters
|
* @see ContentHandler#characters
|
||||||
*/
|
*/
|
||||||
virtual void characters(const stringT& /* ch */) { }
|
virtual void characters(const stringT& /* ch */) { }
|
||||||
/**
|
/**
|
||||||
|
@ -281,7 +281,7 @@ public:
|
||||||
* @param ch The whitespace characters.
|
* @param ch The whitespace characters.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ContentHandler#ignorableWhitespace
|
* @see ContentHandler#ignorableWhitespace
|
||||||
*/
|
*/
|
||||||
virtual void ignorableWhitespace(const stringT& /* ch */) { }
|
virtual void ignorableWhitespace(const stringT& /* ch */) { }
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ public:
|
||||||
* none is supplied.
|
* none is supplied.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ContentHandler#processingInstruction
|
* @see ContentHandler#processingInstruction
|
||||||
*/
|
*/
|
||||||
virtual void processingInstruction(const stringT& /* target */, const stringT& /* data */) { }
|
virtual void processingInstruction(const stringT& /* target */, const stringT& /* data */) { }
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ public:
|
||||||
* @param name The name of the skipped entity.
|
* @param name The name of the skipped entity.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ContentHandler#processingInstruction
|
* @see ContentHandler#processingInstruction
|
||||||
*/
|
*/
|
||||||
virtual void skippedEntity(const stringT& /* name */) { }
|
virtual void skippedEntity(const stringT& /* name */) { }
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ public:
|
||||||
* @param e The warning information encoded as an exception.
|
* @param e The warning information encoded as an exception.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ErrorHandler#warning
|
* @see ErrorHandler#warning
|
||||||
* @see SAXParseException
|
* @see SAXParseException
|
||||||
*/
|
*/
|
||||||
virtual void warning(const SAXParseExceptionT& /* e */) { }
|
virtual void warning(const SAXParseExceptionT& /* e */) { }
|
||||||
|
@ -345,7 +345,7 @@ public:
|
||||||
* @param e The warning information encoded as an exception.
|
* @param e The warning information encoded as an exception.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ErrorHandler#error
|
* @see ErrorHandler#error
|
||||||
* @see SAXParseException
|
* @see SAXParseException
|
||||||
*/
|
*/
|
||||||
virtual void error(const SAXParseExceptionT& /* e */) { }
|
virtual void error(const SAXParseExceptionT& /* e */) { }
|
||||||
|
@ -363,7 +363,7 @@ public:
|
||||||
* @param e The error information encoded as an exception.
|
* @param e The error information encoded as an exception.
|
||||||
* @exception SAXException Any SAX exception, possibly
|
* @exception SAXException Any SAX exception, possibly
|
||||||
* wrapping another exception.
|
* wrapping another exception.
|
||||||
* @see basic_ErrorHandler#fatalError
|
* @see ErrorHandler#fatalError
|
||||||
* @see SAXParseException
|
* @see SAXParseException
|
||||||
*/
|
*/
|
||||||
virtual void fatalError(const SAXParseExceptionT& e)
|
virtual void fatalError(const SAXParseExceptionT& e)
|
||||||
|
@ -384,8 +384,8 @@ public:
|
||||||
* this method will not be invoked.</p>
|
* this method will not be invoked.</p>
|
||||||
*
|
*
|
||||||
* <p>All declarations reported through
|
* <p>All declarations reported through
|
||||||
* {@link basic_DTDHandler DTDHandler} or
|
* {@link DTDHandler DTDHandler} or
|
||||||
* {@link basic_DeclHandler DeclHandler} events must appear
|
* {@link DeclHandler DeclHandler} events must appear
|
||||||
* between the startDTD and {@link #endDTD endDTD} events.
|
* between the startDTD and {@link #endDTD endDTD} events.
|
||||||
* Declarations are assumed to belong to the internal DTD subset
|
* Declarations are assumed to belong to the internal DTD subset
|
||||||
* unless they appear between {@link #startEntity startEntity}
|
* unless they appear between {@link #startEntity startEntity}
|
||||||
|
@ -399,7 +399,7 @@ public:
|
||||||
* <p>Note that the start/endDTD events will appear within
|
* <p>Note that the start/endDTD events will appear within
|
||||||
* the start/endDocument events from ContentHandler and
|
* the start/endDocument events from ContentHandler and
|
||||||
* before the first
|
* before the first
|
||||||
* {@link basic_ContentHandler#startElement startElement}
|
* {@link ContentHandler#startElement startElement}
|
||||||
* event.</p>
|
* event.</p>
|
||||||
*
|
*
|
||||||
* @param name The document type name.
|
* @param name The document type name.
|
||||||
|
@ -442,11 +442,11 @@ public:
|
||||||
* <p>When a SAX2 driver is providing these events, all other
|
* <p>When a SAX2 driver is providing these events, all other
|
||||||
* events must be properly nested within start/end entity
|
* events must be properly nested within start/end entity
|
||||||
* events. There is no additional requirement that events from
|
* events. There is no additional requirement that events from
|
||||||
* {@link basic_DeclHandler DeclHandler} or
|
* {@link DeclHandler DeclHandler} or
|
||||||
* {@link basic_DTDHandler DTDHandler} be properly ordered.</p>
|
* {@link DTDHandler DTDHandler} be properly ordered.</p>
|
||||||
*
|
*
|
||||||
* <p>Note that skipped entities will be reported through the
|
* <p>Note that skipped entities will be reported through the
|
||||||
* {@link basic_ContentHandler#skippedEntity skippedEntity}
|
* {@link ContentHandler#skippedEntity skippedEntity}
|
||||||
* event, which is part of the ContentHandler interface.</p>
|
* event, which is part of the ContentHandler interface.</p>
|
||||||
*
|
*
|
||||||
* <p>Because of the streaming event model that SAX uses, some
|
* <p>Because of the streaming event model that SAX uses, some
|
||||||
|
@ -470,8 +470,8 @@ public:
|
||||||
* entity, the name will begin with '%', and if it is the
|
* entity, the name will begin with '%', and if it is the
|
||||||
* external DTD subset, it will be "[dtd]".
|
* external DTD subset, it will be "[dtd]".
|
||||||
* @see #endEntity
|
* @see #endEntity
|
||||||
* @see basic_DeclHandler#internalEntityDecl
|
* @see DeclHandler#internalEntityDecl
|
||||||
* @see basic_DeclHandler#externalEntityDecl
|
* @see DeclHandler#externalEntityDecl
|
||||||
*/
|
*/
|
||||||
virtual void startEntity(const stringT& name) { }
|
virtual void startEntity(const stringT& name) { }
|
||||||
/**
|
/**
|
||||||
|
@ -486,7 +486,7 @@ public:
|
||||||
* Report the start of a CDATA section.
|
* Report the start of a CDATA section.
|
||||||
*
|
*
|
||||||
* <p>The contents of the CDATA section will be reported through
|
* <p>The contents of the CDATA section will be reported through
|
||||||
* the regular {@link basic_ContentHandler#characters
|
* the regular {@link ContentHandler#characters
|
||||||
* characters} event; this event is intended only to report
|
* characters} event; this event is intended only to report
|
||||||
* the boundary.</p>
|
* the boundary.</p>
|
||||||
*
|
*
|
||||||
|
@ -570,7 +570,7 @@ public:
|
||||||
* entity, the name will begin with '%'.
|
* entity, the name will begin with '%'.
|
||||||
* @param value The replacement text of the entity.
|
* @param value The replacement text of the entity.
|
||||||
* @see #externalEntityDecl
|
* @see #externalEntityDecl
|
||||||
* @see basic_DTDHandler#unparsedEntityDecl
|
* @see DTDHandler#unparsedEntityDecl
|
||||||
*/
|
*/
|
||||||
virtual void internalEntityDecl(const stringT& name, const stringT& value) { }
|
virtual void internalEntityDecl(const stringT& name, const stringT& value) { }
|
||||||
/**
|
/**
|
||||||
|
@ -585,21 +585,16 @@ public:
|
||||||
* an empty string if none was declared.
|
* an empty string if none was declared.
|
||||||
* @param systemId The declared system identifier of the entity.
|
* @param systemId The declared system identifier of the entity.
|
||||||
* @see #internalEntityDecl
|
* @see #internalEntityDecl
|
||||||
* @see basic_DTDHandler#unparsedEntityDecl
|
* @see DTDHandler#unparsedEntityDecl
|
||||||
*/
|
*/
|
||||||
virtual void externalEntityDecl(const stringT& name,
|
virtual void externalEntityDecl(const stringT& name,
|
||||||
const stringT& publicId,
|
const stringT& publicId,
|
||||||
const stringT& systemId) { }
|
const stringT& systemId) { }
|
||||||
private:
|
private:
|
||||||
basic_DefaultHandler(const basic_DefaultHandler&);
|
DefaultHandler(const DefaultHandler&);
|
||||||
basic_DefaultHandler& operator=(const basic_DefaultHandler&);
|
DefaultHandler& operator=(const DefaultHandler&);
|
||||||
bool operator==(const basic_DefaultHandler&);
|
bool operator==(const DefaultHandler&);
|
||||||
}; // class basic_DefaultHandler
|
}; // class DefaultHandler
|
||||||
|
|
||||||
typedef basic_DefaultHandler<std::string> DefaultHandler;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_DefaultHandler<std::wstring> wDefaultHandler;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -14,10 +14,10 @@ namespace SAX
|
||||||
class InputSourceResolver
|
class InputSourceResolver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InputSourceResolver(const SAX::InputSource& inputSource);
|
InputSourceResolver(const SAX::InputSource<std::string>& inputSource);
|
||||||
|
|
||||||
template<class stringT, class stringAdaptorT>
|
template<class stringT, class stringAdaptorT>
|
||||||
InputSourceResolver(const SAX::basic_InputSource<stringT>& inputSource,
|
InputSourceResolver(const SAX::InputSource<stringT>& inputSource,
|
||||||
const stringAdaptorT& SA) :
|
const stringAdaptorT& SA) :
|
||||||
deleteStream_(false),
|
deleteStream_(false),
|
||||||
byteStream_(0)
|
byteStream_(0)
|
||||||
|
|
|
@ -46,34 +46,34 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_Locator Locator
|
* @see Locator Locator
|
||||||
*/
|
*/
|
||||||
template<class string_type>
|
template<class string_type>
|
||||||
class basic_LocatorImpl : public basic_Locator<string_type>
|
class LocatorImpl : public Locator<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef basic_Locator<stringT> LocatorT;
|
typedef Locator<stringT> LocatorT;
|
||||||
|
|
||||||
basic_LocatorImpl() :
|
LocatorImpl() :
|
||||||
publicId_(),
|
publicId_(),
|
||||||
systemId_(),
|
systemId_(),
|
||||||
lineNumber_(-1),
|
lineNumber_(-1),
|
||||||
columnNumber_(-1)
|
columnNumber_(-1)
|
||||||
{
|
{
|
||||||
} // basic_LocatorImpl
|
} // LocatorImpl
|
||||||
|
|
||||||
basic_LocatorImpl(const LocatorT& rhs) :
|
LocatorImpl(const LocatorT& rhs) :
|
||||||
publicId_(rhs.getPublicId()),
|
publicId_(rhs.getPublicId()),
|
||||||
systemId_(rhs.getSystemId()),
|
systemId_(rhs.getSystemId()),
|
||||||
lineNumber_(rhs.getLineNumber()),
|
lineNumber_(rhs.getLineNumber()),
|
||||||
columnNumber_(rhs.getColumnNumber())
|
columnNumber_(rhs.getColumnNumber())
|
||||||
{
|
{
|
||||||
} // basic_LocatorImpl
|
} // LocatorImpl
|
||||||
|
|
||||||
virtual ~basic_LocatorImpl() { }
|
virtual ~LocatorImpl() { }
|
||||||
|
|
||||||
basic_LocatorImpl& operator=(const LocatorT& rhs)
|
LocatorImpl& operator=(const LocatorT& rhs)
|
||||||
{
|
{
|
||||||
publicId_ = rhs.getPublicId();
|
publicId_ = rhs.getPublicId();
|
||||||
systemId_ = rhs.getSystemId();
|
systemId_ = rhs.getSystemId();
|
||||||
|
@ -88,7 +88,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return The public identifier as a string, or an empty string if none
|
* @return The public identifier as a string, or an empty string if none
|
||||||
* is available.
|
* is available.
|
||||||
* @see basic_Locator#getPublicId
|
* @see Locator#getPublicId
|
||||||
* @see #setPublicId
|
* @see #setPublicId
|
||||||
*/
|
*/
|
||||||
virtual stringT getPublicId() const { return publicId_; }
|
virtual stringT getPublicId() const { return publicId_; }
|
||||||
|
@ -97,7 +97,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return The system identifier as a string, or an empty string if none
|
* @return The system identifier as a string, or an empty string if none
|
||||||
* is available.
|
* is available.
|
||||||
* @see basic_Locator#getSystemId
|
* @see Locator#getSystemId
|
||||||
* @see #setSystemId
|
* @see #setSystemId
|
||||||
*/
|
*/
|
||||||
virtual stringT getSystemId() const { return systemId_; }
|
virtual stringT getSystemId() const { return systemId_; }
|
||||||
|
@ -105,7 +105,7 @@ public:
|
||||||
* Return the saved line number (1-based).
|
* Return the saved line number (1-based).
|
||||||
*
|
*
|
||||||
* @return The line number as an integer, or -1 if none is available.
|
* @return The line number as an integer, or -1 if none is available.
|
||||||
* @see basic_Locator#getLineNumber
|
* @see Locator#getLineNumber
|
||||||
* @see #setLineNumber
|
* @see #setLineNumber
|
||||||
*/
|
*/
|
||||||
virtual int getLineNumber() const { return lineNumber_; }
|
virtual int getLineNumber() const { return lineNumber_; }
|
||||||
|
@ -113,7 +113,7 @@ public:
|
||||||
* Return the saved column number (1-based).
|
* Return the saved column number (1-based).
|
||||||
*
|
*
|
||||||
* @return The column number as an integer, or -1 if none is available.
|
* @return The column number as an integer, or -1 if none is available.
|
||||||
* @see basic_Locator#getColumnNumber
|
* @see Locator#getColumnNumber
|
||||||
* @see #setColumnNumber
|
* @see #setColumnNumber
|
||||||
*/
|
*/
|
||||||
virtual int getColumnNumber() const { return columnNumber_; }
|
virtual int getColumnNumber() const { return columnNumber_; }
|
||||||
|
@ -162,11 +162,6 @@ private:
|
||||||
bool operator==(const LocatorT& rhs) const;
|
bool operator==(const LocatorT& rhs) const;
|
||||||
}; // class LocatorImpl
|
}; // class LocatorImpl
|
||||||
|
|
||||||
typedef basic_LocatorImpl<std::string> LocatorImpl;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_LocatorImpl<std::wstring> wLocatorImpl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ struct NamespaceConstants
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
*/
|
*/
|
||||||
template<class stringT, class string_adaptorT>
|
template<class stringT, class string_adaptorT>
|
||||||
class basic_NamespaceSupport
|
class NamespaceSupport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::vector<stringT> stringListT;
|
typedef std::vector<stringT> stringListT;
|
||||||
|
@ -98,10 +98,10 @@ class basic_NamespaceSupport
|
||||||
}; // struct Parts
|
}; // struct Parts
|
||||||
|
|
||||||
// functions
|
// functions
|
||||||
basic_NamespaceSupport()
|
NamespaceSupport()
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
} // basic_NamespaceSupport
|
} // NamespaceSupport
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset this Namespace support object for reuse.
|
* Reset this Namespace support object for reuse.
|
||||||
|
@ -394,10 +394,10 @@ class basic_NamespaceSupport
|
||||||
const NamespaceConstants<stringT, string_adaptorT> nsc_;
|
const NamespaceConstants<stringT, string_adaptorT> nsc_;
|
||||||
|
|
||||||
// no impl
|
// no impl
|
||||||
basic_NamespaceSupport(const basic_NamespaceSupport&);
|
NamespaceSupport(const NamespaceSupport&);
|
||||||
basic_NamespaceSupport& operator=(const basic_NamespaceSupport&);
|
NamespaceSupport& operator=(const NamespaceSupport&);
|
||||||
bool operator==(const basic_NamespaceSupport&) const;
|
bool operator==(const NamespaceSupport&) const;
|
||||||
}; // class basic_NamespaceSupport
|
}; // class NamespaceSupport
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -25,10 +25,10 @@ namespace SAX
|
||||||
/**
|
/**
|
||||||
* Adapt a SAX1 Parser as a SAX2 XMLReader.
|
* Adapt a SAX1 Parser as a SAX2 XMLReader.
|
||||||
*
|
*
|
||||||
* <p>This class wraps a SAX1 {@link basic_Parser Parser}
|
* <p>This class wraps a SAX1 {@link Parser Parser}
|
||||||
* and makes it act as a SAX2 {@link basic_XMLReader XMLReader},
|
* and makes it act as a SAX2 {@link XMLReader XMLReader},
|
||||||
* with feature, property, and Namespace support. Note
|
* with feature, property, and Namespace support. Note
|
||||||
* that it is not possible to report {@link basic_ContentHandler#skippedEntity
|
* that it is not possible to report {@link ContentHandler#skippedEntity
|
||||||
* skippedEntity} events, since SAX1 does not make that information available.</p>
|
* skippedEntity} events, since SAX1 does not make that information available.</p>
|
||||||
*
|
*
|
||||||
* <p>This adapter does not test for duplicate Namespace-qualified
|
* <p>This adapter does not test for duplicate Namespace-qualified
|
||||||
|
@ -38,27 +38,27 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_XMLReader
|
* @see XMLReader
|
||||||
* @see basic_Parser
|
* @see Parser
|
||||||
*/
|
*/
|
||||||
template<class string_type, class string_adaptor_type>
|
template<class string_type, class string_adaptor_type>
|
||||||
class basic_ParserAdaptor : public basic_XMLReader<string_type>,
|
class ParserAdaptor : public XMLReaderInterface<string_type>,
|
||||||
public basic_DocumentHandler<string_type>
|
public DocumentHandler<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef string_adaptor_type string_adaptorT;
|
typedef string_adaptor_type string_adaptorT;
|
||||||
typedef basic_Parser<stringT> ParserT;
|
typedef Parser<stringT> ParserT;
|
||||||
typedef basic_EntityResolver<stringT> EntityResolverT;
|
typedef EntityResolver<stringT> EntityResolverT;
|
||||||
typedef basic_DTDHandler<stringT> DTDHandlerT;
|
typedef DTDHandler<stringT> DTDHandlerT;
|
||||||
typedef basic_DocumentHandler<stringT> DocumentHandlerT;
|
typedef DocumentHandler<stringT> DocumentHandlerT;
|
||||||
typedef basic_ContentHandler<stringT> ContentHandlerT;
|
typedef ContentHandler<stringT> ContentHandlerT;
|
||||||
typedef basic_InputSource<stringT> InputSourceT;
|
typedef InputSource<stringT> InputSourceT;
|
||||||
typedef basic_Locator<stringT> LocatorT;
|
typedef Locator<stringT> LocatorT;
|
||||||
typedef basic_SAXParseException<stringT> SAXParseExceptionT;
|
typedef SAXParseException<stringT> SAXParseExceptionT;
|
||||||
typedef basic_AttributeList<stringT> AttributeListT;
|
typedef AttributeList<stringT> AttributeListT;
|
||||||
|
|
||||||
basic_ParserAdaptor(ParserT& parser) :
|
ParserAdaptor(ParserT& parser) :
|
||||||
parser_(parser),
|
parser_(parser),
|
||||||
parsing_(false),
|
parsing_(false),
|
||||||
locator_(0),
|
locator_(0),
|
||||||
|
@ -85,7 +85,7 @@ public:
|
||||||
* name is not known.
|
* name is not known.
|
||||||
* @exception SAXNotSupportedException If the feature
|
* @exception SAXNotSupportedException If the feature
|
||||||
* state is not supported.
|
* state is not supported.
|
||||||
* @see basic_XMLReader#setFeature
|
* @see XMLReader#setFeature
|
||||||
*/
|
*/
|
||||||
virtual void setFeature(const stringT& name, bool value)
|
virtual void setFeature(const stringT& name, bool value)
|
||||||
{
|
{
|
||||||
|
@ -127,7 +127,7 @@ public:
|
||||||
* name is not known.
|
* name is not known.
|
||||||
* @exception SAXNotSupportedException If querying the
|
* @exception SAXNotSupportedException If querying the
|
||||||
* feature state is not supported.
|
* feature state is not supported.
|
||||||
* @see basic_XMLReader#setFeature
|
* @see XMLReader#setFeature
|
||||||
*/
|
*/
|
||||||
virtual bool getFeature(const stringT& name) const
|
virtual bool getFeature(const stringT& name) const
|
||||||
{
|
{
|
||||||
|
@ -167,14 +167,14 @@ public:
|
||||||
* Set the entity resolver.
|
* Set the entity resolver.
|
||||||
*
|
*
|
||||||
* @param resolver The new entity resolver.
|
* @param resolver The new entity resolver.
|
||||||
* @see basic_XMLReader#setEntityResolver
|
* @see XMLReader#setEntityResolver
|
||||||
*/
|
*/
|
||||||
virtual void setEntityResolver(EntityResolverT& resolver) { entityResolver_ = &resolver; }
|
virtual void setEntityResolver(EntityResolverT& resolver) { entityResolver_ = &resolver; }
|
||||||
/**
|
/**
|
||||||
* Return the current entity resolver.
|
* Return the current entity resolver.
|
||||||
*
|
*
|
||||||
* @return The current entity resolver, or null if none was supplied.
|
* @return The current entity resolver, or null if none was supplied.
|
||||||
* @see basic_XMLReader#getEntityResolver
|
* @see XMLReader#getEntityResolver
|
||||||
*/
|
*/
|
||||||
virtual EntityResolverT* getEntityResolver() const { return entityResolver_; }
|
virtual EntityResolverT* getEntityResolver() const { return entityResolver_; }
|
||||||
|
|
||||||
|
@ -182,14 +182,14 @@ public:
|
||||||
* Set the DTD handler.
|
* Set the DTD handler.
|
||||||
*
|
*
|
||||||
* @param handler The new DTD handler.
|
* @param handler The new DTD handler.
|
||||||
* @see basic_XMLReader#setEntityResolver
|
* @see XMLReader#setEntityResolver
|
||||||
*/
|
*/
|
||||||
virtual void setDTDHandler(DTDHandlerT& handler) { dtdHandler_ = &handler; }
|
virtual void setDTDHandler(DTDHandlerT& handler) { dtdHandler_ = &handler; }
|
||||||
/**
|
/**
|
||||||
* Return the current DTD handler.
|
* Return the current DTD handler.
|
||||||
*
|
*
|
||||||
* @return The current DTD handler, or null if none was supplied.
|
* @return The current DTD handler, or null if none was supplied.
|
||||||
* @see basic_XMLReader#getEntityResolver
|
* @see XMLReader#getEntityResolver
|
||||||
*/
|
*/
|
||||||
virtual DTDHandlerT* getDTDHandler() const { return dtdHandler_; }
|
virtual DTDHandlerT* getDTDHandler() const { return dtdHandler_; }
|
||||||
|
|
||||||
|
@ -197,14 +197,14 @@ public:
|
||||||
* Set the content handler.
|
* Set the content handler.
|
||||||
*
|
*
|
||||||
* @param handler The new content handler.
|
* @param handler The new content handler.
|
||||||
* @see basic_XMLReader#setEntityResolver
|
* @see XMLReader#setEntityResolver
|
||||||
*/
|
*/
|
||||||
virtual void setContentHandler(ContentHandlerT& handler) { contentHandler_ = &handler; }
|
virtual void setContentHandler(ContentHandlerT& handler) { contentHandler_ = &handler; }
|
||||||
/**
|
/**
|
||||||
* Return the current content handler.
|
* Return the current content handler.
|
||||||
*
|
*
|
||||||
* @return The current content handler, or null if none was supplied.
|
* @return The current content handler, or null if none was supplied.
|
||||||
* @see basic_XMLReader#getEntityResolver
|
* @see XMLReader#getEntityResolver
|
||||||
*/
|
*/
|
||||||
virtual ContentHandlerT* getContentHandler() const { return contentHandler_; }
|
virtual ContentHandlerT* getContentHandler() const { return contentHandler_; }
|
||||||
|
|
||||||
|
@ -212,14 +212,14 @@ public:
|
||||||
* Set the error handler.
|
* Set the error handler.
|
||||||
*
|
*
|
||||||
* @param handler The new error handler.
|
* @param handler The new error handler.
|
||||||
* @see basic_XMLReader#setEntityResolver
|
* @see XMLReader#setEntityResolver
|
||||||
*/
|
*/
|
||||||
virtual void setErrorHandler(ErrorHandler& handler) { errorHandler_ = &handler; }
|
virtual void setErrorHandler(ErrorHandler& handler) { errorHandler_ = &handler; }
|
||||||
/**
|
/**
|
||||||
* Return the current error handler.
|
* Return the current error handler.
|
||||||
*
|
*
|
||||||
* @return The current error handler, or null if none was supplied.
|
* @return The current error handler, or null if none was supplied.
|
||||||
* @see basic_XMLReader#getEntityResolver
|
* @see XMLReader#getEntityResolver
|
||||||
*/
|
*/
|
||||||
virtual ErrorHandler* getErrorHandler() const { return errorHandler_; }
|
virtual ErrorHandler* getErrorHandler() const { return errorHandler_; }
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ public:
|
||||||
* Parse an XML document.
|
* Parse an XML document.
|
||||||
*
|
*
|
||||||
* @param input An input source for the document.
|
* @param input An input source for the document.
|
||||||
* @see basic_Parser#parse(InputSource&)
|
* @see Parser#parse(InputSource&)
|
||||||
*/
|
*/
|
||||||
virtual void parse(InputSourceT& input)
|
virtual void parse(InputSourceT& input)
|
||||||
{
|
{
|
||||||
|
@ -253,7 +253,7 @@ public:
|
||||||
* Adapt a SAX1 document locator event.
|
* Adapt a SAX1 document locator event.
|
||||||
*
|
*
|
||||||
* @param locator A document locator.
|
* @param locator A document locator.
|
||||||
* @see basic_ContentHandler#setDocumentLocator
|
* @see ContentHandler#setDocumentLocator
|
||||||
*/
|
*/
|
||||||
virtual void setDocumentLocator(const LocatorT& locator)
|
virtual void setDocumentLocator(const LocatorT& locator)
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Adapt a SAX1 start document event.
|
* Adapt a SAX1 start document event.
|
||||||
*
|
*
|
||||||
* @see basic_DocumentHandler#startDocument
|
* @see DocumentHandler#startDocument
|
||||||
*/
|
*/
|
||||||
virtual void startDocument()
|
virtual void startDocument()
|
||||||
{
|
{
|
||||||
|
@ -276,7 +276,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Adapt a SAX1 end document event.
|
* Adapt a SAX1 end document event.
|
||||||
*
|
*
|
||||||
* @see basic_DocumentHandler#endDocument
|
* @see DocumentHandler#endDocument
|
||||||
*/
|
*/
|
||||||
virtual void endDocument()
|
virtual void endDocument()
|
||||||
{
|
{
|
||||||
|
@ -369,7 +369,7 @@ public:
|
||||||
* Adapt a SAX1 end element event.
|
* Adapt a SAX1 end element event.
|
||||||
*
|
*
|
||||||
* @param qName The qualified (prefixed) name.
|
* @param qName The qualified (prefixed) name.
|
||||||
* @see basic_DocumentHandler#endElement
|
* @see DocumentHandler#endElement
|
||||||
*/
|
*/
|
||||||
void endElement(const stringT& qName)
|
void endElement(const stringT& qName)
|
||||||
{
|
{
|
||||||
|
@ -395,7 +395,7 @@ public:
|
||||||
* Adapt a SAX1 characters event.
|
* Adapt a SAX1 characters event.
|
||||||
*
|
*
|
||||||
* @param ch The characters.
|
* @param ch The characters.
|
||||||
* @see basic_DocumentHandler#characters
|
* @see DocumentHandler#characters
|
||||||
*/
|
*/
|
||||||
virtual void characters(const stringT& ch)
|
virtual void characters(const stringT& ch)
|
||||||
{
|
{
|
||||||
|
@ -407,7 +407,7 @@ public:
|
||||||
* Adapt a SAX1 ignorable whitespace event.
|
* Adapt a SAX1 ignorable whitespace event.
|
||||||
*
|
*
|
||||||
* @param ch Thecharacters.
|
* @param ch Thecharacters.
|
||||||
* @see basic_DocumentHandler#ignorableWhitespace
|
* @see DocumentHandler#ignorableWhitespace
|
||||||
*/
|
*/
|
||||||
virtual void ignorableWhitespace(const stringT& ch)
|
virtual void ignorableWhitespace(const stringT& ch)
|
||||||
{
|
{
|
||||||
|
@ -420,7 +420,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param target The processing instruction target.
|
* @param target The processing instruction target.
|
||||||
* @param data The remainder of the processing instruction
|
* @param data The remainder of the processing instruction
|
||||||
* @see basic_DocumentHandler#processingInstruction
|
* @see DocumentHandler#processingInstruction
|
||||||
*/
|
*/
|
||||||
virtual void processingInstruction(const stringT& target, const stringT& data)
|
virtual void processingInstruction(const stringT& target, const stringT& data)
|
||||||
{
|
{
|
||||||
|
@ -429,8 +429,8 @@ public:
|
||||||
} // processingInstruction
|
} // processingInstruction
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef basic_NamespaceSupport<stringT, string_adaptorT> NamespaceSupportT;
|
typedef NamespaceSupport<stringT, string_adaptorT> NamespaceSupportT;
|
||||||
typedef basic_AttributesImpl<stringT> AttributesImplT;
|
typedef AttributesImpl<stringT> AttributesImplT;
|
||||||
|
|
||||||
void setupParser()
|
void setupParser()
|
||||||
{
|
{
|
||||||
|
@ -477,11 +477,11 @@ private:
|
||||||
} // makeString
|
} // makeString
|
||||||
|
|
||||||
// This wrapper is used only when Namespace support is disabled.
|
// This wrapper is used only when Namespace support is disabled.
|
||||||
class AttributesListAdaptor : public basic_Attributes<stringT>
|
class AttributesListAdaptor : public Attributes<stringT>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef typename basic_ParserAdaptor<stringT, string_adaptorT> ParserAdaptorT;
|
typedef typename ParserAdaptor<stringT, string_adaptorT> ParserAdaptorT;
|
||||||
typedef typename basic_AttributeList<stringT> AttributeListT;
|
typedef typename AttributeList<stringT> AttributeListT;
|
||||||
|
|
||||||
void setAttributeList(const AttributeListT& attList)
|
void setAttributeList(const AttributeListT& attList)
|
||||||
{
|
{
|
||||||
|
@ -538,17 +538,12 @@ public:
|
||||||
const stringT NULL_STRING;
|
const stringT NULL_STRING;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
basic_ParserAdaptor();
|
ParserAdaptor();
|
||||||
basic_ParserAdaptor(const basic_ParserAdaptor&);
|
ParserAdaptor(const ParserAdaptor&);
|
||||||
basic_ParserAdaptor& operator=(const basic_ParserAdaptor&);
|
ParserAdaptor& operator=(const ParserAdaptor&);
|
||||||
bool operator==(const basic_ParserAdaptor&);
|
bool operator==(const ParserAdaptor&);
|
||||||
}; // ParserAdaptor
|
}; // ParserAdaptor
|
||||||
|
|
||||||
typedef basic_ParserAdaptor<std::string, char> ParserAdaptor;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_ParserAdaptor<std::wstring, wchar_t> wParserAdaptor;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
||||||
|
|
|
@ -48,15 +48,15 @@ struct XMLBaseConstants
|
||||||
}; // struct XMLBaseConstants
|
}; // struct XMLBaseConstants
|
||||||
|
|
||||||
template<class string_type, class string_adaptor_type = Arabica::default_string_adaptor<string_type> >
|
template<class string_type, class string_adaptor_type = Arabica::default_string_adaptor<string_type> >
|
||||||
class basic_XMLBaseSupport
|
class XMLBaseSupport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef string_adaptor_type string_adaptorT;
|
typedef string_adaptor_type string_adaptorT;
|
||||||
typedef typename string_adaptor_type::value_type valueT;
|
typedef typename string_adaptor_type::value_type valueT;
|
||||||
typedef basic_Attributes<stringT> AttributesT;
|
typedef Attributes<stringT> AttributesT;
|
||||||
|
|
||||||
basic_XMLBaseSupport() :
|
XMLBaseSupport() :
|
||||||
depth_(0) { }
|
depth_(0) { }
|
||||||
|
|
||||||
void setDocumentLocation(const stringT& loc)
|
void setDocumentLocation(const stringT& loc)
|
||||||
|
@ -118,15 +118,10 @@ private:
|
||||||
const XMLBaseConstants<stringT, string_adaptorT> xbc_;
|
const XMLBaseConstants<stringT, string_adaptorT> xbc_;
|
||||||
|
|
||||||
// no impl
|
// no impl
|
||||||
basic_XMLBaseSupport(const basic_XMLBaseSupport&);
|
XMLBaseSupport(const XMLBaseSupport&);
|
||||||
basic_XMLBaseSupport& operator=(const basic_XMLBaseSupport&);
|
XMLBaseSupport& operator=(const XMLBaseSupport&);
|
||||||
bool operator==(const basic_XMLBaseSupport&);
|
bool operator==(const XMLBaseSupport&);
|
||||||
}; // class basic_XMLBaseSupport
|
}; // class XMLBaseSupport
|
||||||
|
|
||||||
typedef basic_XMLBaseSupport<std::string> XMLBaseSupport;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_XMLBaseSupport<std::wstring> wXMLBaseSupport;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace SAX
|
||||||
/**
|
/**
|
||||||
* Base class for deriving an XML filter.
|
* Base class for deriving an XML filter.
|
||||||
*
|
*
|
||||||
* <p>This class is designed to sit between an {@link basic_XMLReader
|
* <p>This class is designed to sit between an {@link XMLReader
|
||||||
* XMLReader} and the client application's event handlers. By default, it
|
* XMLReader} and the client application's event handlers. By default, it
|
||||||
* does nothing but pass requests up to the reader and events
|
* does nothing but pass requests up to the reader and events
|
||||||
* on to the handlers unmodified, but subclasses can override
|
* on to the handlers unmodified, but subclasses can override
|
||||||
|
@ -29,56 +29,56 @@ namespace SAX
|
||||||
* @author Jez Higgins,
|
* @author Jez Higgins,
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version 2.0
|
* @version 2.0
|
||||||
* @see basic_XMLFilter
|
* @see XMLFilter
|
||||||
* @see basic_XMLReader
|
* @see XMLReader
|
||||||
* @see basic_EntityResolver
|
* @see EntityResolver
|
||||||
* @see basic_DTDHandler
|
* @see DTDHandler
|
||||||
* @see basic_ContentHandler
|
* @see ContentHandler
|
||||||
* @see basic_ErrorHandler
|
* @see ErrorHandler
|
||||||
*/
|
*/
|
||||||
template<class string_type, class string_adaptor_type = Arabica::default_string_adaptor<string_type> >
|
template<class string_type, class string_adaptor_type = Arabica::default_string_adaptor<string_type> >
|
||||||
class basic_XMLFilterImpl : public basic_XMLFilter<string_type>,
|
class XMLFilterImpl : public XMLFilter<string_type>,
|
||||||
public basic_EntityResolver<string_type>,
|
public EntityResolver<string_type>,
|
||||||
public basic_DTDHandler<string_type>,
|
public DTDHandler<string_type>,
|
||||||
public basic_ContentHandler<string_type>,
|
public ContentHandler<string_type>,
|
||||||
public basic_ErrorHandler<string_type>,
|
public ErrorHandler<string_type>,
|
||||||
public basic_DeclHandler<string_type>,
|
public DeclHandler<string_type>,
|
||||||
public basic_LexicalHandler<string_type>
|
public LexicalHandler<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
typedef string_adaptor_type string_adaptorT;
|
typedef string_adaptor_type string_adaptorT;
|
||||||
typedef basic_XMLReader<stringT> XMLReaderT;
|
typedef XMLReaderInterface<stringT> XMLReaderT;
|
||||||
typedef basic_EntityResolver<stringT> EntityResolverT;
|
typedef EntityResolver<stringT> EntityResolverT;
|
||||||
typedef basic_DTDHandler<stringT> DTDHandlerT;
|
typedef DTDHandler<stringT> DTDHandlerT;
|
||||||
typedef basic_ContentHandler<stringT> ContentHandlerT;
|
typedef ContentHandler<stringT> ContentHandlerT;
|
||||||
typedef basic_InputSource<stringT> InputSourceT;
|
typedef InputSource<stringT> InputSourceT;
|
||||||
typedef basic_Locator<stringT> LocatorT;
|
typedef Locator<stringT> LocatorT;
|
||||||
typedef basic_ErrorHandler<stringT> ErrorHandlerT;
|
typedef ErrorHandler<stringT> ErrorHandlerT;
|
||||||
typedef basic_DeclHandler<stringT> DeclHandlerT;
|
typedef DeclHandler<stringT> DeclHandlerT;
|
||||||
typedef basic_LexicalHandler<stringT> LexicalHandlerT;
|
typedef LexicalHandler<stringT> LexicalHandlerT;
|
||||||
typedef typename basic_ErrorHandler<stringT>::SAXParseExceptionT SAXParseExceptionT;
|
typedef typename ErrorHandler<stringT>::SAXParseExceptionT SAXParseExceptionT;
|
||||||
|
|
||||||
|
|
||||||
basic_XMLFilterImpl() :
|
XMLFilterImpl() :
|
||||||
parent_(0)
|
parent_(0)
|
||||||
{
|
{
|
||||||
setDefaults();
|
setDefaults();
|
||||||
} // basic_XMLFilterImpl
|
} // XMLFilterImpl
|
||||||
basic_XMLFilterImpl(XMLReaderT& parent) :
|
XMLFilterImpl(XMLReaderT& parent) :
|
||||||
parent_(&parent)
|
parent_(&parent)
|
||||||
{
|
{
|
||||||
setDefaults();
|
setDefaults();
|
||||||
} // basic_XMLFilterImpl
|
} // XMLFilterImpl
|
||||||
|
|
||||||
virtual ~basic_XMLFilterImpl() { }
|
virtual ~XMLFilterImpl() { }
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
// XMLFilter implementation
|
// XMLFilter implementation
|
||||||
/**
|
/**
|
||||||
* Set the parent reader.
|
* Set the parent reader.
|
||||||
*
|
*
|
||||||
* <p>This is the {@link basic_XMLReader XMLReader} from which
|
* <p>This is the {@link XMLReader XMLReader} from which
|
||||||
* this filter will obtain its events and to which it will pass its
|
* this filter will obtain its events and to which it will pass its
|
||||||
* configuration requests. The parent may itself be another filter.</p>
|
* configuration requests. The parent may itself be another filter.</p>
|
||||||
*
|
*
|
||||||
|
@ -111,7 +111,7 @@ public:
|
||||||
* @exception SAXNotSupportedException When the
|
* @exception SAXNotSupportedException When the
|
||||||
* XMLReader recognizes the feature name but
|
* XMLReader recognizes the feature name but
|
||||||
* cannot set the requested value.
|
* cannot set the requested value.
|
||||||
* @see basic_XMLReader#setFeature
|
* @see XMLReader#setFeature
|
||||||
*/
|
*/
|
||||||
virtual void setFeature(const stringT& name, bool value)
|
virtual void setFeature(const stringT& name, bool value)
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,7 @@ public:
|
||||||
* @exception SAXNotSupportedException When the
|
* @exception SAXNotSupportedException When the
|
||||||
* XMLReader recognizes the feature name but
|
* XMLReader recognizes the feature name but
|
||||||
* cannot determine its state at this time.
|
* cannot determine its state at this time.
|
||||||
* @see basic_XMLReader#getFeature
|
* @see XMLReader#getFeature
|
||||||
*/
|
*/
|
||||||
virtual bool getFeature(const stringT& name) const
|
virtual bool getFeature(const stringT& name) const
|
||||||
{
|
{
|
||||||
|
@ -154,56 +154,56 @@ public:
|
||||||
* Set the entity resolver.
|
* Set the entity resolver.
|
||||||
*
|
*
|
||||||
* @param resolver The new entity resolver.
|
* @param resolver The new entity resolver.
|
||||||
* @see basic_XMLReader#setEntityResolver
|
* @see XMLReader#setEntityResolver
|
||||||
*/
|
*/
|
||||||
virtual void setEntityResolver(EntityResolverT& resolver) { entityResolver_ = &resolver; }
|
virtual void setEntityResolver(EntityResolverT& resolver) { entityResolver_ = &resolver; }
|
||||||
/**
|
/**
|
||||||
* Get the current entity resolver.
|
* Get the current entity resolver.
|
||||||
*
|
*
|
||||||
* @return The current entity resolver, or null if none was set.
|
* @return The current entity resolver, or null if none was set.
|
||||||
* @see basic_XMLReader#getEntityResolver
|
* @see XMLReader#getEntityResolver
|
||||||
*/
|
*/
|
||||||
virtual EntityResolverT* getEntityResolver() const { return entityResolver_ ; }
|
virtual EntityResolverT* getEntityResolver() const { return entityResolver_ ; }
|
||||||
/**
|
/**
|
||||||
* Set the DTD event handler.
|
* Set the DTD event handler.
|
||||||
*
|
*
|
||||||
* @param handler The new DTD handler.
|
* @param handler The new DTD handler.
|
||||||
* @see basic_XMLReader#setDTDHandler
|
* @see XMLReader#setDTDHandler
|
||||||
*/
|
*/
|
||||||
virtual void setDTDHandler(DTDHandlerT& handler) { dtdHandler_ = &handler; }
|
virtual void setDTDHandler(DTDHandlerT& handler) { dtdHandler_ = &handler; }
|
||||||
/**
|
/**
|
||||||
* Get the current DTD event handler.
|
* Get the current DTD event handler.
|
||||||
*
|
*
|
||||||
* @return The current DTD handler, or null if none was set.
|
* @return The current DTD handler, or null if none was set.
|
||||||
* @see basic_XMLReader#getDTDHandler
|
* @see XMLReader#getDTDHandler
|
||||||
*/
|
*/
|
||||||
virtual DTDHandlerT* getDTDHandler() const { return dtdHandler_; }
|
virtual DTDHandlerT* getDTDHandler() const { return dtdHandler_; }
|
||||||
/**
|
/**
|
||||||
* Set the content event handler.
|
* Set the content event handler.
|
||||||
*
|
*
|
||||||
* @param handler The new content handler.
|
* @param handler The new content handler.
|
||||||
* @see basic_XMLReader#setContentHandler
|
* @see XMLReader#setContentHandler
|
||||||
*/
|
*/
|
||||||
virtual void setContentHandler(ContentHandlerT& handler) { contentHandler_ = &handler; }
|
virtual void setContentHandler(ContentHandlerT& handler) { contentHandler_ = &handler; }
|
||||||
/**
|
/**
|
||||||
* Get the content event handler.
|
* Get the content event handler.
|
||||||
*
|
*
|
||||||
* @return The current content handler, or null if none was set.
|
* @return The current content handler, or null if none was set.
|
||||||
* @see basic_XMLReader#getContentHandler
|
* @see XMLReader#getContentHandler
|
||||||
*/
|
*/
|
||||||
virtual ContentHandlerT* getContentHandler() const { return contentHandler_; }
|
virtual ContentHandlerT* getContentHandler() const { return contentHandler_; }
|
||||||
/**
|
/**
|
||||||
* Set the error event handler.
|
* Set the error event handler.
|
||||||
*
|
*
|
||||||
* @param handler The new error handler.
|
* @param handler The new error handler.
|
||||||
* @see basic_XMLReader#setErrorHandler
|
* @see XMLReader#setErrorHandler
|
||||||
*/
|
*/
|
||||||
virtual void setErrorHandler(ErrorHandlerT& handler) { errorHandler_ = &handler; }
|
virtual void setErrorHandler(ErrorHandlerT& handler) { errorHandler_ = &handler; }
|
||||||
/**
|
/**
|
||||||
* Get the current error event handler.
|
* Get the current error event handler.
|
||||||
*
|
*
|
||||||
* @return The current error handler, or null if none was set.
|
* @return The current error handler, or null if none was set.
|
||||||
* @see basic_XMLReader#getErrorHandler
|
* @see XMLReader#getErrorHandler
|
||||||
*/
|
*/
|
||||||
virtual ErrorHandlerT* getErrorHandler() const { return errorHandler_; }
|
virtual ErrorHandlerT* getErrorHandler() const { return errorHandler_; }
|
||||||
|
|
||||||
|
@ -216,7 +216,7 @@ public:
|
||||||
* Parse a document.
|
* Parse a document.
|
||||||
*
|
*
|
||||||
* @param input The input source for the document entity.
|
* @param input The input source for the document entity.
|
||||||
* @see basic_XMLReader#parse(basic_InputSource)
|
* @see XMLReader#parse(InputSource)
|
||||||
*/
|
*/
|
||||||
virtual void parse(InputSourceT& input)
|
virtual void parse(InputSourceT& input)
|
||||||
{
|
{
|
||||||
|
@ -257,7 +257,7 @@ public:
|
||||||
* @param systemId The entity's system identifier.
|
* @param systemId The entity's system identifier.
|
||||||
* @return A new InputSource or a default-constructed
|
* @return A new InputSource or a default-constructed
|
||||||
* <code>InputSourceT</code> for the default.
|
* <code>InputSourceT</code> for the default.
|
||||||
* @see basic_EntityResolver#resolveEntity
|
* @see EntityResolver#resolveEntity
|
||||||
*/
|
*/
|
||||||
virtual InputSourceT resolveEntity(const stringT& publicId, const stringT& systemId)
|
virtual InputSourceT resolveEntity(const stringT& publicId, const stringT& systemId)
|
||||||
{
|
{
|
||||||
|
@ -274,7 +274,7 @@ public:
|
||||||
* @param name The notation name.
|
* @param name The notation name.
|
||||||
* @param publicId The notation's public identifier, or an empty string.
|
* @param publicId The notation's public identifier, or an empty string.
|
||||||
* @param systemId The notation's system identifier, or an empty string.
|
* @param systemId The notation's system identifier, or an empty string.
|
||||||
* @see basic_DTDHandler#notationDecl
|
* @see DTDHandler#notationDecl
|
||||||
*/
|
*/
|
||||||
virtual void notationDecl(const stringT& name,
|
virtual void notationDecl(const stringT& name,
|
||||||
const stringT& publicId,
|
const stringT& publicId,
|
||||||
|
@ -290,7 +290,7 @@ public:
|
||||||
* @param publicId The entity's public identifier, or an empty string.
|
* @param publicId The entity's public identifier, or an empty string.
|
||||||
* @param systemId The entity's system identifier, or an empty string.
|
* @param systemId The entity's system identifier, or an empty string.
|
||||||
* @param notationName The name of the associated notation.
|
* @param notationName The name of the associated notation.
|
||||||
* @see basic_DTDHandler#unparsedEntityDecl
|
* @see DTDHandler#unparsedEntityDecl
|
||||||
*/
|
*/
|
||||||
virtual void unparsedEntityDecl(const stringT& name,
|
virtual void unparsedEntityDecl(const stringT& name,
|
||||||
const stringT& publicId,
|
const stringT& publicId,
|
||||||
|
@ -306,7 +306,7 @@ public:
|
||||||
* Filter a new document locator event.
|
* Filter a new document locator event.
|
||||||
*
|
*
|
||||||
* @param locator The document locator.
|
* @param locator The document locator.
|
||||||
* @see basic_ContentHandler#setDocumentLocator
|
* @see ContentHandler#setDocumentLocator
|
||||||
*/
|
*/
|
||||||
virtual void setDocumentLocator(const LocatorT& locator)
|
virtual void setDocumentLocator(const LocatorT& locator)
|
||||||
{
|
{
|
||||||
|
@ -316,7 +316,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Filter a start document event.
|
* Filter a start document event.
|
||||||
*
|
*
|
||||||
* @see basic_ContentHandler#startDocument
|
* @see ContentHandler#startDocument
|
||||||
*/
|
*/
|
||||||
virtual void startDocument()
|
virtual void startDocument()
|
||||||
{
|
{
|
||||||
|
@ -326,7 +326,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Filter an end document event.
|
* Filter an end document event.
|
||||||
*
|
*
|
||||||
* @see basic_ContentHandler#endDocument
|
* @see ContentHandler#endDocument
|
||||||
*/
|
*/
|
||||||
virtual void endDocument()
|
virtual void endDocument()
|
||||||
{
|
{
|
||||||
|
@ -338,7 +338,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param prefix The Namespace prefix.
|
* @param prefix The Namespace prefix.
|
||||||
* @param uri The Namespace URI.
|
* @param uri The Namespace URI.
|
||||||
* @see basic_ContentHandler#startPrefixMapping
|
* @see ContentHandler#startPrefixMapping
|
||||||
*/
|
*/
|
||||||
virtual void startPrefixMapping(const stringT& prefix, const stringT& uri)
|
virtual void startPrefixMapping(const stringT& prefix, const stringT& uri)
|
||||||
{
|
{
|
||||||
|
@ -349,7 +349,7 @@ public:
|
||||||
* Filter an end Namespace prefix mapping event.
|
* Filter an end Namespace prefix mapping event.
|
||||||
*
|
*
|
||||||
* @param prefix The Namespace prefix.
|
* @param prefix The Namespace prefix.
|
||||||
* @see basic_ContentHandler#endPrefixMapping
|
* @see ContentHandler#endPrefixMapping
|
||||||
*/
|
*/
|
||||||
virtual void endPrefixMapping(const stringT& prefix)
|
virtual void endPrefixMapping(const stringT& prefix)
|
||||||
{
|
{
|
||||||
|
@ -364,7 +364,7 @@ public:
|
||||||
* @param qName The element's qualified (prefixed) name, or the empty
|
* @param qName The element's qualified (prefixed) name, or the empty
|
||||||
* string.
|
* string.
|
||||||
* @param atts The element's attributes.
|
* @param atts The element's attributes.
|
||||||
* @see basic_ContentHandler#startElement
|
* @see ContentHandler#startElement
|
||||||
*/
|
*/
|
||||||
virtual void startElement(const stringT& namespaceURI, const stringT& localName,
|
virtual void startElement(const stringT& namespaceURI, const stringT& localName,
|
||||||
const stringT& qName, const typename ContentHandlerT::AttributesT& atts)
|
const stringT& qName, const typename ContentHandlerT::AttributesT& atts)
|
||||||
|
@ -379,7 +379,7 @@ public:
|
||||||
* @param localName The element's local name, or the empty string.
|
* @param localName The element's local name, or the empty string.
|
||||||
* @param qName The element's qualified (prefixed) name, or the empty
|
* @param qName The element's qualified (prefixed) name, or the empty
|
||||||
* string.
|
* string.
|
||||||
* @see basic_ContentHandler#endElement
|
* @see ContentHandler#endElement
|
||||||
*/
|
*/
|
||||||
virtual void endElement(const stringT& namespaceURI, const stringT& localName,
|
virtual void endElement(const stringT& namespaceURI, const stringT& localName,
|
||||||
const stringT& qName)
|
const stringT& qName)
|
||||||
|
@ -391,7 +391,7 @@ public:
|
||||||
* Filter a character data event.
|
* Filter a character data event.
|
||||||
*
|
*
|
||||||
* @param ch The characters.
|
* @param ch The characters.
|
||||||
* @see basic_ContentHandler#characters
|
* @see ContentHandler#characters
|
||||||
*/
|
*/
|
||||||
virtual void characters(const stringT& ch)
|
virtual void characters(const stringT& ch)
|
||||||
{
|
{
|
||||||
|
@ -402,7 +402,7 @@ public:
|
||||||
* Filter an ignorable whitespace event.
|
* Filter an ignorable whitespace event.
|
||||||
*
|
*
|
||||||
* @param ch The whitespace
|
* @param ch The whitespace
|
||||||
* @see basic_ContentHandler#ignorableWhitespace
|
* @see ContentHandler#ignorableWhitespace
|
||||||
*/
|
*/
|
||||||
virtual void ignorableWhitespace(const stringT& ch)
|
virtual void ignorableWhitespace(const stringT& ch)
|
||||||
{
|
{
|
||||||
|
@ -414,7 +414,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param target The processing instruction target.
|
* @param target The processing instruction target.
|
||||||
* @param data The text following the target.
|
* @param data The text following the target.
|
||||||
* @see basic_ContentHandler#processingInstruction
|
* @see ContentHandler#processingInstruction
|
||||||
*/
|
*/
|
||||||
virtual void processingInstruction(const stringT& target, const stringT& data)
|
virtual void processingInstruction(const stringT& target, const stringT& data)
|
||||||
{
|
{
|
||||||
|
@ -425,7 +425,7 @@ public:
|
||||||
* Filter a skipped entity event.
|
* Filter a skipped entity event.
|
||||||
*
|
*
|
||||||
* @param name The name of the skipped entity.
|
* @param name The name of the skipped entity.
|
||||||
* @see basic_ContentHandler#skippedEntity
|
* @see ContentHandler#skippedEntity
|
||||||
*/
|
*/
|
||||||
virtual void skippedEntity(const stringT& name)
|
virtual void skippedEntity(const stringT& name)
|
||||||
{
|
{
|
||||||
|
@ -438,7 +438,7 @@ public:
|
||||||
* Filter a warning event.
|
* Filter a warning event.
|
||||||
*
|
*
|
||||||
* @param exception The warning as an exception.
|
* @param exception The warning as an exception.
|
||||||
* @see basic_ErrorHandler#warning
|
* @see ErrorHandler#warning
|
||||||
*/
|
*/
|
||||||
virtual void warning(const SAXParseExceptionT& exception)
|
virtual void warning(const SAXParseExceptionT& exception)
|
||||||
{
|
{
|
||||||
|
@ -449,7 +449,7 @@ public:
|
||||||
* Filter an error event.
|
* Filter an error event.
|
||||||
*
|
*
|
||||||
* @param exception The error as an exception.
|
* @param exception The error as an exception.
|
||||||
* @see basic_ErrorHandler#error
|
* @see ErrorHandler#error
|
||||||
*/
|
*/
|
||||||
virtual void error(const SAXParseExceptionT& exception)
|
virtual void error(const SAXParseExceptionT& exception)
|
||||||
{
|
{
|
||||||
|
@ -460,7 +460,7 @@ public:
|
||||||
* Filter a fatal error event.
|
* Filter a fatal error event.
|
||||||
*
|
*
|
||||||
* @param exception The error as an exception.
|
* @param exception The error as an exception.
|
||||||
* @see basic_ErrorHandler#fatalError
|
* @see ErrorHandler#fatalError
|
||||||
*/
|
*/
|
||||||
virtual void fatalError(const SAXParseExceptionT& exception)
|
virtual void fatalError(const SAXParseExceptionT& exception)
|
||||||
{
|
{
|
||||||
|
@ -588,9 +588,9 @@ private:
|
||||||
parent_->setLexicalHandler(*this);
|
parent_->setLexicalHandler(*this);
|
||||||
} // setupParse
|
} // setupParse
|
||||||
|
|
||||||
basic_XMLFilterImpl(const basic_XMLFilterImpl&);
|
XMLFilterImpl(const XMLFilterImpl&);
|
||||||
basic_XMLFilterImpl& operator=(const basic_XMLFilterImpl&); // no impl
|
XMLFilterImpl& operator=(const XMLFilterImpl&); // no impl
|
||||||
bool operator==(const basic_XMLFilterImpl&); // no impl
|
bool operator==(const XMLFilterImpl&); // no impl
|
||||||
|
|
||||||
XMLReaderT* parent_;
|
XMLReaderT* parent_;
|
||||||
EntityResolverT* entityResolver_;
|
EntityResolverT* entityResolver_;
|
||||||
|
@ -599,13 +599,8 @@ private:
|
||||||
ErrorHandlerT* errorHandler_;
|
ErrorHandlerT* errorHandler_;
|
||||||
DeclHandlerT* declHandler_;
|
DeclHandlerT* declHandler_;
|
||||||
LexicalHandlerT* lexicalHandler_;
|
LexicalHandlerT* lexicalHandler_;
|
||||||
basic_DefaultHandler<stringT> defaultHandler_;
|
DefaultHandler<stringT> defaultHandler_;
|
||||||
}; // class basic_XMLFilter
|
}; // class XMLFilter
|
||||||
|
|
||||||
typedef basic_XMLFilterImpl<std::string> XMLFilterImpl;
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_XMLFilterImpl<std::wstring> wXMLFilterImpl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace SAX
|
||||||
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 Garden : public basic_XMLReader<string_type>
|
class Garden : public XMLReaderInterface<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef string_type stringT;
|
typedef string_type stringT;
|
||||||
|
@ -32,15 +32,15 @@ public:
|
||||||
Arabica::default_string_adaptor<string_type>,
|
Arabica::default_string_adaptor<string_type>,
|
||||||
T0,
|
T0,
|
||||||
T1>::type string_adaptor_type;
|
T1>::type string_adaptor_type;
|
||||||
typedef basic_EntityResolver<stringT> EntityResolverT;
|
typedef EntityResolver<stringT> EntityResolverT;
|
||||||
typedef basic_DTDHandler<stringT> DTDHandlerT;
|
typedef DTDHandler<stringT> DTDHandlerT;
|
||||||
typedef basic_ContentHandler<stringT> ContentHandlerT;
|
typedef ContentHandler<stringT> ContentHandlerT;
|
||||||
typedef basic_InputSource<stringT> InputSourceT;
|
typedef InputSource<stringT> InputSourceT;
|
||||||
typedef basic_AttributesImpl<stringT> AttributesImplT;
|
typedef AttributesImpl<stringT> AttributesImplT;
|
||||||
typedef basic_ErrorHandler<stringT> ErrorHandlerT;
|
typedef ErrorHandler<stringT> ErrorHandlerT;
|
||||||
typedef basic_DeclHandler<stringT> declHandlerT;
|
typedef DeclHandler<stringT> declHandlerT;
|
||||||
typedef basic_LexicalHandler<stringT> lexicalHandlerT;
|
typedef LexicalHandler<stringT> lexicalHandlerT;
|
||||||
typedef typename basic_XMLReader<stringT>::PropertyBase PropertyBase;
|
typedef typename XMLReaderInterface<stringT>::PropertyBase PropertyBase;
|
||||||
|
|
||||||
Garden();
|
Garden();
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ std::auto_ptr<typename Garden<string_type, T0, T1>::PropertyBase> Garden<string_
|
||||||
} // doGetProperty
|
} // doGetProperty
|
||||||
|
|
||||||
template<class string_type, class T0, class T1>
|
template<class string_type, class T0, class T1>
|
||||||
void Garden<string_type, T0, T1>::doSetProperty(const stringT& name, std::auto_ptr<typename basic_XMLReader<string_type>::PropertyBase> value)
|
void Garden<string_type, T0, T1>::doSetProperty(const stringT& name, std::auto_ptr<typename XMLReaderInterface<string_type>::PropertyBase> value)
|
||||||
{
|
{
|
||||||
throw SAXNotRecognizedException(string_adaptor_type::asStdString(name));
|
throw SAXNotRecognizedException(string_adaptor_type::asStdString(name));
|
||||||
} // doSetProperty
|
} // doSetProperty
|
||||||
|
@ -451,7 +451,7 @@ void Garden<string_type, T0, T1>::reportError(const std::string& message, bool f
|
||||||
if(!errorHandler_)
|
if(!errorHandler_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SAX::basic_SAXParseException<stringT> e(message);
|
SAX::SAXParseException<stringT> e(message);
|
||||||
|
|
||||||
if(fatal)
|
if(fatal)
|
||||||
errorHandler_->fatalError(e);
|
errorHandler_->fatalError(e);
|
||||||
|
|
|
@ -73,37 +73,15 @@ namespace Arabica
|
||||||
namespace SAX
|
namespace SAX
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class string_type> class basic_AttributeList;
|
template<class string_type> class AttributeList;
|
||||||
template<class string_type> class basic_DocumentHandler;
|
template<class string_type> class DocumentHandler;
|
||||||
template<class string_type> class basic_DTDHandler;
|
template<class string_type> class DTDHandler;
|
||||||
template<class string_type> class basic_EntityResolver;
|
template<class string_type> class EntityResolver;
|
||||||
template<class string_type> class basic_InputSource;
|
template<class string_type> class InputSource;
|
||||||
template<class string_type> class basic_Locator;
|
template<class string_type> class Locator;
|
||||||
template<class string_type> class basic_Parser;
|
template<class string_type> class Parser;
|
||||||
template<class string_type> class basic_SAXParseException;
|
template<class string_type> class SAXParseException;
|
||||||
template<class string_type> class basic_ErrorHandler;
|
template<class string_type> class ErrorHandler;
|
||||||
|
|
||||||
typedef basic_AttributeList<std::string> AttributeList;
|
|
||||||
typedef basic_DocumentHandler<std::string> DocumentHandler;
|
|
||||||
typedef basic_DTDHandler<std::string> DTDHandler;
|
|
||||||
typedef basic_EntityResolver<std::string> EntityResolver;
|
|
||||||
typedef basic_InputSource<std::string> InputSource;
|
|
||||||
typedef basic_Locator<std::string> Locator;
|
|
||||||
typedef basic_Parser<std::string> Parser;
|
|
||||||
typedef basic_SAXParseException<std::string> SAXParseException;
|
|
||||||
typedef basic_ErrorHandler<std::string> ErrorHandler;
|
|
||||||
|
|
||||||
#ifndef ARABICA_NO_WCHAR_T
|
|
||||||
typedef basic_AttributeList<std::wstring> wAttributeList;
|
|
||||||
typedef basic_DocumentHandler<std::wstring> wDocumentHandler;
|
|
||||||
typedef basic_DTDHandler<std::wstring> wDTDHandler;
|
|
||||||
typedef basic_EntityResolver<std::wstring> wEntityResolver;
|
|
||||||
typedef basic_InputSource<std::wstring> wInputSource;
|
|
||||||
typedef basic_Locator<std::wstring> wLocator;
|
|
||||||
typedef basic_Parser<std::wstring> wParser;
|
|
||||||
typedef basic_SAXParseException<std::wstring> wSAXParseException;
|
|
||||||
typedef basic_ErrorHandler<std::wstring> wErrorHandler;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // namespace SAX
|
} // namespace SAX
|
||||||
} // namespace Arabica
|
} // namespace Arabica
|
||||||
|
|
|
@ -150,7 +150,7 @@ private:
|
||||||
// so the SAX wrapper maps more or less directly to it.
|
// so the SAX wrapper maps more or less directly to it.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* expat_wrapper puts an {@link basic_XMLReader XMLReader} interface
|
* expat_wrapper puts an {@link XMLReader XMLReader} interface
|
||||||
* around <a href='http://www.libexpat.org/'>Expat</a>.
|
* around <a href='http://www.libexpat.org/'>Expat</a>.
|
||||||
* <p>
|
* <p>
|
||||||
* For general usage:<br>
|
* For general usage:<br>
|
||||||
|
@ -195,13 +195,13 @@ private:
|
||||||
* @author Jez Higgins
|
* @author Jez Higgins
|
||||||
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
* <a href="mailto:jez@jezuk.co.uk">jez@jezuk.co.uk</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @see SAX::basic_XMLReader
|
* @see SAX::XMLReader
|
||||||
*/
|
*/
|
||||||
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 expat_wrapper : public SAX::basic_XMLReader<string_type>,
|
class expat_wrapper : public SAX::XMLReaderInterface<string_type>,
|
||||||
public SAX::basic_Locator<string_type>,
|
public SAX::Locator<string_type>,
|
||||||
public expat_wrapper_impl_mumbojumbo::expat2base
|
public expat_wrapper_impl_mumbojumbo::expat2base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -212,17 +212,17 @@ class expat_wrapper : public SAX::basic_XMLReader<string_type>,
|
||||||
T1>::type string_adaptor_type;
|
T1>::type string_adaptor_type;
|
||||||
typedef string_adaptor_type string_adaptorT;
|
typedef string_adaptor_type string_adaptorT;
|
||||||
typedef string_adaptor_type SA;
|
typedef string_adaptor_type SA;
|
||||||
typedef SAX::basic_EntityResolver<stringT> entityResolverT;
|
typedef SAX::EntityResolver<stringT> entityResolverT;
|
||||||
typedef SAX::basic_DTDHandler<stringT> dtdHandlerT;
|
typedef SAX::DTDHandler<stringT> dtdHandlerT;
|
||||||
typedef SAX::basic_ContentHandler<stringT> contentHandlerT;
|
typedef SAX::ContentHandler<stringT> contentHandlerT;
|
||||||
typedef SAX::basic_DeclHandler<stringT> declHandlerT;
|
typedef SAX::DeclHandler<stringT> declHandlerT;
|
||||||
typedef SAX::basic_LexicalHandler<stringT> lexicalHandlerT;
|
typedef SAX::LexicalHandler<stringT> lexicalHandlerT;
|
||||||
typedef SAX::basic_InputSource<stringT> inputSourceT;
|
typedef SAX::InputSource<stringT> inputSourceT;
|
||||||
typedef SAX::basic_Locator<stringT> locatorT;
|
typedef SAX::Locator<stringT> locatorT;
|
||||||
typedef SAX::basic_NamespaceSupport<stringT, string_adaptorT> namespaceSupportT;
|
typedef SAX::NamespaceSupport<stringT, string_adaptorT> namespaceSupportT;
|
||||||
typedef SAX::basic_ErrorHandler<stringT> errorHandlerT;
|
typedef SAX::ErrorHandler<stringT> errorHandlerT;
|
||||||
typedef SAX::basic_SAXParseException<stringT> SAXParseExceptionT;
|
typedef SAX::SAXParseException<stringT> SAXParseExceptionT;
|
||||||
typedef SAX::basic_XMLReader<stringT> XMLReaderT;
|
typedef SAX::XMLReaderInterface<stringT> XMLReaderT;
|
||||||
typedef typename XMLReaderT::PropertyBase PropertyBaseT;
|
typedef typename XMLReaderT::PropertyBase PropertyBaseT;
|
||||||
typedef typename XMLReaderT::template Property<lexicalHandlerT*> getLexicalHandlerT;
|
typedef typename XMLReaderT::template Property<lexicalHandlerT*> getLexicalHandlerT;
|
||||||
typedef typename XMLReaderT::template Property<lexicalHandlerT&> setLexicalHandlerT;
|
typedef typename XMLReaderT::template Property<lexicalHandlerT&> setLexicalHandlerT;
|
||||||
|
@ -589,7 +589,7 @@ int expat_wrapper<stringT, T0, T1>::getColumnNumber() const
|
||||||
} // getColumnNumber
|
} // getColumnNumber
|
||||||
|
|
||||||
template<class stringT, class T0, class T1>
|
template<class stringT, class T0, class T1>
|
||||||
typename SAX::basic_NamespaceSupport<stringT, typename expat_wrapper<stringT, T0, T1>::string_adaptorT>::Parts expat_wrapper<stringT, T0, T1>::processName(const stringT& qName, bool isAttribute)
|
typename SAX::NamespaceSupport<stringT, typename expat_wrapper<stringT, T0, T1>::string_adaptorT>::Parts expat_wrapper<stringT, T0, T1>::processName(const stringT& qName, bool isAttribute)
|
||||||
{
|
{
|
||||||
typename namespaceSupportT::Parts p = nsSupport_.processName(qName, isAttribute);
|
typename namespaceSupportT::Parts p = nsSupport_.processName(qName, isAttribute);
|
||||||
if(SA::empty(p.URI) && !SA::empty(p.prefix))
|
if(SA::empty(p.URI) && !SA::empty(p.prefix))
|
||||||
|
@ -647,7 +647,7 @@ void expat_wrapper<stringT, T0, T1>::startElement(const char* qName, const char*
|
||||||
|
|
||||||
// OK we're doing Namespaces
|
// OK we're doing Namespaces
|
||||||
nsSupport_.pushContext();
|
nsSupport_.pushContext();
|
||||||
SAX::basic_AttributesImpl<stringT> attributes;
|
SAX::AttributesImpl<stringT> attributes;
|
||||||
|
|
||||||
// take a first pass and copy all the attributes, noting any declarations
|
// take a first pass and copy all the attributes, noting any declarations
|
||||||
if(atts && *atts != 0)
|
if(atts && *atts != 0)
|
||||||
|
@ -699,7 +699,7 @@ void expat_wrapper<stringT, T0, T1>::startElement(const char* qName, const char*
|
||||||
template<class stringT, class T0, class T1>
|
template<class stringT, class T0, class T1>
|
||||||
void expat_wrapper<stringT, T0, T1>::startElementNoNS(const char* qName, const char** atts)
|
void expat_wrapper<stringT, T0, T1>::startElementNoNS(const char* qName, const char** atts)
|
||||||
{
|
{
|
||||||
SAX::basic_AttributesImpl<stringT> attributes;
|
SAX::AttributesImpl<stringT> attributes;
|
||||||
|
|
||||||
if(atts && *atts != 0)
|
if(atts && *atts != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,8 +115,8 @@ xmlSAXHandler* lwit_SaxHandler();
|
||||||
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 libxml2_wrapper : public basic_XMLReader<string_type>,
|
class libxml2_wrapper : public XMLReaderInterface<string_type>,
|
||||||
public basic_Locator<string_type>,
|
public Locator<string_type>,
|
||||||
protected libxml2_wrapper_impl_tiddle::libxml2_base
|
protected libxml2_wrapper_impl_tiddle::libxml2_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -126,17 +126,17 @@ class libxml2_wrapper : public basic_XMLReader<string_type>,
|
||||||
T0,
|
T0,
|
||||||
T1>::type string_adaptor_type;
|
T1>::type string_adaptor_type;
|
||||||
typedef string_adaptor_type string_adaptorT;
|
typedef string_adaptor_type string_adaptorT;
|
||||||
typedef SAX::basic_EntityResolver<stringT> entityResolverT;
|
typedef SAX::EntityResolver<stringT> entityResolverT;
|
||||||
typedef SAX::basic_DTDHandler<stringT> dtdHandlerT;
|
typedef SAX::DTDHandler<stringT> dtdHandlerT;
|
||||||
typedef SAX::basic_ContentHandler<stringT> contentHandlerT;
|
typedef SAX::ContentHandler<stringT> contentHandlerT;
|
||||||
typedef SAX::basic_DeclHandler<stringT> declHandlerT;
|
typedef SAX::DeclHandler<stringT> declHandlerT;
|
||||||
typedef SAX::basic_LexicalHandler<stringT> lexicalHandlerT;
|
typedef SAX::LexicalHandler<stringT> lexicalHandlerT;
|
||||||
typedef SAX::basic_InputSource<stringT> inputSourceT;
|
typedef SAX::InputSource<stringT> inputSourceT;
|
||||||
typedef SAX::basic_Locator<stringT> locatorT;
|
typedef SAX::Locator<stringT> locatorT;
|
||||||
typedef SAX::basic_NamespaceSupport<stringT, string_adaptorT> namespaceSupportT;
|
typedef SAX::NamespaceSupport<stringT, string_adaptorT> namespaceSupportT;
|
||||||
typedef SAX::basic_ErrorHandler<stringT> errorHandlerT;
|
typedef SAX::ErrorHandler<stringT> errorHandlerT;
|
||||||
typedef SAX::basic_SAXParseException<stringT> SAXParseExceptionT;
|
typedef SAX::SAXParseException<stringT> SAXParseExceptionT;
|
||||||
typedef SAX::basic_XMLReader<stringT> XMLReaderT;
|
typedef SAX::XMLReaderInterface<stringT> XMLReaderT;
|
||||||
typedef typename XMLReaderT::PropertyBase PropertyBaseT;
|
typedef typename XMLReaderT::PropertyBase PropertyBaseT;
|
||||||
typedef typename XMLReaderT::template Property<lexicalHandlerT*> getLexicalHandlerT;
|
typedef typename XMLReaderT::template Property<lexicalHandlerT*> getLexicalHandlerT;
|
||||||
typedef typename XMLReaderT::template Property<lexicalHandlerT&> setLexicalHandlerT;
|
typedef typename XMLReaderT::template Property<lexicalHandlerT&> setLexicalHandlerT;
|
||||||
|
@ -152,12 +152,12 @@ class libxml2_wrapper : public basic_XMLReader<string_type>,
|
||||||
|
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
// Event Handlers
|
// Event Handlers
|
||||||
virtual void setEntityResolver(basic_EntityResolver<stringT>& resolver) { entityResolver_ = &resolver; }
|
virtual void setEntityResolver(EntityResolver<stringT>& resolver) { entityResolver_ = &resolver; }
|
||||||
virtual basic_EntityResolver<stringT>* getEntityResolver() const { return entityResolver_; }
|
virtual EntityResolver<stringT>* getEntityResolver() const { return entityResolver_; }
|
||||||
virtual void setDTDHandler(basic_DTDHandler<stringT>& handler) { dtdHandler_ = &handler; }
|
virtual void setDTDHandler(DTDHandler<stringT>& handler) { dtdHandler_ = &handler; }
|
||||||
virtual basic_DTDHandler<stringT>* getDTDHandler() const { return dtdHandler_; }
|
virtual DTDHandler<stringT>* getDTDHandler() const { return dtdHandler_; }
|
||||||
virtual void setContentHandler(basic_ContentHandler<stringT>& handler) { contentHandler_ = &handler; }
|
virtual void setContentHandler(ContentHandler<stringT>& handler) { contentHandler_ = &handler; }
|
||||||
virtual basic_ContentHandler<stringT>* getContentHandler() const { return contentHandler_; }
|
virtual ContentHandler<stringT>* getContentHandler() const { return contentHandler_; }
|
||||||
virtual void setErrorHandler(errorHandlerT& handler) { errorHandler_ = &handler; }
|
virtual void setErrorHandler(errorHandlerT& handler) { errorHandler_ = &handler; }
|
||||||
virtual errorHandlerT* getErrorHandler() const { return errorHandler_; }
|
virtual errorHandlerT* getErrorHandler() const { return errorHandler_; }
|
||||||
virtual void setDeclHandler(declHandlerT& handler) { declHandler_ = &handler; }
|
virtual void setDeclHandler(declHandlerT& handler) { declHandler_ = &handler; }
|
||||||
|
@ -167,7 +167,7 @@ class libxml2_wrapper : public basic_XMLReader<string_type>,
|
||||||
|
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
// parsing
|
// parsing
|
||||||
virtual void parse(basic_InputSource<stringT>& source);
|
virtual void parse(InputSource<stringT>& source);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
|
@ -205,7 +205,7 @@ class libxml2_wrapper : public basic_XMLReader<string_type>,
|
||||||
virtual void SAXentityDecl(const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content);
|
virtual void SAXentityDecl(const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content);
|
||||||
virtual xmlParserInputPtr SAXresolveEntity(const xmlChar* publicId, const xmlChar* systemId);
|
virtual xmlParserInputPtr SAXresolveEntity(const xmlChar* publicId, const xmlChar* systemId);
|
||||||
|
|
||||||
typename basic_NamespaceSupport<stringT, string_adaptorT>::Parts processName(const stringT& qName, bool isAttribute);
|
typename NamespaceSupport<stringT, string_adaptorT>::Parts processName(const stringT& qName, bool isAttribute);
|
||||||
void reportError(const std::string& message, bool fatal = false);
|
void reportError(const std::string& message, bool fatal = false);
|
||||||
void checkNotParsing(const stringT& type, const stringT& name) const;
|
void checkNotParsing(const stringT& type, const stringT& name) const;
|
||||||
|
|
||||||
|
@ -380,9 +380,9 @@ void libxml2_wrapper<stringT, T0, T1>::doSetProperty(const stringT& name, std::a
|
||||||
} // doSetProperty
|
} // doSetProperty
|
||||||
|
|
||||||
template<class stringT, class T0, class T1>
|
template<class stringT, class T0, class T1>
|
||||||
typename SAX::basic_NamespaceSupport<stringT, typename libxml2_wrapper<stringT, T0, T1>::string_adaptorT>::Parts libxml2_wrapper<stringT, T0, T1>::processName(const stringT& qName, bool isAttribute)
|
typename SAX::NamespaceSupport<stringT, typename libxml2_wrapper<stringT, T0, T1>::string_adaptorT>::Parts libxml2_wrapper<stringT, T0, T1>::processName(const stringT& qName, bool isAttribute)
|
||||||
{
|
{
|
||||||
typename basic_NamespaceSupport<stringT, string_adaptorT>::Parts p =
|
typename NamespaceSupport<stringT, string_adaptorT>::Parts p =
|
||||||
nsSupport_.processName(qName, isAttribute);
|
nsSupport_.processName(qName, isAttribute);
|
||||||
if(string_adaptorT::empty(p.URI) && !string_adaptorT::empty(p.prefix))
|
if(string_adaptorT::empty(p.URI) && !string_adaptorT::empty(p.prefix))
|
||||||
reportError(std::string("Undeclared prefix ") + string_adaptorT::asStdString(qName));
|
reportError(std::string("Undeclared prefix ") + string_adaptorT::asStdString(qName));
|
||||||
|
@ -395,7 +395,7 @@ void libxml2_wrapper<stringT, T0, T1>::reportError(const std::string& message, b
|
||||||
if(!errorHandler_)
|
if(!errorHandler_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
basic_SAXParseException<stringT> e(message, *this);
|
SAXParseException<stringT> e(message, *this);
|
||||||
if(fatal)
|
if(fatal)
|
||||||
errorHandler_->fatalError(e);
|
errorHandler_->fatalError(e);
|
||||||
else
|
else
|
||||||
|
@ -446,7 +446,7 @@ int libxml2_wrapper<stringT, T0, T1>::getColumnNumber() const
|
||||||
} // getColumnNumber
|
} // getColumnNumber
|
||||||
|
|
||||||
template<class stringT, class T0, class T1>
|
template<class stringT, class T0, class T1>
|
||||||
void libxml2_wrapper<stringT, T0, T1>::parse(basic_InputSource<stringT>& source)
|
void libxml2_wrapper<stringT, T0, T1>::parse(InputSource<stringT>& source)
|
||||||
{
|
{
|
||||||
if(contentHandler_)
|
if(contentHandler_)
|
||||||
contentHandler_->setDocumentLocator(*this);
|
contentHandler_->setDocumentLocator(*this);
|
||||||
|
@ -501,21 +501,21 @@ template<class stringT, class T0, class T1>
|
||||||
void libxml2_wrapper<stringT, T0, T1>::SAXwarning(const std::string& warning)
|
void libxml2_wrapper<stringT, T0, T1>::SAXwarning(const std::string& warning)
|
||||||
{
|
{
|
||||||
if(errorHandler_)
|
if(errorHandler_)
|
||||||
errorHandler_->warning(basic_SAXParseException<stringT>(warning, *this));
|
errorHandler_->warning(SAXParseException<stringT>(warning, *this));
|
||||||
} // warning
|
} // warning
|
||||||
|
|
||||||
template<class stringT, class T0, class T1>
|
template<class stringT, class T0, class T1>
|
||||||
void libxml2_wrapper<stringT, T0, T1>::SAXerror(const std::string& error)
|
void libxml2_wrapper<stringT, T0, T1>::SAXerror(const std::string& error)
|
||||||
{
|
{
|
||||||
if(errorHandler_)
|
if(errorHandler_)
|
||||||
errorHandler_->error(basic_SAXParseException<stringT>(error, *this));
|
errorHandler_->error(SAXParseException<stringT>(error, *this));
|
||||||
} // error
|
} // error
|
||||||
|
|
||||||
template<class stringT, class T0, class T1>
|
template<class stringT, class T0, class T1>
|
||||||
void libxml2_wrapper<stringT, T0, T1>::SAXfatalError(const std::string& fatal)
|
void libxml2_wrapper<stringT, T0, T1>::SAXfatalError(const std::string& fatal)
|
||||||
{
|
{
|
||||||
if(errorHandler_)
|
if(errorHandler_)
|
||||||
errorHandler_->fatalError(basic_SAXParseException<stringT>(fatal, *this));
|
errorHandler_->fatalError(SAXParseException<stringT>(fatal, *this));
|
||||||
} // fatal
|
} // fatal
|
||||||
|
|
||||||
template<class stringT, class T0, class T1>
|
template<class stringT, class T0, class T1>
|
||||||
|
@ -547,7 +547,7 @@ void libxml2_wrapper<stringT, T0, T1>::SAXstartElement(const xmlChar* qName, con
|
||||||
|
|
||||||
// OK we're doing Namespaces
|
// OK we're doing Namespaces
|
||||||
nsSupport_.pushContext();
|
nsSupport_.pushContext();
|
||||||
SAX::basic_AttributesImpl<stringT> attributes;
|
SAX::AttributesImpl<stringT> attributes;
|
||||||
|
|
||||||
// take a first pass and copy all the attributes, noting any declarations
|
// take a first pass and copy all the attributes, noting any declarations
|
||||||
if(atts && *atts != 0)
|
if(atts && *atts != 0)
|
||||||
|
@ -585,21 +585,21 @@ void libxml2_wrapper<stringT, T0, T1>::SAXstartElement(const xmlChar* qName, con
|
||||||
// declaration?
|
// declaration?
|
||||||
if(string_adaptorT::find(attQName, nsc_.xmlns) != 0)
|
if(string_adaptorT::find(attQName, nsc_.xmlns) != 0)
|
||||||
{
|
{
|
||||||
typename basic_NamespaceSupport<stringT, string_adaptorT>::Parts attName = processName(attQName, true);
|
typename NamespaceSupport<stringT, string_adaptorT>::Parts attName = processName(attQName, true);
|
||||||
attributes.addAttribute(attName.URI, attName.localName, attName.rawName, emptyString_, value);
|
attributes.addAttribute(attName.URI, attName.localName, attName.rawName, emptyString_, value);
|
||||||
}
|
}
|
||||||
} // while ...
|
} // while ...
|
||||||
} // if ...
|
} // if ...
|
||||||
|
|
||||||
// at last! report the event
|
// at last! report the event
|
||||||
typename basic_NamespaceSupport<stringT, string_adaptorT>::Parts name = processName(string_adaptorT::construct_from_utf8(reinterpret_cast<const char*>(qName)), false);
|
typename NamespaceSupport<stringT, string_adaptorT>::Parts name = processName(string_adaptorT::construct_from_utf8(reinterpret_cast<const char*>(qName)), false);
|
||||||
contentHandler_->startElement(name.URI, name.localName, name.rawName, attributes);
|
contentHandler_->startElement(name.URI, name.localName, name.rawName, attributes);
|
||||||
} // SAXstartElement
|
} // SAXstartElement
|
||||||
|
|
||||||
template<class stringT, class T0, class T1>
|
template<class stringT, class T0, class T1>
|
||||||
void libxml2_wrapper<stringT, T0, T1>::SAXstartElementNoNS(const xmlChar* qName, const xmlChar** atts)
|
void libxml2_wrapper<stringT, T0, T1>::SAXstartElementNoNS(const xmlChar* qName, const xmlChar** atts)
|
||||||
{
|
{
|
||||||
SAX::basic_AttributesImpl<stringT> attributes;
|
SAX::AttributesImpl<stringT> attributes;
|
||||||
|
|
||||||
if(atts && *atts != 0)
|
if(atts && *atts != 0)
|
||||||
{
|
{
|
||||||
|
@ -627,9 +627,9 @@ void libxml2_wrapper<stringT, T0, T1>::SAXendElement(const xmlChar* qName)
|
||||||
return;
|
return;
|
||||||
} // if(!namespaces_)
|
} // if(!namespaces_)
|
||||||
|
|
||||||
typename basic_NamespaceSupport<stringT, string_adaptorT>::Parts name = processName(string_adaptorT::construct_from_utf8(reinterpret_cast<const char*>(qName)), false);
|
typename NamespaceSupport<stringT, string_adaptorT>::Parts name = processName(string_adaptorT::construct_from_utf8(reinterpret_cast<const char*>(qName)), false);
|
||||||
contentHandler_->endElement(name.URI, name.localName, name.rawName);
|
contentHandler_->endElement(name.URI, name.localName, name.rawName);
|
||||||
typename basic_NamespaceSupport<stringT, string_adaptorT>::stringListT prefixes = nsSupport_.getDeclaredPrefixes();
|
typename NamespaceSupport<stringT, string_adaptorT>::stringListT prefixes = nsSupport_.getDeclaredPrefixes();
|
||||||
for(size_t i = 0, end = prefixes.size(); i < end; ++i)
|
for(size_t i = 0, end = prefixes.size(); i < end; ++i)
|
||||||
contentHandler_->endPrefixMapping(prefixes[i]);
|
contentHandler_->endPrefixMapping(prefixes[i]);
|
||||||
nsSupport_.popContext();
|
nsSupport_.popContext();
|
||||||
|
|
|
@ -60,7 +60,7 @@ class COMMultiThreadInitializer : public COMInitializer_tag
|
||||||
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 msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
class msxml2_wrapper : public SAX::XMLReaderInterface<string_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>,
|
Arabica::default_string_adaptor<string_type>,
|
||||||
|
@ -72,14 +72,14 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
T0>::type COMInitializer_type;
|
T0>::type COMInitializer_type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef SAX::basic_EntityResolver<string_type> entityResolverT;
|
typedef SAX::EntityResolver<string_type> entityResolverT;
|
||||||
typedef SAX::basic_DTDHandler<string_type> dtdHandlerT;
|
typedef SAX::DTDHandler<string_type> dtdHandlerT;
|
||||||
typedef SAX::basic_ContentHandler<string_type> contentHandlerT;
|
typedef SAX::ContentHandler<string_type> contentHandlerT;
|
||||||
typedef SAX::basic_DeclHandler<string_type> declHandlerT;
|
typedef SAX::DeclHandler<string_type> declHandlerT;
|
||||||
typedef SAX::basic_LexicalHandler<string_type> lexicalHandlerT;
|
typedef SAX::LexicalHandler<string_type> lexicalHandlerT;
|
||||||
typedef SAX::basic_InputSource<string_type> inputSourceT;
|
typedef SAX::InputSource<string_type> inputSourceT;
|
||||||
typedef SAX::basic_Locator<string_type> locatorT;
|
typedef SAX::Locator<string_type> locatorT;
|
||||||
typedef SAX::basic_ErrorHandler<string_type> errorHandlerT;
|
typedef SAX::ErrorHandler<string_type> errorHandlerT;
|
||||||
|
|
||||||
msxml2_wrapper();
|
msxml2_wrapper();
|
||||||
virtual ~msxml2_wrapper();
|
virtual ~msxml2_wrapper();
|
||||||
|
@ -92,14 +92,14 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
// Event Handlers
|
// Event Handlers
|
||||||
/* MSXML does not use EntityResolver currently */
|
/* MSXML does not use EntityResolver currently */
|
||||||
virtual void setEntityResolver(SAX::basic_EntityResolver<string_type>& resolver) { }
|
virtual void setEntityResolver(SAX::EntityResolver<string_type>& resolver) { }
|
||||||
virtual SAX::basic_EntityResolver<string_type>* getEntityResolver() const { return 0; }
|
virtual SAX::EntityResolver<string_type>* getEntityResolver() const { return 0; }
|
||||||
virtual void setDTDHandler(SAX::basic_DTDHandler<string_type>& handler) { dtdHandler_.setDTDHandler(handler); }
|
virtual void setDTDHandler(SAX::DTDHandler<string_type>& handler) { dtdHandler_.setDTDHandler(handler); }
|
||||||
virtual SAX::basic_DTDHandler<string_type>* getDTDHandler() const { return dtdHandler_.getDTDHandler(); }
|
virtual SAX::DTDHandler<string_type>* getDTDHandler() const { return dtdHandler_.getDTDHandler(); }
|
||||||
virtual void setContentHandler(SAX::basic_ContentHandler<string_type>& handler) { contentHandler_.setContentHandler(handler); }
|
virtual void setContentHandler(SAX::ContentHandler<string_type>& handler) { contentHandler_.setContentHandler(handler); }
|
||||||
virtual SAX::basic_ContentHandler<string_type>* getContentHandler() const { return contentHandler_.getContentHandler(); }
|
virtual SAX::ContentHandler<string_type>* getContentHandler() const { return contentHandler_.getContentHandler(); }
|
||||||
virtual void setErrorHandler(SAX::basic_ErrorHandler<string_type>& handler);
|
virtual void setErrorHandler(SAX::ErrorHandler<string_type>& handler);
|
||||||
virtual SAX::basic_ErrorHandler<string_type>* getErrorHandler() const;
|
virtual SAX::ErrorHandler<string_type>* getErrorHandler() const;
|
||||||
virtual void setDeclHandler(declHandlerT& handler) { declHandler_.setDeclHandler(handler); }
|
virtual void setDeclHandler(declHandlerT& handler) { declHandler_.setDeclHandler(handler); }
|
||||||
virtual declHandlerT* getDeclHandler() const { return declHandler_.getDeclHandler(); }
|
virtual declHandlerT* getDeclHandler() const { return declHandler_.getDeclHandler(); }
|
||||||
virtual void setLexicalHandler(lexicalHandlerT& handler) { lexicalHandler_.setLexicalHandler(handler); }
|
virtual void setLexicalHandler(lexicalHandlerT& handler) { lexicalHandler_.setLexicalHandler(handler); }
|
||||||
|
@ -107,29 +107,29 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
//////////////////////////////////////////////////
|
||||||
// Parsing
|
// Parsing
|
||||||
virtual void parse(SAX::basic_InputSource<string_type>& input);
|
virtual void parse(SAX::InputSource<string_type>& input);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual std::auto_ptr<typename SAX::basic_XMLReader<string_type>::PropertyBase> doGetProperty(const string_type& name)
|
virtual std::auto_ptr<typename SAX::XMLReaderInterface<string_type>::PropertyBase> doGetProperty(const string_type& name)
|
||||||
{
|
{
|
||||||
if(name == properties_.lexicalHandler)
|
if(name == properties_.lexicalHandler)
|
||||||
{
|
{
|
||||||
Property<SAX::basic_LexicalHandler<string_type>*>* prop = new Property<SAX::basic_LexicalHandler<string_type>*>(lexicalHandler_.getLexicalHandler());
|
Property<SAX::LexicalHandler<string_type>*>* prop = new Property<SAX::LexicalHandler<string_type>*>(lexicalHandler_.getLexicalHandler());
|
||||||
return std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase>(prop);
|
return std::auto_ptr<SAX::XMLReaderInterface<string_type>::PropertyBase>(prop);
|
||||||
}
|
}
|
||||||
if(name == properties_.declHandler)
|
if(name == properties_.declHandler)
|
||||||
{
|
{
|
||||||
Property<SAX::basic_DeclHandler<string_type>*>* prop = new Property<SAX::basic_DeclHandler<string_type>*>(declHandler_.getDeclHandler());
|
Property<SAX::DeclHandler<string_type>*>* prop = new Property<SAX::DeclHandler<string_type>*>(declHandler_.getDeclHandler());
|
||||||
return std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase>(prop);
|
return std::auto_ptr<SAX::XMLReaderInterface<string_type>::PropertyBase>(prop);
|
||||||
}
|
}
|
||||||
throw SAX::SAXNotRecognizedException("Property not recognized ");
|
throw SAX::SAXNotRecognizedException("Property not recognized ");
|
||||||
} // doGetProperty
|
} // doGetProperty
|
||||||
|
|
||||||
virtual void doSetProperty(const string_type& name, std::auto_ptr<typename SAX::basic_XMLReader<string_type>::PropertyBase> value)
|
virtual void doSetProperty(const string_type& name, std::auto_ptr<typename SAX::XMLReaderInterface<string_type>::PropertyBase> value)
|
||||||
{
|
{
|
||||||
if(name == properties_.lexicalHandler)
|
if(name == properties_.lexicalHandler)
|
||||||
{
|
{
|
||||||
Property<SAX::basic_LexicalHandler<string_type>&>* prop = dynamic_cast<Property<SAX::basic_LexicalHandler<string_type>&>*>(value.get());
|
Property<SAX::LexicalHandler<string_type>&>* prop = dynamic_cast<Property<SAX::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&");
|
||||||
|
@ -139,7 +139,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
} // if ...
|
} // if ...
|
||||||
if(name == properties_.declHandler)
|
if(name == properties_.declHandler)
|
||||||
{
|
{
|
||||||
Property<SAX::basic_DeclHandler<string_type>&>* prop = dynamic_cast<Property<SAX::basic_DeclHandler<string_type>&>*>(value.get());
|
Property<SAX::DeclHandler<string_type>&>* prop = dynamic_cast<Property<SAX::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&");
|
||||||
|
@ -153,7 +153,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
private:
|
private:
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
// COM interface -> C++ interface adaptors
|
// COM interface -> C++ interface adaptors
|
||||||
class LocatorAdaptor : public SAX::basic_Locator<string_type>
|
class LocatorAdaptor : public SAX::Locator<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LocatorAdaptor() : locator_(0) { }
|
LocatorAdaptor() : locator_(0) { }
|
||||||
|
@ -219,8 +219,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
DTDHandlerAdaptor() : dtdHandler_(0) { }
|
DTDHandlerAdaptor() : dtdHandler_(0) { }
|
||||||
~DTDHandlerAdaptor() { }
|
~DTDHandlerAdaptor() { }
|
||||||
|
|
||||||
void setDTDHandler(SAX::basic_DTDHandler<string_type>& handler) { dtdHandler_ = &handler; }
|
void setDTDHandler(SAX::DTDHandler<string_type>& handler) { dtdHandler_ = &handler; }
|
||||||
SAX::basic_DTDHandler<string_type>* getDTDHandler() const { return dtdHandler_; }
|
SAX::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,
|
||||||
|
@ -261,7 +261,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<string_type>* dtdHandler_;
|
SAX::DTDHandler<string_type>* dtdHandler_;
|
||||||
}; // class DTDHandlerAdaptor
|
}; // class DTDHandlerAdaptor
|
||||||
|
|
||||||
class ContentHandlerAdaptor : public ISAXContentHandler
|
class ContentHandlerAdaptor : public ISAXContentHandler
|
||||||
|
@ -270,8 +270,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
ContentHandlerAdaptor() : contentHandler_(0) { }
|
ContentHandlerAdaptor() : contentHandler_(0) { }
|
||||||
~ContentHandlerAdaptor() { }
|
~ContentHandlerAdaptor() { }
|
||||||
|
|
||||||
void setContentHandler(SAX::basic_ContentHandler<string_type>& handler) { contentHandler_ = &handler; }
|
void setContentHandler(SAX::ContentHandler<string_type>& handler) { contentHandler_ = &handler; }
|
||||||
SAX::basic_ContentHandler<string_type>* getContentHandler() const { return contentHandler_; }
|
SAX::ContentHandler<string_type>* getContentHandler() const { return contentHandler_; }
|
||||||
|
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE putDocumentLocator(
|
virtual HRESULT STDMETHODCALLTYPE putDocumentLocator(
|
||||||
|
@ -396,12 +396,12 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
private:
|
private:
|
||||||
////////////////////////////////////////////////
|
////////////////////////////////////////////////
|
||||||
// member varaibles
|
// member varaibles
|
||||||
SAX::basic_ContentHandler<string_type>* contentHandler_;
|
SAX::ContentHandler<string_type>* contentHandler_;
|
||||||
LocatorAdaptor locator_;
|
LocatorAdaptor locator_;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////
|
||||||
// COM interface -> C++ interface adaptors
|
// COM interface -> C++ interface adaptors
|
||||||
class AttributesAdaptor : public SAX::basic_Attributes<string_type>
|
class AttributesAdaptor : public SAX::Attributes<string_type>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AttributesAdaptor(ISAXAttributes __RPC_FAR *pAttributes) : attributes_(pAttributes) { }
|
AttributesAdaptor(ISAXAttributes __RPC_FAR *pAttributes) : attributes_(pAttributes) { }
|
||||||
|
@ -564,8 +564,8 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
{ }
|
{ }
|
||||||
virtual ~ErrorHandlerAdaptor() { }
|
virtual ~ErrorHandlerAdaptor() { }
|
||||||
|
|
||||||
void setErrorHandler(SAX::basic_ErrorHandler<string_type>& handler) { errorHandler_ = &handler; }
|
void setErrorHandler(SAX::ErrorHandler<string_type>& handler) { errorHandler_ = &handler; }
|
||||||
SAX::basic_ErrorHandler<string_type>* getErrorHandler() const { return errorHandler_; }
|
SAX::ErrorHandler<string_type>* getErrorHandler() const { return errorHandler_; }
|
||||||
|
|
||||||
virtual HRESULT STDMETHODCALLTYPE error(
|
virtual HRESULT STDMETHODCALLTYPE error(
|
||||||
/* [in] */ ISAXLocator *pLocator,
|
/* [in] */ ISAXLocator *pLocator,
|
||||||
|
@ -625,7 +625,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<string_type> SAXParseExceptionT;
|
typedef SAX::SAXParseException<string_type> SAXParseExceptionT;
|
||||||
bool bWarning_;
|
bool bWarning_;
|
||||||
bool bError_;
|
bool bError_;
|
||||||
bool bFatal_;
|
bool bFatal_;
|
||||||
|
@ -633,7 +633,7 @@ class msxml2_wrapper : public SAX::basic_XMLReader<string_type>
|
||||||
SAXParseExceptionT eError_;
|
SAXParseExceptionT eError_;
|
||||||
SAXParseExceptionT eFatal_;
|
SAXParseExceptionT eFatal_;
|
||||||
|
|
||||||
SAX::basic_ErrorHandler<string_type>* errorHandler_;
|
SAX::ErrorHandler<string_type>* errorHandler_;
|
||||||
}; // class ErrorHandlerAdaptor
|
}; // class ErrorHandlerAdaptor
|
||||||
|
|
||||||
class LexicalHandlerAdaptor : public ISAXLexicalHandler
|
class LexicalHandlerAdaptor : public ISAXLexicalHandler
|
||||||
|
@ -642,8 +642,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<string_type>& handler) { lexicalHandler_ = &handler; }
|
void setLexicalHandler(SAX::LexicalHandler<string_type>& handler) { lexicalHandler_ = &handler; }
|
||||||
SAX::basic_LexicalHandler<string_type>* getLexicalHandler() const { return lexicalHandler_; }
|
SAX::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,
|
||||||
|
@ -721,7 +721,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<string_type>* lexicalHandler_;
|
SAX::LexicalHandler<string_type>* lexicalHandler_;
|
||||||
}; // class LexicalHandlerAdaptor
|
}; // class LexicalHandlerAdaptor
|
||||||
|
|
||||||
class DeclHandlerAdaptor : public ISAXDeclHandler
|
class DeclHandlerAdaptor : public ISAXDeclHandler
|
||||||
|
@ -730,8 +730,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<string_type>& handler) { declHandler_ = &handler; }
|
void setDeclHandler(SAX::DeclHandler<string_type>& handler) { declHandler_ = &handler; }
|
||||||
SAX::basic_DeclHandler<string_type>* getDeclHandler() const { return declHandler_; }
|
SAX::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,
|
||||||
|
@ -807,13 +807,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<string_type>* declHandler_;
|
SAX::DeclHandler<string_type>* declHandler_;
|
||||||
}; // class DeclHandlerAdaptor
|
}; // class DeclHandlerAdaptor
|
||||||
|
|
||||||
class StreamAdaptor : public ISequentialStream
|
class StreamAdaptor : public ISequentialStream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StreamAdaptor(SAX::basic_InputSource<string_type>& source) :
|
StreamAdaptor(SAX::InputSource<string_type>& source) :
|
||||||
source_(source)
|
source_(source)
|
||||||
{
|
{
|
||||||
} // StreamAdaptor
|
} // StreamAdaptor
|
||||||
|
@ -847,7 +847,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<string_type>& source_;
|
SAX::InputSource<string_type>& source_;
|
||||||
}; // StreamAdaptor
|
}; // StreamAdaptor
|
||||||
|
|
||||||
|
|
||||||
|
@ -916,19 +916,19 @@ void msxml2_wrapper<string_type, T0, T1>::setFeature(const string_type& name, bo
|
||||||
} // setFeature
|
} // setFeature
|
||||||
|
|
||||||
template<class string_type, class T0, class T1>
|
template<class string_type, class T0, class T1>
|
||||||
void msxml2_wrapper<string_type, T0, T1>::setErrorHandler(SAX::basic_ErrorHandler<string_type>& handler)
|
void msxml2_wrapper<string_type, T0, T1>::setErrorHandler(SAX::ErrorHandler<string_type>& handler)
|
||||||
{
|
{
|
||||||
errorHandler_.setErrorHandler(handler);
|
errorHandler_.setErrorHandler(handler);
|
||||||
} // setErrorHandler
|
} // setErrorHandler
|
||||||
|
|
||||||
template<class string_type, class T0, class T1>
|
template<class string_type, class T0, class T1>
|
||||||
SAX::basic_ErrorHandler<string_type>* msxml2_wrapper<string_type, T0, T1>::getErrorHandler() const
|
SAX::ErrorHandler<string_type>* msxml2_wrapper<string_type, T0, T1>::getErrorHandler() const
|
||||||
{
|
{
|
||||||
return errorHandler_.getErrorHandler();
|
return errorHandler_.getErrorHandler();
|
||||||
} // getErrorHandler
|
} // getErrorHandler
|
||||||
|
|
||||||
template<class string_type, class T0, class T1>
|
template<class string_type, class T0, class T1>
|
||||||
void msxml2_wrapper<string_type, T0, T1>::parse(SAX::basic_InputSource<string_type>& source)
|
void msxml2_wrapper<string_type, T0, T1>::parse(SAX::InputSource<string_type>& source)
|
||||||
{
|
{
|
||||||
if(source.getByteStream() == 0)
|
if(source.getByteStream() == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,7 +122,7 @@ 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::basic_ProgressiveParser<string_type>
|
class xerces_wrapper : public SAX::ProgressiveParser<string_type>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
typedef typename Arabica::get_param<Arabica::string_adaptor_tag,
|
typedef typename Arabica::get_param<Arabica::string_adaptor_tag,
|
||||||
|
@ -132,18 +132,18 @@ class xerces_wrapper : public SAX::basic_ProgressiveParser<string_type>
|
||||||
typedef string_adaptor_type string_adaptorT;
|
typedef string_adaptor_type string_adaptorT;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef SAX::basic_XMLReader<string_type> base;
|
typedef SAX::XMLReaderInterface<string_type> base;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef typename base::EntityResolverT EntityResolverT;
|
typedef typename base::EntityResolverT EntityResolverT;
|
||||||
typedef typename base::DTDHandlerT DTDHandlerT;
|
typedef typename base::DTDHandlerT DTDHandlerT;
|
||||||
typedef typename base::ContentHandlerT ContentHandlerT;
|
typedef typename base::ContentHandlerT ContentHandlerT;
|
||||||
typedef typename base::InputSourceT InputSourceT;
|
typedef typename base::InputSourceT InputSourceT;
|
||||||
typedef SAX::basic_LexicalHandler<string_type> LexicalHandlerT;
|
typedef SAX::LexicalHandler<string_type> LexicalHandlerT;
|
||||||
typedef SAX::basic_Locator<string_type> LocatorT;
|
typedef SAX::Locator<string_type> LocatorT;
|
||||||
typedef SAX::basic_Attributes<string_type> AttributesT;
|
typedef SAX::Attributes<string_type> AttributesT;
|
||||||
typedef SAX::basic_DeclHandler<string_type> DeclHandlerT;
|
typedef SAX::DeclHandler<string_type> DeclHandlerT;
|
||||||
typedef SAX::basic_ErrorHandler<string_type> ErrorHandlerT;
|
typedef SAX::ErrorHandler<string_type> 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_adaptorT> featuresT;
|
||||||
|
@ -939,14 +939,14 @@ void xerces_wrapper<string_type, T0, T1>::setFeature(const string_type& name, bo
|
||||||
|
|
||||||
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::basic_XMLReader<string_type>::PropertyBase> xerces_wrapper<string_type, T0, T1>::doGetProperty(const string_type& name)
|
std::auto_ptr<typename SAX::XMLReaderInterface<string_type>::PropertyBase> xerces_wrapper<string_type, T0, T1>::doGetProperty(const string_type& name)
|
||||||
#else
|
#else
|
||||||
std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase> xerces_wrapper<string_type, T0, T1>::doGetProperty(const string_type& name)
|
std::auto_ptr<SAX::XMLReaderInterface<string_type>::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::basic_XMLReader<string_type>::template Property<LexicalHandlerT *> Prop;
|
typedef typename SAX::XMLReaderInterface<string_type>::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 base::PropertyBase>(prop);
|
||||||
|
@ -956,7 +956,7 @@ std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase> xerces_wrapper<st
|
||||||
}
|
}
|
||||||
if(name == properties_.declHandler)
|
if(name == properties_.declHandler)
|
||||||
{
|
{
|
||||||
typedef typename SAX::basic_XMLReader<string_type>::template Property<DeclHandlerT*> Prop;
|
typedef typename SAX::XMLReaderInterface<string_type>::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 base::PropertyBase>(prop);
|
||||||
|
@ -966,7 +966,7 @@ std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase> xerces_wrapper<st
|
||||||
}
|
}
|
||||||
if (name == properties_.externalSchemaLocation)
|
if (name == properties_.externalSchemaLocation)
|
||||||
{
|
{
|
||||||
typedef typename SAX::basic_XMLReader<string_type>::template Property<string_type&> StringPropertyType;
|
typedef typename SAX::XMLReaderInterface<string_type>::template Property<string_type&> StringPropertyType;
|
||||||
|
|
||||||
XMLCh* xercesExternalSchemaLocation =
|
XMLCh* xercesExternalSchemaLocation =
|
||||||
static_cast<XMLCh*>(xerces_->getProperty(
|
static_cast<XMLCh*>(xerces_->getProperty(
|
||||||
|
@ -989,7 +989,7 @@ std::auto_ptr<SAX::basic_XMLReader<string_type>::PropertyBase> xerces_wrapper<st
|
||||||
}
|
}
|
||||||
if (name == properties_.externalNoNamespaceSchemaLocation)
|
if (name == properties_.externalNoNamespaceSchemaLocation)
|
||||||
{
|
{
|
||||||
typedef typename SAX::basic_XMLReader<string_type>::template Property<string_type&> StringPropertyType;
|
typedef typename SAX::XMLReaderInterface<string_type>::template Property<string_type&> StringPropertyType;
|
||||||
|
|
||||||
XMLCh* xercesExternalNoNamespaceSchemaLocation =
|
XMLCh* xercesExternalNoNamespaceSchemaLocation =
|
||||||
static_cast<XMLCh*>(xerces_->getProperty(
|
static_cast<XMLCh*>(xerces_->getProperty(
|
||||||
|
@ -1014,7 +1014,7 @@ void xerces_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name,
|
||||||
{
|
{
|
||||||
if(name == properties_.lexicalHandler)
|
if(name == properties_.lexicalHandler)
|
||||||
{
|
{
|
||||||
typedef typename SAX::basic_XMLReader<string_type>::template Property<LexicalHandlerT&> Prop;
|
typedef typename SAX::XMLReaderInterface<string_type>::template Property<LexicalHandlerT&> Prop;
|
||||||
Prop* prop = dynamic_cast<Prop*>(value.get());
|
Prop* prop = dynamic_cast<Prop*>(value.get());
|
||||||
|
|
||||||
if(!prop)
|
if(!prop)
|
||||||
|
@ -1026,7 +1026,7 @@ void xerces_wrapper<string_type, T0, T1>::doSetProperty(const string_type& name,
|
||||||
|
|
||||||
if(name == properties_.declHandler)
|
if(name == properties_.declHandler)
|
||||||
{
|
{
|
||||||
typedef typename SAX::basic_XMLReader<string_type>::template Property<DeclHandlerT&> Prop;
|
typedef typename SAX::XMLReaderInterface<string_type>::template Property<DeclHandlerT&> Prop;
|
||||||
Prop* prop = dynamic_cast<Prop*>(value.get());
|
Prop* prop = dynamic_cast<Prop*>(value.get());
|
||||||
|
|
||||||
if(!prop)
|
if(!prop)
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Arabica
|
||||||
namespace XSLT
|
namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
class ApplyImportsHandler : public SAX::DefaultHandler
|
class ApplyImportsHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ApplyImportsHandler(CompilationContext& context):
|
ApplyImportsHandler(CompilationContext& context):
|
||||||
|
@ -24,7 +24,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(applyImports_ == 0)
|
if(applyImports_ == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Arabica
|
||||||
namespace XSLT
|
namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
class ApplyTemplatesHandler : public SAX::DefaultHandler
|
class ApplyTemplatesHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ApplyTemplatesHandler(CompilationContext& context) :
|
ApplyTemplatesHandler(CompilationContext& context) :
|
||||||
|
@ -22,7 +22,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(applyTemplates_ == 0)
|
if(applyTemplates_ == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ protected:
|
||||||
virtual Attribute* createContainer(const std::string& namespaceURI,
|
virtual Attribute* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
static const ValueRule rules[] = { { "name", true, 0 },
|
static const ValueRule rules[] = { { "name", true, 0 },
|
||||||
{ "namespace", false, 0 },
|
{ "namespace", false, 0 },
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace Arabica
|
||||||
namespace XSLT
|
namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
class CallTemplateHandler : public SAX::DefaultHandler
|
class CallTemplateHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CallTemplateHandler(CompilationContext& context) :
|
CallTemplateHandler(CompilationContext& context) :
|
||||||
|
@ -21,7 +21,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(callTemplate_ == 0)
|
if(callTemplate_ == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
virtual When* createContainer(const std::string& namespaceURI,
|
virtual When* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
static const ValueRule rules[] = { { "test", true, 0 },
|
static const ValueRule rules[] = { { "test", true, 0 },
|
||||||
{ 0, false, 0} };
|
{ 0, false, 0} };
|
||||||
|
@ -53,7 +53,7 @@ public:
|
||||||
virtual Otherwise* createContainer(const std::string& namespaceURI,
|
virtual Otherwise* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(atts.getLength())
|
if(atts.getLength())
|
||||||
throw SAX::SAXException("xsl:otherwise may not have any attributes");
|
throw SAX::SAXException("xsl:otherwise may not have any attributes");
|
||||||
|
@ -73,7 +73,7 @@ private:
|
||||||
Choose* choose_;
|
Choose* choose_;
|
||||||
}; // class OtherwiseHandler
|
}; // class OtherwiseHandler
|
||||||
|
|
||||||
class ChooseHandler : public SAX::DefaultHandler
|
class ChooseHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ChooseHandler(CompilationContext& context) :
|
ChooseHandler(CompilationContext& context) :
|
||||||
|
@ -86,7 +86,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(!choose_)
|
if(!choose_)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual Comment* createContainer(const std::string& namespaceURI,
|
virtual Comment* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(atts.getLength() != 0)
|
if(atts.getLength() != 0)
|
||||||
throw SAX::SAXException("xsl:comment can not have attributes");
|
throw SAX::SAXException("xsl:comment can not have attributes");
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
virtual Copy* createContainer(const std::string& namespaceURI,
|
virtual Copy* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
static const ValueRule rules[] = { { "use-attribute-sets", false, 0 },
|
static const ValueRule rules[] = { { "use-attribute-sets", false, 0 },
|
||||||
{ 0, false, 0} };
|
{ 0, false, 0} };
|
||||||
|
@ -29,7 +29,7 @@ public:
|
||||||
} // createContainer
|
} // createContainer
|
||||||
}; // class WhenHandler
|
}; // class WhenHandler
|
||||||
|
|
||||||
class CopyOfHandler : public SAX::DefaultHandler
|
class CopyOfHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CopyOfHandler(CompilationContext& context) :
|
CopyOfHandler(CompilationContext& context) :
|
||||||
|
@ -41,7 +41,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(copyOf_ == 0)
|
if(copyOf_ == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,12 +15,12 @@ namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
template<class Handler>
|
template<class Handler>
|
||||||
SAX::DefaultHandler* CreateHandler(CompilationContext& context)
|
SAX::DefaultHandler<std::string>* CreateHandler(CompilationContext& context)
|
||||||
{
|
{
|
||||||
return new Handler(context);
|
return new Handler(context);
|
||||||
} // create
|
} // create
|
||||||
|
|
||||||
class NotImplementedYetHandler : public SAX::DefaultHandler
|
class NotImplementedYetHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NotImplementedYetHandler(CompilationContext& context) { }
|
NotImplementedYetHandler(CompilationContext& context) { }
|
||||||
|
@ -28,13 +28,13 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
throw SAX::SAXException("Haven't implemented " + qName + " yet");
|
throw SAX::SAXException("Haven't implemented " + qName + " yet");
|
||||||
} // startElement
|
} // startElement
|
||||||
}; // NotImplementedYetHandler
|
}; // NotImplementedYetHandler
|
||||||
|
|
||||||
typedef SAX::DefaultHandler* (*CreateHandlerPtr)(CompilationContext&);
|
typedef SAX::DefaultHandler<std::string>* (*CreateHandlerPtr)(CompilationContext&);
|
||||||
|
|
||||||
struct ChildElement
|
struct ChildElement
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ protected:
|
||||||
virtual Element* createContainer(const std::string& namespaceURI,
|
virtual Element* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
static const ValueRule rules[] = { { "name", true, 0 },
|
static const ValueRule rules[] = { { "name", true, 0 },
|
||||||
{ "namespace", false, 0 },
|
{ "namespace", false, 0 },
|
||||||
|
|
|
@ -23,7 +23,7 @@ protected:
|
||||||
virtual ForEach* createContainer(const std::string& namespaceURI,
|
virtual ForEach* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
static const ValueRule rules[] = { { "select", true, 0 },
|
static const ValueRule rules[] = { { "select", true, 0 },
|
||||||
{ 0, false, 0} };
|
{ 0, false, 0} };
|
||||||
|
@ -35,7 +35,7 @@ protected:
|
||||||
virtual bool createChild(const std::string& namespaceURI,
|
virtual bool createChild(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if((namespaceURI == StylesheetConstant::NamespaceURI()) &&
|
if((namespaceURI == StylesheetConstant::NamespaceURI()) &&
|
||||||
(localName == "sort"))
|
(localName == "sort"))
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual If* createContainer(const std::string& namespaceURI,
|
virtual If* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
static const ValueRule rules[] = { { "test", true, 0 },
|
static const ValueRule rules[] = { { "test", true, 0 },
|
||||||
{ 0, false, 0} };
|
{ 0, false, 0} };
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Arabica
|
||||||
namespace XSLT
|
namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
class IncludeHandler : public SAX::DefaultHandler
|
class IncludeHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IncludeHandler() :
|
IncludeHandler() :
|
||||||
|
@ -21,7 +21,7 @@ public:
|
||||||
{
|
{
|
||||||
} // IncludeHandler
|
} // IncludeHandler
|
||||||
|
|
||||||
void context(CompilationContext& context, SAX::DefaultHandler* compiler)
|
void context(CompilationContext& context, SAX::DefaultHandler<std::string>* compiler)
|
||||||
{
|
{
|
||||||
context_ = &context;
|
context_ = &context;
|
||||||
compiler_ = compiler;
|
compiler_ = compiler;
|
||||||
|
@ -30,7 +30,7 @@ public:
|
||||||
void start_include(const std::string& namespaceURI,
|
void start_include(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
context_->parser().setContentHandler(*this);
|
context_->parser().setContentHandler(*this);
|
||||||
startElement(namespaceURI, localName, qName, atts);
|
startElement(namespaceURI, localName, qName, atts);
|
||||||
|
@ -39,7 +39,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(no_content_)
|
if(no_content_)
|
||||||
throw SAX::SAXException("xsl:include must be empty");
|
throw SAX::SAXException("xsl:include must be empty");
|
||||||
|
@ -77,10 +77,10 @@ public:
|
||||||
}
|
}
|
||||||
} // startElement
|
} // startElement
|
||||||
|
|
||||||
virtual void startPrefixMapping(const stringT& prefix, const stringT& uri)
|
virtual void startPrefixMapping(const stringT& prefix, const stringT& uri)
|
||||||
{
|
{
|
||||||
context_->parentHandler().startPrefixMapping(prefix, uri);
|
context_->parentHandler().startPrefixMapping(prefix, uri);
|
||||||
} // startPrefixMapping
|
} // startPrefixMapping
|
||||||
|
|
||||||
|
|
||||||
virtual void endElement(const std::string& namespaceURI,
|
virtual void endElement(const std::string& namespaceURI,
|
||||||
|
@ -130,7 +130,7 @@ public:
|
||||||
} // unwind_imports
|
} // unwind_imports
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string validate_href(const std::string& qName, const SAX::Attributes& atts)
|
std::string validate_href(const std::string& qName, const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
static const ValueRule rules[] = { { "href", true, 0 },
|
static const ValueRule rules[] = { { "href", true, 0 },
|
||||||
{ 0, false, 0 } };
|
{ 0, false, 0 } };
|
||||||
|
@ -157,7 +157,7 @@ private:
|
||||||
|
|
||||||
std::string prev = context_->setBase(href);
|
std::string prev = context_->setBase(href);
|
||||||
|
|
||||||
SAX::InputSource source(href);
|
SAX::InputSource<std::string> source(href);
|
||||||
SAX::XMLReader<std::string> include_parser;
|
SAX::XMLReader<std::string> include_parser;
|
||||||
SAX::CatchErrorHandler<std::string> errorHandler;
|
SAX::CatchErrorHandler<std::string> errorHandler;
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ private:
|
||||||
current_includes_.pop_back();
|
current_includes_.pop_back();
|
||||||
} // include_stylesheet
|
} // include_stylesheet
|
||||||
|
|
||||||
SAX::DefaultHandler* compiler_;
|
SAX::DefaultHandler<std::string>* compiler_;
|
||||||
CompilationContext* context_;
|
CompilationContext* context_;
|
||||||
unsigned int pass_through_;
|
unsigned int pass_through_;
|
||||||
bool no_content_;
|
bool no_content_;
|
||||||
|
|
|
@ -21,7 +21,7 @@ protected:
|
||||||
virtual InlineElement* createContainer(const std::string& namespaceURI,
|
virtual InlineElement* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
std::vector<InlineAttribute> inlineAtts;
|
std::vector<InlineAttribute> inlineAtts;
|
||||||
for(unsigned int i = 0; i != atts.getLength(); ++i)
|
for(unsigned int i = 0; i != atts.getLength(); ++i)
|
||||||
|
|
|
@ -11,10 +11,10 @@ namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
const ChildElement* AllowedChildren();
|
const ChildElement* AllowedChildren();
|
||||||
SAX::DefaultHandler* createInlineElementHandler(CompilationContext& context);
|
SAX::DefaultHandler<std::string>* createInlineElementHandler(CompilationContext& context);
|
||||||
|
|
||||||
template<class container_type>
|
template<class container_type>
|
||||||
class ItemContainerHandler : public SAX::DefaultHandler
|
class ItemContainerHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
ItemContainerHandler(CompilationContext& context) :
|
ItemContainerHandler(CompilationContext& context) :
|
||||||
|
@ -26,7 +26,7 @@ protected:
|
||||||
virtual container_type* createContainer(const std::string& namespaceURI,
|
virtual container_type* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts) = 0;
|
const SAX::Attributes<std::string>& atts) = 0;
|
||||||
|
|
||||||
CompilationContext& context() const { return context_; }
|
CompilationContext& context() const { return context_; }
|
||||||
container_type* container() const { return container_; }
|
container_type* container() const { return container_; }
|
||||||
|
@ -35,7 +35,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(container_ == 0)
|
if(container_ == 0)
|
||||||
{
|
{
|
||||||
|
@ -71,7 +71,7 @@ protected:
|
||||||
virtual bool createChild(const std::string& namespaceURI,
|
virtual bool createChild(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(namespaceURI == StylesheetConstant::NamespaceURI())
|
if(namespaceURI == StylesheetConstant::NamespaceURI())
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ const ChildElement* AllowedChildren()
|
||||||
return allowedChildren;
|
return allowedChildren;
|
||||||
} // AllowedChildren
|
} // AllowedChildren
|
||||||
|
|
||||||
SAX::DefaultHandler* createInlineElementHandler(CompilationContext& context)
|
SAX::DefaultHandler<std::string>* createInlineElementHandler(CompilationContext& context)
|
||||||
{
|
{
|
||||||
return new InlineElementHandler(context);
|
return new InlineElementHandler(context);
|
||||||
} // InlineElementHandler
|
} // InlineElementHandler
|
||||||
|
|
|
@ -21,7 +21,7 @@ protected:
|
||||||
virtual Message* createContainer(const std::string& namespaceURI,
|
virtual Message* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
static const ValueRule rules[] = { { "terminate", false, No, AllowedYesNo },
|
static const ValueRule rules[] = { { "terminate", false, No, AllowedYesNo },
|
||||||
{ 0, false, 0} };
|
{ 0, false, 0} };
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Arabica
|
||||||
namespace XSLT
|
namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
class NamespaceAliasHandler : public SAX::DefaultHandler
|
class NamespaceAliasHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NamespaceAliasHandler(CompilationContext& context) :
|
NamespaceAliasHandler(CompilationContext& context) :
|
||||||
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(!done_)
|
if(!done_)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Arabica
|
||||||
namespace XSLT
|
namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
class OutputHandler : public SAX::DefaultHandler
|
class OutputHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OutputHandler(CompilationContext& context) :
|
OutputHandler(CompilationContext& context) :
|
||||||
|
@ -19,7 +19,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(settings_.empty())
|
if(settings_.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual ProcessingInstruction* createContainer(const std::string& namespaceURI,
|
virtual ProcessingInstruction* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
static const ValueRule rules[] = { { "name", true, 0 },
|
static const ValueRule rules[] = { { "name", true, 0 },
|
||||||
{ 0, false, 0} };
|
{ 0, false, 0} };
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Arabica
|
||||||
namespace XSLT
|
namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
class SortHandler : public SAX::DefaultHandler
|
class SortHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SortHandler(CompilationContext& context,
|
SortHandler(CompilationContext& context,
|
||||||
|
@ -22,7 +22,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(sort_ == 0)
|
if(sort_ == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ protected:
|
||||||
virtual Template* createContainer(const std::string& namespaceURI,
|
virtual Template* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
const std::string& match = atts.getValue("match");
|
const std::string& match = atts.getValue("match");
|
||||||
if((match == "") && (atts.getValue("name") == ""))
|
if((match == "") && (atts.getValue("name") == ""))
|
||||||
|
@ -45,7 +45,7 @@ protected:
|
||||||
virtual bool createChild(const std::string& namespaceURI,
|
virtual bool createChild(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if((namespaceURI == StylesheetConstant::NamespaceURI()) &&
|
if((namespaceURI == StylesheetConstant::NamespaceURI()) &&
|
||||||
(localName == "param"))
|
(localName == "param"))
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Arabica
|
||||||
namespace XSLT
|
namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
class TextHandler : public SAX::DefaultHandler
|
class TextHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextHandler(CompilationContext& context) :
|
TextHandler(CompilationContext& context) :
|
||||||
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(text_ == 0)
|
if(text_ == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace Arabica
|
||||||
namespace XSLT
|
namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
class ValueOfHandler : public SAX::DefaultHandler
|
class ValueOfHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ValueOfHandler(CompilationContext& context) :
|
ValueOfHandler(CompilationContext& context) :
|
||||||
|
@ -21,7 +21,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(valueOf_ == 0)
|
if(valueOf_ == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,7 +49,7 @@ void validateAttribute(const std::string& parentElement,
|
||||||
} // validateAttribute
|
} // validateAttribute
|
||||||
|
|
||||||
std::map<std::string, std::string> gatherAttributes(const std::string& parentElement,
|
std::map<std::string, std::string> gatherAttributes(const std::string& parentElement,
|
||||||
const SAX::Attributes& atts,
|
const SAX::Attributes<std::string>& atts,
|
||||||
const ValueRule* rules)
|
const ValueRule* rules)
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string> results;
|
std::map<std::string, std::string> results;
|
||||||
|
|
|
@ -23,7 +23,7 @@ protected:
|
||||||
virtual VType* createContainer(const std::string& namespaceURI,
|
virtual VType* createContainer(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
static const ValueRule rules[] = { { "name", true, 0 },
|
static const ValueRule rules[] = { { "name", true, 0 },
|
||||||
{ "select", false, 0 },
|
{ "select", false, 0 },
|
||||||
|
|
|
@ -39,7 +39,7 @@ public:
|
||||||
} // while ...
|
} // while ...
|
||||||
} // ~CompilationContext
|
} // ~CompilationContext
|
||||||
|
|
||||||
void root(SAX::DefaultHandler& root)
|
void root(SAX::DefaultHandler<std::string>& root)
|
||||||
{
|
{
|
||||||
handlerStack_.push(&root);
|
handlerStack_.push(&root);
|
||||||
} // root
|
} // root
|
||||||
|
@ -64,11 +64,11 @@ public:
|
||||||
} // setBase
|
} // setBase
|
||||||
|
|
||||||
void push(ItemContainer* parent,
|
void push(ItemContainer* parent,
|
||||||
SAX::DefaultHandler* newHandler,
|
SAX::DefaultHandler<std::string>* newHandler,
|
||||||
const std::string& namespaceURI,
|
const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
parentStack_.push(parent);
|
parentStack_.push(parent);
|
||||||
handlerStack_.push(newHandler);
|
handlerStack_.push(newHandler);
|
||||||
|
@ -89,7 +89,7 @@ public:
|
||||||
return *parentStack_.top();
|
return *parentStack_.top();
|
||||||
} // parentContainer
|
} // parentContainer
|
||||||
|
|
||||||
SAX::ContentHandler& parentHandler() const
|
SAX::ContentHandler<std::string>& parentHandler() const
|
||||||
{
|
{
|
||||||
parser_.setContentHandler(*handlerStack_.top());
|
parser_.setContentHandler(*handlerStack_.top());
|
||||||
return parser_.contentHandler();
|
return parser_.contentHandler();
|
||||||
|
@ -131,7 +131,7 @@ private:
|
||||||
StylesheetParser& parser_;
|
StylesheetParser& parser_;
|
||||||
const Arabica::XPath::XPath<std::string>& xpath_;
|
const Arabica::XPath::XPath<std::string>& xpath_;
|
||||||
Stylesheet& stylesheet_;
|
Stylesheet& stylesheet_;
|
||||||
std::stack<SAX::DefaultHandler*> handlerStack_;
|
std::stack<SAX::DefaultHandler<std::string>*> handlerStack_;
|
||||||
std::stack<ItemContainer*> parentStack_;
|
std::stack<ItemContainer*> parentStack_;
|
||||||
std::map<std::string, Namespace> namespaceRemap_;
|
std::map<std::string, Namespace> namespaceRemap_;
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ private:
|
||||||
|
|
||||||
Arabica::io::URI absolute(Arabica::io::URI(baseURI_), location);
|
Arabica::io::URI absolute(Arabica::io::URI(baseURI_), location);
|
||||||
|
|
||||||
SAX::InputSource is(absolute.as_string());
|
SAX::InputSource<std::string> is(absolute.as_string());
|
||||||
domParser.parse(is);
|
domParser.parse(is);
|
||||||
|
|
||||||
if(!eh.errorsReported())
|
if(!eh.errorsReported())
|
||||||
|
|
|
@ -221,7 +221,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void do_start_document(const Settings& settings) = 0;
|
virtual void do_start_document(const Settings& settings) = 0;
|
||||||
virtual void do_end_document() = 0;
|
virtual void do_end_document() = 0;
|
||||||
virtual void do_start_element(const std::string& qName, const std::string& namespaceURI, const SAX::Attributes& atts) = 0;
|
virtual void do_start_element(const std::string& qName, const std::string& namespaceURI, const SAX::Attributes<std::string>& atts) = 0;
|
||||||
virtual void do_end_element(const std::string& qName, const std::string& namespaceURI) = 0;
|
virtual void do_end_element(const std::string& qName, const std::string& namespaceURI) = 0;
|
||||||
virtual void do_characters(const std::string& ch) = 0;
|
virtual void do_characters(const std::string& ch) = 0;
|
||||||
virtual void do_comment(const std::string& ch) = 0;
|
virtual void do_comment(const std::string& ch) = 0;
|
||||||
|
@ -305,7 +305,7 @@ private:
|
||||||
int pending_attribute_;
|
int pending_attribute_;
|
||||||
std::string name_;
|
std::string name_;
|
||||||
std::string namespaceURI_;
|
std::string namespaceURI_;
|
||||||
SAX::AttributesImpl atts_;
|
SAX::AttributesImpl<std::string> atts_;
|
||||||
std::stringstream buffer_;
|
std::stringstream buffer_;
|
||||||
bool text_mode_;
|
bool text_mode_;
|
||||||
NamespaceStack namespaceStack_;
|
NamespaceStack namespaceStack_;
|
||||||
|
@ -419,7 +419,7 @@ protected:
|
||||||
|
|
||||||
void do_start_element(const std::string& qName,
|
void do_start_element(const std::string& qName,
|
||||||
const std::string& namespaceURI,
|
const std::string& namespaceURI,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(!seen_root_)
|
if(!seen_root_)
|
||||||
do_decl(qName);
|
do_decl(qName);
|
||||||
|
@ -650,7 +650,7 @@ protected:
|
||||||
|
|
||||||
void do_start_element(const std::string& qName,
|
void do_start_element(const std::string& qName,
|
||||||
const std::string& namespaceURI,
|
const std::string& namespaceURI,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
indent();
|
indent();
|
||||||
DOM::Element<std::string> elem = document().createElementNS(namespaceURI, qName);
|
DOM::Element<std::string> elem = document().createElementNS(namespaceURI, qName);
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Arabica
|
||||||
namespace XSLT
|
namespace XSLT
|
||||||
{
|
{
|
||||||
|
|
||||||
class StylesheetHandler : public SAX::DefaultHandler
|
class StylesheetHandler : public SAX::DefaultHandler<std::string>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StylesheetHandler(CompilationContext& context) :
|
StylesheetHandler(CompilationContext& context) :
|
||||||
|
@ -34,7 +34,7 @@ public:
|
||||||
virtual void startElement(const std::string& namespaceURI,
|
virtual void startElement(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
if(top_)
|
if(top_)
|
||||||
{
|
{
|
||||||
|
@ -105,13 +105,13 @@ private:
|
||||||
void include_stylesheet(const std::string& namespaceURI,
|
void include_stylesheet(const std::string& namespaceURI,
|
||||||
const std::string& localName,
|
const std::string& localName,
|
||||||
const std::string& qName,
|
const std::string& qName,
|
||||||
const SAX::Attributes& atts)
|
const SAX::Attributes<std::string>& atts)
|
||||||
{
|
{
|
||||||
includer_.start_include(namespaceURI, localName, qName, atts);
|
includer_.start_include(namespaceURI, localName, qName, atts);
|
||||||
} // include_stylesheet
|
} // include_stylesheet
|
||||||
|
|
||||||
CompilationContext& context_;
|
CompilationContext& context_;
|
||||||
SAX::DefaultHandler* child_;
|
SAX::DefaultHandler<std::string>* child_;
|
||||||
IncludeHandler includer_;
|
IncludeHandler includer_;
|
||||||
bool top_;
|
bool top_;
|
||||||
unsigned int foreign_;
|
unsigned int foreign_;
|
||||||
|
@ -149,7 +149,7 @@ public:
|
||||||
{
|
{
|
||||||
} // ~StylesheetCompiler
|
} // ~StylesheetCompiler
|
||||||
|
|
||||||
std::auto_ptr<Stylesheet> compile(SAX::InputSource& source)
|
std::auto_ptr<Stylesheet> compile(SAX::InputSource<std::string>& source)
|
||||||
{
|
{
|
||||||
error_ = "";
|
error_ = "";
|
||||||
|
|
||||||
|
|
|
@ -16,17 +16,17 @@ class StylesheetParser
|
||||||
public:
|
public:
|
||||||
StylesheetParser() { }
|
StylesheetParser() { }
|
||||||
|
|
||||||
void setContentHandler(SAX::ContentHandler& handler)
|
void setContentHandler(SAX::ContentHandler<std::string>& handler)
|
||||||
{
|
{
|
||||||
namespace_tracker_.setContentHandler(handler);
|
namespace_tracker_.setContentHandler(handler);
|
||||||
} // setContentHandler
|
} // setContentHandler
|
||||||
|
|
||||||
SAX::ContentHandler& contentHandler()
|
SAX::ContentHandler<std::string>& contentHandler()
|
||||||
{
|
{
|
||||||
return text_coalescer_;
|
return text_coalescer_;
|
||||||
} // contentHandler
|
} // contentHandler
|
||||||
|
|
||||||
void parse(SAX::InputSource& source)
|
void parse(SAX::InputSource<std::string>& source)
|
||||||
{
|
{
|
||||||
SAX::XMLReader<std::string> base_parser;
|
SAX::XMLReader<std::string> base_parser;
|
||||||
text_coalescer_.setParent(base_parser);
|
text_coalescer_.setParent(base_parser);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
using namespace Arabica::SAX;
|
using namespace Arabica::SAX;
|
||||||
|
|
||||||
InputSourceResolver::InputSourceResolver(const Arabica::SAX::InputSource& inputSource) :
|
InputSourceResolver::InputSourceResolver(const Arabica::SAX::InputSource<std::string>& inputSource) :
|
||||||
deleteStream_(false),
|
deleteStream_(false),
|
||||||
byteStream_(0)
|
byteStream_(0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,7 @@ class SAX2DOMTest : public TestCase
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << SA::asStdString(str);
|
ss << SA::asStdString(str);
|
||||||
|
|
||||||
Arabica::SAX::basic_InputSource<string_type> is(ss);
|
Arabica::SAX::InputSource<string_type> is(ss);
|
||||||
Arabica::SAX::CatchErrorHandler<string_type> eh;
|
Arabica::SAX::CatchErrorHandler<string_type> eh;
|
||||||
Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
|
Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
|
||||||
parser.setErrorHandler(eh);
|
parser.setErrorHandler(eh);
|
||||||
|
|
|
@ -28,7 +28,7 @@ class TreeWalkerTest : public TestCase
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << SA::asStdString(str);
|
ss << SA::asStdString(str);
|
||||||
|
|
||||||
Arabica::SAX::basic_InputSource<string_type> is(ss);
|
Arabica::SAX::InputSource<string_type> is(ss);
|
||||||
Arabica::SAX::CatchErrorHandler<string_type> eh;
|
Arabica::SAX::CatchErrorHandler<string_type> eh;
|
||||||
Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
|
Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
|
||||||
parser.setErrorHandler(eh);
|
parser.setErrorHandler(eh);
|
||||||
|
|
|
@ -125,11 +125,11 @@ class WhitespaceStripperTest : public TestCase
|
||||||
} // testStrip
|
} // testStrip
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::auto_ptr<Arabica::SAX::InputSource> source(const std::string& str)
|
std::auto_ptr<Arabica::SAX::InputSource<std::string> > source(const std::string& str)
|
||||||
{
|
{
|
||||||
std::auto_ptr<std::iostream> ss(new std::stringstream());
|
std::auto_ptr<std::iostream> ss(new std::stringstream());
|
||||||
(*ss) << str;
|
(*ss) << str;
|
||||||
return std::auto_ptr<Arabica::SAX::InputSource>(new Arabica::SAX::InputSource(ss));
|
return std::auto_ptr<Arabica::SAX::InputSource<std::string> >(new Arabica::SAX::InputSource<std::string>(ss));
|
||||||
} // source
|
} // source
|
||||||
}; // WhitespaceStripperTest
|
}; // WhitespaceStripperTest
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,7 @@ public:
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << match;
|
ss << match;
|
||||||
|
|
||||||
Arabica::SAX::basic_InputSource<string_type> is(ss);
|
Arabica::SAX::InputSource<string_type> is(ss);
|
||||||
Arabica::SAX::CatchErrorHandler<string_type> eh;
|
Arabica::SAX::CatchErrorHandler<string_type> eh;
|
||||||
Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
|
Arabica::SAX2DOM::Parser<string_type, string_adaptor> parser;
|
||||||
parser.setErrorHandler(eh);
|
parser.setErrorHandler(eh);
|
||||||
|
|
|
@ -18,7 +18,7 @@ const std::string SEPERATOR = "/";
|
||||||
|
|
||||||
Arabica::DOM::Document<std::string> buildDOM(const std::string& filename)
|
Arabica::DOM::Document<std::string> buildDOM(const std::string& filename)
|
||||||
{
|
{
|
||||||
Arabica::SAX::InputSource is(filename);
|
Arabica::SAX::InputSource<std::string> is(filename);
|
||||||
Arabica::SAX2DOM::Parser<std::string> parser;
|
Arabica::SAX2DOM::Parser<std::string> parser;
|
||||||
parser.parse(is);
|
parser.parse(is);
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ protected:
|
||||||
{
|
{
|
||||||
Arabica::XSLT::StylesheetCompiler compiler;
|
Arabica::XSLT::StylesheetCompiler compiler;
|
||||||
|
|
||||||
Arabica::SAX::InputSource source(input_xslt_);
|
Arabica::SAX::InputSource<std::string> source(input_xslt_);
|
||||||
std::auto_ptr<Arabica::XSLT::Stylesheet> stylesheet = compiler.compile(source);
|
std::auto_ptr<Arabica::XSLT::Stylesheet> stylesheet = compiler.compile(source);
|
||||||
if(stylesheet.get() != 0)
|
if(stylesheet.get() != 0)
|
||||||
assertImplementation(false, "Expected " + input_xslt_ + " not to compile. But it did :o");
|
assertImplementation(false, "Expected " + input_xslt_ + " not to compile. But it did :o");
|
||||||
|
@ -113,7 +113,7 @@ protected:
|
||||||
{
|
{
|
||||||
Arabica::XSLT::StylesheetCompiler compiler;
|
Arabica::XSLT::StylesheetCompiler compiler;
|
||||||
|
|
||||||
Arabica::SAX::InputSource source(input_xslt_);
|
Arabica::SAX::InputSource<std::string> source(input_xslt_);
|
||||||
std::auto_ptr<Arabica::XSLT::Stylesheet> stylesheet = compiler.compile(source);
|
std::auto_ptr<Arabica::XSLT::Stylesheet> stylesheet = compiler.compile(source);
|
||||||
if(stylesheet.get() == 0)
|
if(stylesheet.get() == 0)
|
||||||
assertImplementation(false, "Failed to compile " + input_xslt_ + " : " + compiler.error());
|
assertImplementation(false, "Failed to compile " + input_xslt_ + " : " + compiler.error());
|
||||||
|
@ -158,7 +158,7 @@ protected:
|
||||||
{
|
{
|
||||||
Arabica::XSLT::StylesheetCompiler compiler;
|
Arabica::XSLT::StylesheetCompiler compiler;
|
||||||
|
|
||||||
Arabica::SAX::InputSource source(input_xslt_);
|
Arabica::SAX::InputSource<std::string> source(input_xslt_);
|
||||||
std::auto_ptr<Arabica::XSLT::Stylesheet> stylesheet = compiler.compile(source);
|
std::auto_ptr<Arabica::XSLT::Stylesheet> stylesheet = compiler.compile(source);
|
||||||
if(stylesheet.get() == 0)
|
if(stylesheet.get() == 0)
|
||||||
assertImplementation(false, "Failed to compile " + input_xslt_ + " : " + compiler.error());
|
assertImplementation(false, "Failed to compile " + input_xslt_ + " : " + compiler.error());
|
||||||
|
|
Loading…
Reference in a new issue