mirror of
https://github.com/emagi/eq2emu
synced 2026-08-12 18:23:04 -04:00
7.8 KiB
7.8 KiB
File: xmlParser.h
Classes
XMLNodeContentsXMLNodeDataTagXMLNodeDataTag
Functions
XMLSTR createXMLString(int nFormat=1, int *pnSize=NULL) const;XMLCSTR getName() const; ///< name of the nodeXMLCSTR getText(int i=0) const; ///< return ith text fieldint nText() const; ///< nbr of text fieldXMLNode getParentNode() const; ///< return the parent nodeXMLNode getChildNode(int i=0) const; ///< return ith child nodeXMLNode getChildNode(XMLCSTR name, int i) const; ///< return ith child node with specific name (return an empty node if failing). If i==-1, this returns the last XMLNode with the given name.XMLNode getChildNode(XMLCSTR name, int *i=NULL) const; ///< return next child node with specific name (return an empty node if failing)XMLNode getChildNodeByPath(XMLCSTR path, char createNodeIfMissing=0, XMLCHAR sep='/');XMLNode getChildNodeByPathNonConst(XMLSTR path, char createNodeIfMissing=0, XMLCHAR sep='/');int nChildNode(XMLCSTR name) const; ///< return the number of child node with specific nameint nChildNode() const; ///< nbr of child nodeXMLAttribute getAttribute(int i=0) const; ///< return ith attributeXMLCSTR getAttributeName(int i=0) const; ///< return ith attribute nameXMLCSTR getAttributeValue(int i=0) const; ///< return ith attribute valuechar isAttributeSet(XMLCSTR name) const; ///< test if an attribute with a specific name is givenXMLCSTR getAttribute(XMLCSTR name, int i) const; ///< return ith attribute content with specific name (return a NULL if failing)XMLCSTR getAttribute(XMLCSTR name, int *i=NULL) const; ///< return next attribute content with specific name (return a NULL if failing)int nAttribute() const; ///< nbr of attributeXMLClear getClear(int i=0) const; ///< return ith clear field (comments)int nClear() const; ///< nbr of clear fieldXMLNodeContents enumContents(XMLElementPosition i) const; ///< enumerate all the different contents (attribute,child,text, clear) of the current XMLNode. The order is reflecting the order of the original file/string. NOTE: 0 <= i < nElement();int nElement() const; ///< nbr of different contents for current nodechar isEmpty() const; ///< is this node Empty?char isDeclaration() const; ///< is this node a declaration <? .... ?>XMLNode deepCopy() const; ///< deep copy (duplicate/clone) a XMLNodeXMLNode addChild(XMLCSTR lpszName, char isDeclaration=FALSE, XMLElementPosition pos=-1); ///< Add a new child nodeXMLNode addChild(XMLNode nodeToAdd, XMLElementPosition pos=-1); ///< If the "nodeToAdd" has some parents, it will be detached from it's parents before being attached to the current XMLNodeXMLCSTR addText(XMLCSTR lpszValue, XMLElementPosition pos=-1); ///< Add a new text contentXMLCSTR updateName(XMLCSTR lpszName); ///< change node's nameXMLCSTR updateText(XMLCSTR lpszNewValue, int i=0); ///< if the text to update is missing, a new one will be addedXMLCSTR updateText(XMLCSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the text to update is missing, a new one will be addedvoid deleteNodeContent();void deleteAttribute(int i=0); ///< Delete the ith attribute of the current XMLNodevoid deleteAttribute(XMLCSTR lpszName); ///< Delete the attribute with the given name (the "strcmp" function is used to find the right attribute)void deleteAttribute(XMLAttribute *anAttribute); ///< Delete the attribute with the name "anAttribute->lpszName" (the "strcmp" function is used to find the right attribute)void deleteText(int i=0); ///< Delete the Ith text content of the current XMLNodevoid deleteText(XMLCSTR lpszValue); ///< Delete the text content "lpszValue" inside the current XMLNode (direct "pointer-to-pointer" comparison is used to find the right text)void deleteClear(int i=0); ///< Delete the Ith clear tag inside the current XMLNodevoid deleteClear(XMLCSTR lpszValue); ///< Delete the clear tag "lpszValue" inside the current XMLNode (direct "pointer-to-pointer" comparison is used to find the clear tag)void deleteClear(XMLClear *p); ///< Delete the clear tag "p" inside the current XMLNode (direct "pointer-to-pointer" comparison on the lpszName of the clear tag is used to find the clear tag)XMLNode addChild_WOSD(XMLSTR lpszName, char isDeclaration=FALSE, XMLElementPosition pos=-1); ///< Add a new child nodeXMLCSTR addText_WOSD(XMLSTR lpszValue, XMLElementPosition pos=-1); ///< Add a new text contentXMLCSTR updateName_WOSD(XMLSTR lpszName); ///< change node's nameXMLCSTR updateText_WOSD(XMLSTR lpszNewValue, int i=0); ///< if the text to update is missing, a new one will be addedXMLCSTR updateText_WOSD(XMLSTR lpszNewValue, XMLCSTR lpszOldValue); ///< if the text to update is missing, a new one will be addedXMLElementPosition positionOfText(int i=0) const;XMLElementPosition positionOfText(XMLCSTR lpszValue) const;XMLElementPosition positionOfClear(int i=0) const;XMLElementPosition positionOfClear(XMLCSTR lpszValue) const;XMLElementPosition positionOfClear(XMLClear *a) const;XMLElementPosition positionOfChildNode(int i=0) const;XMLElementPosition positionOfChildNode(XMLNode x) const;XMLElementPosition positionOfChildNode(XMLCSTR name, int i=0) const; ///< return the position of the ith childNode with the specified name if (name==NULL) return the position of the ith childNodechar parseClearTag(void *px, void *pa);char maybeAddTxT(void *pa, XMLCSTR tokenPStr);int ParseXMLElement(void *pXML);int indexText(XMLCSTR lpszValue) const;int indexClear(XMLCSTR lpszValue) const;XMLNode addChild_priv(int,XMLSTR,char,int);XMLCSTR addText_priv(int,XMLSTR,int);void emptyTheNode(char force);void freeBuffer();///<call this function when you have finished using this object to release memory used by the internal buffer.XMLSTR toXML(XMLCSTR source);///< returns a pointer to an internal buffer that contains a XML-encoded string based on the "source" parameter.void freeBuffer();///< Call this function when you have finished using this object to release memory used by the internal buffer.XMLSTR encode(unsigned char *inByteBuf, unsigned int inByteLen, char formatted=0); ///< returns a pointer to an internal buffer containing the base64 string containing the binary data encoded from "inByteBuf"void alloc(int newsize);
Notable Comments
- /****************************************************************************/
- /*! \mainpage XMLParser library
-
- \section intro_sec Introduction
-
-
- This is a basic XML parser written in ANSI C++ for portability.
-
- It works by using recursion and a node tree for breaking
-
- down the elements of an XML document.
-
-
- @version V2.44
-
- @author Frank Vanden Berghen