actual/packages/node-libofx/OpenSP-1.5.2/lib/DtdDeclEventHandler.cxx

57 lines
1 KiB
C++
Raw Normal View History

2022-04-29 02:44:38 +00:00
// Copyright (c) 1999 Matthias Clasen
// See the file COPYING for copying permission.
#include "splib.h"
#include "DtdDeclEventHandler.h"
#include "macros.h"
#ifdef SP_NAMESPACE
namespace SP_NAMESPACE {
#endif
DtdDeclEventHandler::DtdDeclEventHandler(const StringC &pubid)
: pubid_(pubid), match_(0)
{
}
void DtdDeclEventHandler::message(MessageEvent *event)
{
switch (event->message().type->severity()) {
case MessageType::quantityError:
case MessageType::error:
case MessageType::idrefError:
delete event;
cancel();
break;
case MessageType::info:
case MessageType::warning:
delete event;
break;
}
}
void DtdDeclEventHandler::startDtd(StartDtdEvent *event)
{
const Entity *entity = event->entity().pointer();
if (entity) {
const StringC *pubid =
entity->asExternalEntity()->externalId().publicIdString();
if (pubid && pubid_ == *pubid)
match_ = 1;
}
delete event;
cancel();
}
Boolean DtdDeclEventHandler::match() const
{
return match_;
}
#ifdef SP_NAMESPACE
}
#endif