20#ifndef INCLUDED_L10NTOOLS_INC_XMLPARSE_HXX
21#define INCLUDED_L10NTOOLS_INC_XMLPARSE_HXX
32#include <rtl/string.hxx>
33#include <rtl/strbuf.hxx>
34#include <unordered_map>
161 void Write( OString
const &rFilename );
162 void Write( std::ofstream &rStream,
XMLNode *pCur =
nullptr );
195 static OString
QuotHTML(
const OString& rString );
208 void Print(
XMLNode *pCur, OStringBuffer& rBuffer,
bool bRootelement)
const;
229 void AddAttribute(
const OString &rAttribute,
const OString &rValue );
330 static void StartElementHandler(
void *userData,
const XML_Char *name,
const XML_Char **atts );
333 static void CommentHandler(
void *userData,
const XML_Char *data );
334 static void DefaultHandler(
void *userData,
const XML_Char *s,
int len );
337 void StartElement(
const XML_Char *name,
const XML_Char **atts );
340 void Comment(
const XML_Char *data );
341 void Default(
const XML_Char *s,
int len );
350 const OString &rFileName,
validating xml parser, creates a document tree with xml nodes
void Default(const XML_Char *s, int len)
static void StartElementHandler(void *userData, const XML_Char *name, const XML_Char **atts)
static void CommentHandler(void *userData, const XML_Char *data)
SimpleXMLParser()
creates a new parser
const XMLError & GetError() const
returns an error struct
XMLParentNode * m_pCurNode
static void CharacterDataHandler(void *userData, const XML_Char *s, int len)
bool Execute(const OString &rFileName, XMLFile *pXMLFile)
parse a file, return false on critical errors
static void DefaultHandler(void *userData, const XML_Char *s, int len)
void CharacterData(const XML_Char *s, int len)
static void EndElementHandler(void *userData, const XML_Char *name)
void Comment(const XML_Char *data)
void StartElement(const XML_Char *name, const XML_Char **atts)
XMLError m_aErrorInformation
Holds data of Attributes.
void setValue(const OString &rValue)
XMLAttribute(OString _sName, OString _sValue)
creates an attribute
const OString & GetValue() const
const OString & GetName() const
Virtual base to handle different kinds of child nodes.
XMLChildNode & operator=(const XMLChildNode &rObj)
XMLParentNode * m_pParent
XMLChildNode(XMLParentNode *pPar)
XMLParentNode * GetParent()
returns the parent of this node
XMLData(OString _sData, XMLParentNode *pParent)
create a data node
const OString & GetData() const
returns the data
void AddData(const OString &rData)
adds new character data to the existing one
virtual XMLNodeType GetNodeType() const override
Holds additional file content like those for which no handler exists.
virtual XMLNodeType GetNodeType() const override
const OString & GetDefault() const
returns the comment
XMLDefault(OString _sDefault, XMLParentNode *pParent)
create a comment node
Hold information of an element node.
void Print(XMLNode *pCur, OStringBuffer &rBuffer, bool bRootelement) const
const OString & GetName() const
returns element name
void AddAttribute(const OString &rAttribute, const OString &rValue)
adds a new attribute to this element, typically used by parser
virtual XMLNodeType GetNodeType() const override
XMLAttributeList * GetAttributeList()
returns list of attributes of this element
XMLElement & operator=(const XMLElement &rObj)
void ChangeLanguageTag(const OString &rValue)
std::unique_ptr< XMLAttributeList > m_pAttributes
OString ToOString()
Return a Unicode String representation of this object.
virtual ~XMLElement() override
XMLElement(OString sName, XMLParentNode *pParent)
create an element node
Holds information of a XML file, is root node of tree.
std::unique_ptr< XMLHashMap > m_pXMLStrings
void Write(OString const &rFilename)
const OString & GetName() const
returns file name
std::vector< OString > m_vOrder
std::unordered_map< OString, bool > m_aNodes_localize
Mapping XML tag names <-> have localizable strings.
virtual ~XMLFile() override
const std::vector< OString > & getOrder() const
XMLHashMap * GetStrings()
bool CheckExportStatus(XMLChildNode *pCur=nullptr)
void SearchL10NElements(XMLChildNode *pCur)
virtual XMLNodeType GetNodeType() const override
void SetName(const OString &rFilename)
XMLFile & operator=(const XMLFile &rObj)
void InsertL10NElement(XMLElement *pElement)
void Print(XMLNode *pCur, sal_uInt16 nLevel=0)
XMLFile(OString sFileName)
Virtual base to handle different kinds of XML nodes.
XMLNode & operator=(XMLNode const &)=default
XMLNode(XMLNode const &)=default
virtual XMLNodeType GetNodeType() const =0
XMLNode(XMLNode &&)=default
Virtual base to handle different kinds of parent nodes.
void RemoveAndDeleteAllChildren()
void AddChild(XMLChildNode *pChild)
adds a new child
XMLParentNode(XMLParentNode *pPar)
virtual ~XMLParentNode() override
XMLChildNodeList * GetChildList()
returns child list of this node
std::unique_ptr< XMLChildNodeList > m_pChildList
XMLParentNode & operator=(const XMLParentNode &rObj)
static OString QuotHTML(const OString &rString)
Quot the XML characters.
struct for error information, used by class SimpleXMLParser
XML_Error m_eCode
the error code
std::size_t m_nLine
error line number
OString m_sMessage
readable error message
std::size_t m_nColumn
error column number
std::unordered_map< OString, LangHashMap * > XMLHashMap
Mapping XML Element string identifier <-> Language Map.
std::vector< XMLChildNode * > XMLChildNodeList
std::vector< XMLAttribute * > XMLAttributeList
std::unordered_map< OString, XMLElement * > LangHashMap
Mapping numeric Language code <-> XML Element.