2002-11-23 20:54:58 +01:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
# pragma warning(disable:4786)
|
|
|
|
#endif
|
2002-06-21 13:16:28 +02:00
|
|
|
|
2007-09-05 00:55:47 +02:00
|
|
|
#include "SimpleHandler.hpp"
|
2002-06-21 13:16:28 +02:00
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
//////////////////////////////////////////////
|
|
|
|
// EntityResolver
|
2010-01-10 00:41:21 +01:00
|
|
|
Arabica::SAX::InputSource<std::string> SimpleHandler::resolveEntity(const std::string& /* publicId */, const std::string& /* systemId */)
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
2007-09-05 14:57:07 +02:00
|
|
|
return Arabica::SAX::InputSource<std::string>();
|
2002-06-21 13:16:28 +02:00
|
|
|
} // resolveEntity
|
|
|
|
|
|
|
|
//////////////////////////////////////////////
|
|
|
|
// DTDHandler
|
|
|
|
void SimpleHandler::notationDecl(const std::string& name,
|
|
|
|
const std::string& publicId,
|
|
|
|
const std::string& systemId)
|
|
|
|
{
|
|
|
|
std::cout << "notationDecl " << name << std::endl;
|
|
|
|
std::cout << " public : " << publicId << std::endl;
|
|
|
|
std::cout << " system : " << systemId << std::endl;
|
|
|
|
} // notationDecl
|
|
|
|
|
|
|
|
void SimpleHandler::unparsedEntityDecl(const std::string& name,
|
|
|
|
const std::string& publicId,
|
|
|
|
const std::string& systemId,
|
|
|
|
const std::string& notationName)
|
|
|
|
{
|
|
|
|
std::cout << "unparsedEntityDecl " << name << std::endl;
|
|
|
|
std::cout << " public : " << publicId << std::endl;
|
|
|
|
std::cout << " system : " << systemId << std::endl;
|
|
|
|
std::cout << " notation : " << notationName << std::endl;
|
|
|
|
} // unparsedEntityDecl
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////
|
|
|
|
// ContentHandler
|
|
|
|
void SimpleHandler::startDocument()
|
|
|
|
{
|
|
|
|
std::cout << "startDocument" << std::endl;
|
|
|
|
} // startDocument
|
|
|
|
|
|
|
|
void SimpleHandler::endDocument()
|
|
|
|
{
|
|
|
|
std::cout << "endDocument" << std::endl;
|
|
|
|
} // endDocument
|
|
|
|
|
|
|
|
void SimpleHandler::startPrefixMapping(const std::string& prefix, const std::string& uri)
|
|
|
|
{
|
|
|
|
std::cout << "startPrefixMapping " << prefix << " -> " << uri << std::endl;
|
|
|
|
} // startPrefixMapping
|
|
|
|
|
|
|
|
void SimpleHandler::endPrefixMapping(const std::string& prefix)
|
|
|
|
{
|
|
|
|
std::cout << "endPrefixMapping " << prefix << std::endl;
|
|
|
|
} // startPrefixMapping
|
|
|
|
|
2010-01-10 00:41:21 +01:00
|
|
|
void SimpleHandler::startElement(const std::string& namespaceURI,
|
|
|
|
const std::string& localName,
|
|
|
|
const std::string& qName,
|
|
|
|
const Arabica::SAX::Attributes<std::string>& /* atts */)
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
|
|
|
if(localName.length())
|
|
|
|
std::cout << "Start Element: " << namespaceURI << ":" << localName << std::endl;
|
|
|
|
else
|
|
|
|
std::cout << "Start Element: " << qName << std::endl;
|
|
|
|
} // startElement
|
|
|
|
|
2010-01-10 00:41:21 +01:00
|
|
|
void SimpleHandler::endElement(const std::string& namespaceURI,
|
|
|
|
const std::string& localName,
|
|
|
|
const std::string& /* qName */)
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
|
|
|
std::cout << "endElement: " << namespaceURI << ":" << localName << std::endl;
|
|
|
|
} // endElement
|
|
|
|
|
|
|
|
void SimpleHandler::characters(const std::string& ch)
|
|
|
|
{
|
|
|
|
std::cout << "Characters: " << ch << std::endl;
|
|
|
|
} // characters
|
|
|
|
|
|
|
|
void SimpleHandler::ignorableWhitespace(const std::string& ch)
|
|
|
|
{
|
2005-03-30 13:06:02 +02:00
|
|
|
std::cout << "Whitespace: " << ch << std::endl;
|
2002-06-21 13:16:28 +02:00
|
|
|
} // characters
|
|
|
|
|
|
|
|
void SimpleHandler::processingInstruction(const std::string& target, const std::string& data)
|
|
|
|
{
|
|
|
|
std::cout << "processingInstruction " << target << " - " << data << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SimpleHandler::skippedEntity(const std::string& name)
|
|
|
|
{
|
|
|
|
std::cout << "skippedEntity " << name << std::endl;
|
|
|
|
} //
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////
|
|
|
|
// ErrorHandler
|
2007-09-05 14:57:07 +02:00
|
|
|
void SimpleHandler::warning(const Arabica::SAX::SAXParseException<std::string>& exception)
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
|
|
|
std::cerr << "WARNING: " << exception.what() << std::endl;
|
|
|
|
} // warning
|
|
|
|
|
2007-09-05 14:57:07 +02:00
|
|
|
void SimpleHandler::error(const Arabica::SAX::SAXParseException<std::string>& exception)
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
|
|
|
std::cerr << "ERROR : " << exception.what() << std::endl;
|
|
|
|
} // error
|
|
|
|
|
2007-09-05 14:57:07 +02:00
|
|
|
void SimpleHandler::fatalError(const Arabica::SAX::SAXParseException<std::string>& exception)
|
2002-06-21 13:16:28 +02:00
|
|
|
{
|
|
|
|
std::cerr << "FATAL : " << exception.what() << std::endl;
|
|
|
|
} // fatalError
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////
|
|
|
|
// LexicalHandler
|
|
|
|
void SimpleHandler::startDTD(const std::string& name,
|
|
|
|
const std::string& publicId,
|
|
|
|
const std::string& systemId)
|
|
|
|
{
|
|
|
|
std::cout << "startDTD : " << name << std::endl
|
|
|
|
<< " publicId : " << publicId << std::endl
|
|
|
|
<< " systemId : " << systemId << std::endl;
|
|
|
|
} // startDTD
|
|
|
|
|
|
|
|
void SimpleHandler::endDTD()
|
|
|
|
{
|
|
|
|
std::cout << "endDTD" << std::endl;
|
|
|
|
} // endDTD
|
|
|
|
|
|
|
|
void SimpleHandler::startEntity(const std::string& name)
|
|
|
|
{
|
|
|
|
std::cout << "startEntity : " << name << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SimpleHandler::endEntity(const std::string& name)
|
|
|
|
{
|
|
|
|
std::cout << "endEntity : " << name << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SimpleHandler::startCDATA()
|
|
|
|
{
|
|
|
|
std::cout << "startCDATA" << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SimpleHandler::endCDATA()
|
|
|
|
{
|
|
|
|
std::cout << "endCDATA" << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SimpleHandler::comment(const std::string& text)
|
|
|
|
{
|
|
|
|
std::cout << "comment " << text << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////////////////
|
|
|
|
// Declhandler
|
|
|
|
void SimpleHandler::elementDecl(const std::string& name, const std::string& model)
|
|
|
|
{
|
|
|
|
std::cout << "elementDecl " << name << " - " << model << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SimpleHandler::attributeDecl(const std::string& elementName,
|
|
|
|
const std::string& attributeName,
|
|
|
|
const std::string& type,
|
|
|
|
const std::string& valueDefault,
|
|
|
|
const std::string& value)
|
|
|
|
{
|
|
|
|
std::cout << "attributeDecl " << elementName << "." << attributeName << std::endl
|
|
|
|
<< " type " << type << std::endl
|
|
|
|
<< " default " << valueDefault << std::endl
|
|
|
|
<< " value " << value << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SimpleHandler::internalEntityDecl(const std::string& name, const std::string& value)
|
|
|
|
{
|
|
|
|
std::cout << "internalEntityDecl " << name << " = " << value << std::endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SimpleHandler::externalEntityDecl(const std::string& name,
|
|
|
|
const std::string& publicId,
|
|
|
|
const std::string& systemId)
|
|
|
|
{
|
|
|
|
std::cout << "externalEntityDecl " << name << std::endl
|
|
|
|
<< " publicId : " << publicId << std::endl
|
|
|
|
<< " systemId : " << systemId << std::endl;
|
|
|
|
} // startDTD
|
|
|
|
|
|
|
|
// end of file
|