top | up | prev | next

XmlProcessor Class

Definition at line 41 of XmlProcessor.hpp

Constructors

XmlProcessor(TrivialLexer& lexer_, XmlContentHandler* contentHandler_)
XmlProcessor(XmlProcessor&&) delete
XmlProcessor(const XmlProcessor&) delete

Member Functions

void AddAttribute(const std::u32string& attName, const std::u32string& attValue, const Span& span, const std::string& systemId)
const std::u32string& AttValue() const
std::u32string& AttValue()
void BeginAttributeValue()
void BeginStartTag(const std::u32string& tagName)
void CDataSection(const std::u32string& cdata)
void Comment(const std::u32string& text)
void Encoding(const std::u32string& encoding)
void EndAttributeValue()
void EndDocument()
void EndStartTag(const Span& span, const std::string& systemId)
void EndTag(const std::u32string& tagName, const Span& span, const std::string& systemId)
void EntityRef(const std::u32string& entityName, const Span& span, const std::string& systemId)
int GetErrorColumn(int index) const
std::string GetErrorLocationStr(const std::string& systemId, const Span& span) const
std::u32string GetNamespaceUri(const std::u32string& namespacePrefix, const Span& span, const std::string& systemId)
TrivialLexer& Lexer() const
void PI(const std::u32string& target, const std::u32string& data)
void ParseQualifiedName(const std::u32string& qualifiedName, std::u32string& localName, std::u32string& prefix, const Span& span, const std::string& systemId)
void Standalone(bool standalone)
void StartDocument()
void Text(const std::u32string& text)
void Version(const std::u32string& version)
XmlProcessor&& operator=(XmlProcessor&&) delete
XmlProcessor& operator=(const XmlProcessor&) delete

Member Variables

std::u32string attValue
std::stack<std::u32string> attValueStack
Attributes attributes
XmlContentHandler* contentHandler
std::u32string currentNamespacePrefix
std::u32string currentNamespaceUri
std::u32string currentTagName
std::unordered_map<std::u32string, std::unique_ptr<Entity>> entityMap
TrivialLexer& lexer
std::unordered_map<std::u32string, std::u32string> namespacePrefixMap
std::stack<std::u32string> namespacePrefixStack
std::stack<std::u32string> namespaceUriStack
std::stack<std::u32string> tagStack

Constructor Details

XmlProcessor Constructor

sngxml::xml::XmlProcessor::XmlProcessor(TrivialLexer & lexer_, XmlContentHandler * contentHandler_)

Definition at line 27 of XmlProcessor.cpp :
 27 : lexer(lexer_)contentHandler(contentHandler_)attValue()
 28 {
 29     entityMap[U"quot"] = std::unique_ptr<Entity>(new InternalEntity(U"\""));
 30     entityMap[U"amp"] = std::unique_ptr<Entity>(new InternalEntity(U"&"));
 31     entityMap[U"apos"] = std::unique_ptr<Entity>(new InternalEntity(U"'"));
 32     entityMap[U"lt"] = std::unique_ptr<Entity>(new InternalEntity(U"<"));
 33     entityMap[U"gt"] = std::unique_ptr<Entity>(new InternalEntity(U">"));
 34 }


Declaration at line 48 of XmlProcessor.hpp


XmlProcessor Constructor

sngxml::xml::XmlProcessor::XmlProcessor(XmlProcessor &&) delete

Definition at line 46 of XmlProcessor.hpp


XmlProcessor Constructor

sngxml::xml::XmlProcessor::XmlProcessor(const XmlProcessor &) delete

Definition at line 44 of XmlProcessor.hpp


Member Function Details

AddAttribute Member Function

void sngxml::xml::XmlProcessor::AddAttribute(const std::u32string& attName, const std::u32string& attValue, const Span & span, const std::string& systemId)

Definition at line 138 of XmlProcessor.cpp
Declaration at line 61 of XmlProcessor.hpp

Calls: sngxml::xml::Attributes::Add , sngxml::xml::XmlProcessor::GetNamespaceUri , sngxml::xml::XmlProcessor::ParseQualifiedName

Called by: XmlParser::Attribute


AttValue Member Function

const std::u32string& sngxml::xml::XmlProcessor::AttValue() const

Definition at line 65 of XmlProcessor.hpp :
65 { return attValue; }


AttValue Member Function

std::u32string& sngxml::xml::XmlProcessor::AttValue()

Definition at line 66 of XmlProcessor.hpp :
66 { return attValue; }

Called by: XmlParser::AttValueDQ , XmlParser::AttValueSQ


BeginAttributeValue Member Function

void sngxml::xml::XmlProcessor::BeginAttributeValue()

Definition at line 190 of XmlProcessor.cpp :
191 {
192     attValueStack.push(attValue);
193     attValue.clear();
194 }


Declaration at line 63 of XmlProcessor.hpp

