#include "config.h"
#include "Entity.h"
namespace WebCore {
Entity::Entity(Document* doc)
: ContainerNode(doc)
{
}
Entity::Entity(Document* doc, const String& name)
: ContainerNode(doc)
, m_name(name)
{
}
Entity::Entity(Document* doc, const String& publicId, const String& systemId, const String& notationName)
: ContainerNode(doc)
, m_publicId(publicId)
, m_systemId(systemId)
, m_notationName(notationName)
{
}
String Entity::nodeName() const
{
return m_name;
}
Node::NodeType Entity::nodeType() const
{
return ENTITY_NODE;
}
PassRefPtr<Node> Entity::cloneNode(bool )
{
return 0;
}
bool Entity::childTypeAllowed(NodeType type)
{
switch (type) {
case ELEMENT_NODE:
case PROCESSING_INSTRUCTION_NODE:
case COMMENT_NODE:
case TEXT_NODE:
case CDATA_SECTION_NODE:
case ENTITY_REFERENCE_NODE:
return true;
break;
default:
return false;
}
}
String Entity::toString() const
{
String result = "<!ENTITY' ";
if (!m_name.isEmpty()) {
result += " ";
result += m_name;
}
if (!m_publicId.isEmpty()) {
result += " PUBLIC \"";
result += m_publicId;
result += "\" \"";
result += m_systemId;
result += "\"";
} else if (!m_systemId.isEmpty()) {
result += " SYSTEM \"";
result += m_systemId;
result += "\"";
}
if (!m_notationName.isEmpty()) {
result += " NDATA ";
result += m_notationName;
}
result += ">";
return result;
}
}