public: /// returns child list of this node
XMLChildNodeList *GetChildList() { return m_pChildList.get(); }
/// adds a new child void AddChild(
XMLChildNode *pChild /// the new child
);
void RemoveAndDeleteAllChildren();
};
/// Mapping numeric Language code <-> XML Element typedef std::unordered_map<OString, XMLElement*> LangHashMap;
/// Mapping XML Element string identifier <-> Language Map typedef std::unordered_map<OString, LangHashMap*> XMLHashMap;
/** Holds information of a XML file, is root node of tree
*/ class XMLFile final : public XMLParentNode
{ public:
XMLFile(
OString sFileName // the file name, empty if created from memory stream
);
XMLFile( const XMLFile& rObj ) ; virtual ~XMLFile() override;
/// Mapping XML tag names <-> have localizable strings
std::unordered_map<OString, bool> m_aNodes_localize;
std::unique_ptr<XMLHashMap> m_pXMLStrings;
std::vector <OString> m_vOrder;
};
/// A Utility class for XML class XMLUtil
{ public: /// Quot the XML characters static OString QuotHTML( const OString& rString );
};
/** Hold information of an element node
*/ class XMLElement : public XMLParentNode
{ private:
OString m_sElementName;
std::unique_ptr<XMLAttributeList> m_pAttributes;
protected: void Print(XMLNode *pCur, OStringBuffer& rBuffer, bool bRootelement) const; public: /// create an element node
XMLElement(
OString sName, // the element name
XMLParentNode *pParent // parent node of this element
);
/// returns element name const OString& GetName() const { return m_sElementName; }
/// returns list of attributes of this element
XMLAttributeList *GetAttributeList() { return m_pAttributes.get(); }
/// adds a new attribute to this element, typically used by parser void AddAttribute( const OString &rAttribute, const OString &rValue );
void ChangeLanguageTag( const OString &rValue );
/// Return a Unicode String representation of this object
OString ToOString();
};
/** Holds character data
*/ class XMLData : public XMLChildNode
{ private:
OString m_sData;
public: /// create a data node
XMLData(
OString _sData, // the initial data
XMLParentNode *pParent // the parent node of this data, typically an element node
) : XMLChildNode( pParent ), m_sData( std::move(_sData) ) {}
// Default copy constructor and copy operator work well.
/// returns the data const OString& GetData() const { return m_sData; }
/// adds new character data to the existing one void AddData( const OString &rData ) { m_sData += rData; }
};
/** Holds comments
*/ class XMLComment final : public XMLChildNode
{ private:
OString m_sComment;
public: /// create a comment node
XMLComment(
OString _sComment, // the comment
XMLParentNode *pParent // the parent node of this comment, typically an element node
)
: XMLChildNode( pParent ), m_sComment( std::move(_sComment) ) {}
// Default copy constructor and copy operator work well.
/** Holds additional file content like those for which no handler exists
*/ class XMLDefault final : public XMLChildNode
{ private:
OString m_sDefault;
public: /// create a comment node
XMLDefault(
OString _sDefault, // the comment
XMLParentNode *pParent // the parent node of this comment, typically an element node
)
: XMLChildNode( pParent ), m_sDefault( std::move(_sDefault) ) {}
// Default copy constructor and copy operator work well.
/** struct for error information, used by class SimpleXMLParser
*/ struct XMLError {
XML_Error m_eCode; ///< the error code
std::size_t m_nLine; ///< error line number
std::size_t m_nColumn; ///< error column number
OString m_sMessage; ///< readable error message
};
/** validating xml parser, creates a document tree with xml nodes
*/
class SimpleXMLParser
{ private:
XML_Parser m_aParser;
XMLError m_aErrorInformation;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.