Called by: XmlParser::AttValueDQ , XmlParser::AttValueSQ


BeginStartTag Member Function

void sngxml::xml::XmlProcessor::BeginStartTag(const std::u32string& tagName)

Definition at line 81 of XmlProcessor.cpp :
 82 {
 83     tagStack.push(currentTagName);
 84     currentTagName = tagName;
 85     namespaceUriStack.push(currentNamespaceUri);
 86     namespacePrefixStack.push(currentNamespacePrefix);
 87     attributes.Clear();
 88 }


Declaration at line 58 of XmlProcessor.hpp

Calls: sngxml::xml::Attributes::Clear

Called by: XmlParser::Element


CDataSection Member Function

void sngxml::xml::XmlProcessor::CDataSection(const std::u32string& cdata)

Definition at line 61 of XmlProcessor.cpp :
 62 {
 63     contentHandler->CDataSection(cdata);
 64 }


Declaration at line 54 of XmlProcessor.hpp

Calls: sngxml::xml::XmlContentHandler::CDataSection

Called by: XmlParser::CDSect


Comment Member Function

void sngxml::xml::XmlProcessor::Comment(const std::u32string& text)

Definition at line 51 of XmlProcessor.cpp :
 52 {
 53     contentHandler->Comment(text);
 54 }


Declaration at line 52 of XmlProcessor.hpp

Calls: sngxml::xml::XmlContentHandler::Comment

Called by: XmlParser::Comment


Encoding Member Function

void sngxml::xml::XmlProcessor::Encoding(const std::u32string& encoding)

Definition at line 76 of XmlProcessor.cpp :
 77 {
 78     contentHandler->Encoding(encoding);
 79 }


Declaration at line 57 of XmlProcessor.hpp

Calls: sngxml::xml::XmlContentHandler::Encoding

Called by: XmlParser::EncodingName


EndAttributeValue Member Function

void sngxml::xml::XmlProcessor::EndAttributeValue()

Definition at line 196 of XmlProcessor.cpp :
197 {
198     if (attValueStack.empty())
199     {
200         throw std::runtime_error("attribute value stack is empty");
201     }
202     attValue = attValueStack.top();
203     attValueStack.pop();
204 }


Declaration at line 64 of XmlProcessor.hpp

Called by: XmlParser::AttValueDQ , XmlParser::AttValueSQ


EndDocument Member Function

void sngxml::xml::XmlProcessor::EndDocument()

Definition at line 41 of XmlProcessor.cpp :
 42 {
 43     contentHandler->EndDocument();
 44 }


Declaration at line 50 of XmlProcessor.hpp

Calls: sngxml::xml::XmlContentHandler::EndDocument

Called by: XmlParser::Document


EndStartTag Member Function

void sngxml::xml::XmlProcessor::EndStartTag(const Span & span, const std::string& systemId)

Definition at line 90 of XmlProcessor.cpp :
 91 {
 92     std::u32string localName;
 93     std::u32string prefix;
 94     ParseQualifiedName(currentTagNamelocalNameprefixspansystemId);
 95     if (prefix == U"xmlns")
 96     {
 97         throw XmlProcessingException(GetErrorLocationStr(systemIdspan) + ": 'xmlns' prefix cannot be declared for an element");
 98     }
 99     contentHandler->StartElement(GetNamespaceUri(prefixspansystemId)localNamecurrentTagNameattributes);
100 }


Declaration at line 59 of XmlProcessor.hpp

Calls: sngxml::xml::XmlContentHandler::StartElement , sngxml::xml::XmlProcessor::GetErrorLocationStr , sngxml::xml::XmlProcessor::GetNamespaceUri , sngxml::xml::XmlProcessor::ParseQualifiedName

Called by: XmlParser::Element


EndTag Member Function

void sngxml::xml::XmlProcessor::EndTag(const std::u32string& tagName, const Span & span, const std::string& systemId)

Definition at line 102 of XmlProcessor.cpp
Declaration at line 60 of XmlProcessor.hpp

Calls: sngxml::xml::XmlContentHandler::EndElement , sngxml::xml::XmlProcessor::GetErrorLocationStr , sngxml::xml::XmlProcessor::GetNamespaceUri , sngxml::xml::XmlProcessor::ParseQualifiedName

Called by: XmlParser::ETag , XmlParser::Element


EntityRef Member Function

void sngxml::xml::XmlProcessor::EntityRef(const std::u32string& entityName, const Span & span, const std::string& systemId)

Definition at line 160 of XmlProcessor.cpp
Declaration at line 62 of XmlProcessor.hpp

Calls: sngxml::xml::InternalEntity::Value , sngxml::xml::XmlContentHandler::SkippedEntity , sngxml::xml::XmlProcessor::Text

Called by: XmlParser::EntityRef


GetErrorColumn Member Function

int sngxml::xml::XmlProcessor::GetErrorColumn(int index) const

Definition at line 242 of XmlProcessor.cpp
Declaration at line 82 of XmlProcessor.hpp

Calls: soulng::lexer::Lexer::Start

Called by: sngxml::xml::XmlProcessor::GetErrorLocationStr


GetErrorLocationStr Member Function

std::string sngxml::xml::XmlProcessor::GetErrorLocationStr(const std::string& systemId, const Span & span) const

Definition at line 257 of XmlProcessor.cpp :
258 {
259     soulng::lexer::Token token = lexer.GetToken(span.start);
260     int errorColumn = GetErrorColumn(token.match.begin - lexer.Start());
261     return "error in '" + systemId + "' at line " + std::to_string(span.line) + " column " + std::to_string(errorColumn);
262 }


Declaration at line 83 of XmlProcessor.hpp

Calls: sngxml::xml::XmlProcessor::GetErrorColumn , soulng::lexer::Lexer::GetToken , soulng::lexer::Lexer::Start

Called by: sngxml::xml::XmlProcessor::EndStartTag , sngxml::xml::XmlProcessor::EndTag , sngxml::xml::XmlProcessor::GetNamespaceUri , sngxml::xml::XmlProcessor::ParseQualifiedName


GetNamespaceUri Member Function

std::u32string sngxml::xml::XmlProcessor::GetNamespaceUri(const std::u32string& namespacePrefix, const Span & span, const std::string& systemId)

Definition at line 206 of XmlProcessor.cpp
Declaration at line 85 of XmlProcessor.hpp

Calls: sngxml::xml::XmlProcessor::GetErrorLocationStr

Called by: sngxml::xml::XmlProcessor::AddAttribute , sngxml::xml::XmlProcessor::EndStartTag , sngxml::xml::XmlProcessor::EndTag


Lexer Member Function

TrivialLexer & sngxml::xml::XmlProcessor::Lexer() const

Definition at line 67 of XmlProcessor.hpp :
67 { return lexer; }


PI Member Function

void sngxml::xml::XmlProcessor::PI(const std::u32string& target, const std::u32string& data)

Definition at line 56 of XmlProcessor.cpp :
 57 {
 58     contentHandler->PI(targetdata);
 59 }


Declaration at line 53 of XmlProcessor.hpp

Calls: sngxml::xml::XmlContentHandler::PI

Called by: XmlParser::PI


ParseQualifiedName Member Function

void sngxml::xml::XmlProcessor::ParseQualifiedName(const std::u32string& qualifiedName, std::u32string& localName, std::u32string& prefix, const Span & span, const std::string& systemId)

Definition at line 223 of XmlProcessor.cpp
Declaration at line 84 of XmlProcessor.hpp

Calls: sngxml::xml::XmlProcessor::GetErrorLocationStr

Called by: sngxml::xml::XmlProcessor::AddAttribute , sngxml::xml::XmlProcessor::EndStartTag , sngxml::xml::XmlProcessor::EndTag


Standalone Member Function

void sngxml::xml::XmlProcessor::Standalone(bool standalone)

Definition at line 71 of XmlProcessor.cpp :
 72 {
 73     contentHandler->Standalone(standalone);
 74 }


Declaration at line 56 of XmlProcessor.hpp

Calls: sngxml::xml::XmlContentHandler::Standalone

Called by: XmlParser::SDDecl


StartDocument Member Function

void sngxml::xml::XmlProcessor::StartDocument()

Definition at line 36 of XmlProcessor.cpp :
 37 {
 38     contentHandler->StartDocument();
 39 }


Declaration at line 49 of XmlProcessor.hpp

Calls: sngxml::xml::XmlContentHandler::StartDocument

Called by: XmlParser::Document


Text Member Function

void sngxml::xml::XmlProcessor::Text(const std::u32string& text)

Definition at line 46 of XmlProcessor.cpp :
 47 {
 48     contentHandler->Text(text);
 49 }


Declaration at line 51 of XmlProcessor.hpp

Calls: sngxml::xml::XmlContentHandler::Text

Called by: XmlParser::CharData , XmlParser::CharRef , sngxml::xml::XmlProcessor::EntityRef


Version Member Function

void sngxml::xml::XmlProcessor::Version(const std::u32string& version)

Definition at line 66 of XmlProcessor.cpp :
 67 {
 68     contentHandler->Version(version);
 69 }


Declaration at line 55 of XmlProcessor.hpp

Calls: sngxml::xml::XmlContentHandler::Version

Called by: XmlParser::VersionNum


operator= Member Function

XmlProcessor && sngxml::xml::XmlProcessor::operator=(XmlProcessor &&) delete

Definition at line 47 of XmlProcessor.hpp


operator= Member Function

XmlProcessor & sngxml::xml::XmlProcessor::operator=(const XmlProcessor &) delete

Definition at line 45 of XmlProcessor.hpp


top | up | prev | next