GDBMS 1.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes
XMLNode Struct Reference

Main Class representing a XML node. More...

#include <xmlParser.h>

List of all members.

Classes

struct  XMLNodeDataTag

Public Types

enum  XMLCharEncoding {
  char_encoding_error = 0, char_encoding_UTF8 = 1, char_encoding_legacy = 2, char_encoding_ShiftJIS = 3,
  char_encoding_GB2312 = 4, char_encoding_Big5 = 5, char_encoding_GBK = 6
}
 Enumeration for XML character encoding. More...
typedef enum
XMLNode::XMLCharEncoding 
XMLCharEncoding
 Enumeration for XML character encoding.

Public Member Functions

XMLSTR createXMLString (int nFormat=1, int *pnSize=NULL) const
 Create an XML string starting from the current XMLNode.
XMLError writeToFile (XMLCSTR filename, const char *encoding=NULL, char nFormat=1) const
 Save the content of an xmlNode inside a file.
XMLCSTR getName () const
 name of the node
XMLCSTR getText (int i=0) const
 return ith text field
int nText () const
 nbr of text field
XMLNode getParentNode () const
 return the parent node
XMLNode getChildNode (int i=0) const
 return ith child node
XMLNode 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 getChildNodeWithAttribute (XMLCSTR tagName, XMLCSTR attributeName, XMLCSTR attributeValue=NULL, int *i=NULL) const
 return child node with specific name/attribute (return an empty node if failing)
XMLNode getChildNodeByPath (XMLCSTR path, char createNodeIfMissing=0, XMLCHAR sep='/')
 return the first child node with specific path
XMLNode getChildNodeByPathNonConst (XMLSTR path, char createNodeIfMissing=0, XMLCHAR sep='/')
 return the first child node with specific path.
int nChildNode (XMLCSTR name) const
 return the number of child node with specific name
int nChildNode () const
 nbr of child node
XMLAttribute getAttribute (int i=0) const
 return ith attribute
XMLCSTR getAttributeName (int i=0) const
 return ith attribute name
XMLCSTR getAttributeValue (int i=0) const
 return ith attribute value
char isAttributeSet (XMLCSTR name) const
 test if an attribute with a specific name is given
XMLCSTR 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 attribute
XMLClear getClear (int i=0) const
 return ith clear field (comments)
int nClear () const
 nbr of clear field
XMLNodeContents 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 node
char isEmpty () const
 is this node Empty?
char isDeclaration () const
 is this node a declaration <? .... ?>
XMLNode deepCopy () const
 deep copy (duplicate/clone) a XMLNode
 ~XMLNode ()
 XMLNode (const XMLNode &A)
 to allow shallow/fast copy:
XMLNodeoperator= (const XMLNode &A)
 to allow shallow/fast copy:
 XMLNode ()
XMLNode addChild (XMLCSTR lpszName, char isDeclaration=FALSE, XMLElementPosition pos=-1)
 Add a new child node.
XMLNode 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 XMLNode.
XMLAttributeaddAttribute (XMLCSTR lpszName, XMLCSTR lpszValuev)
 Add a new attribute.
XMLCSTR addText (XMLCSTR lpszValue, XMLElementPosition pos=-1)
 Add a new text content.
XMLClearaddClear (XMLCSTR lpszValue, XMLCSTR lpszOpen=NULL, XMLCSTR lpszClose=NULL, XMLElementPosition pos=-1)
XMLCSTR updateName (XMLCSTR lpszName)
 change node's name
XMLAttributeupdateAttribute (XMLAttribute *newAttribute, XMLAttribute *oldAttribute)
 if the attribute to update is missing, a new one will be added
XMLAttributeupdateAttribute (XMLCSTR lpszNewValue, XMLCSTR lpszNewName=NULL, int i=0)
 if the attribute to update is missing, a new one will be added
XMLAttributeupdateAttribute (XMLCSTR lpszNewValue, XMLCSTR lpszNewName, XMLCSTR lpszOldName)
 set lpszNewName=NULL if you don't want to change the name of the attribute if the attribute to update is missing, a new one will be added
XMLCSTR updateText (XMLCSTR lpszNewValue, int i=0)
 if the text to update is missing, a new one will be added
XMLCSTR updateText (XMLCSTR lpszNewValue, XMLCSTR lpszOldValue)
 if the text to update is missing, a new one will be added
XMLClearupdateClear (XMLCSTR lpszNewContent, int i=0)
 if the clearTag to update is missing, a new one will be added
XMLClearupdateClear (XMLClear *newP, XMLClear *oldP)
 if the clearTag to update is missing, a new one will be added
XMLClearupdateClear (XMLCSTR lpszNewValue, XMLCSTR lpszOldValue)
 if the clearTag to update is missing, a new one will be added
void deleteNodeContent ()
 The "deleteNodeContent" function forces the deletion of the content of this XMLNode and the subtree.
void deleteAttribute (int i=0)
 Delete the ith attribute of the current XMLNode.
void 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 XMLNode.
void 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 XMLNode.
void 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 node.
XMLAttributeaddAttribute_WOSD (XMLSTR lpszName, XMLSTR lpszValue)
 Add a new attribute.
XMLCSTR addText_WOSD (XMLSTR lpszValue, XMLElementPosition pos=-1)
 Add a new text content.
XMLClearaddClear_WOSD (XMLSTR lpszValue, XMLCSTR lpszOpen=NULL, XMLCSTR lpszClose=NULL, XMLElementPosition pos=-1)
 Add a new clear Tag.
XMLCSTR updateName_WOSD (XMLSTR lpszName)
 change node's name
XMLAttributeupdateAttribute_WOSD (XMLAttribute *newAttribute, XMLAttribute *oldAttribute)
 if the attribute to update is missing, a new one will be added
XMLAttributeupdateAttribute_WOSD (XMLSTR lpszNewValue, XMLSTR lpszNewName=NULL, int i=0)
 if the attribute to update is missing, a new one will be added
XMLAttributeupdateAttribute_WOSD (XMLSTR lpszNewValue, XMLSTR lpszNewName, XMLCSTR lpszOldName)
 set lpszNewName=NULL if you don't want to change the name of the attribute if the attribute to update is missing, a new one will be added
XMLCSTR updateText_WOSD (XMLSTR lpszNewValue, int i=0)
 if the text to update is missing, a new one will be added
XMLCSTR updateText_WOSD (XMLSTR lpszNewValue, XMLCSTR lpszOldValue)
 if the text to update is missing, a new one will be added
XMLClearupdateClear_WOSD (XMLSTR lpszNewContent, int i=0)
 if the clearTag to update is missing, a new one will be added
XMLClearupdateClear_WOSD (XMLClear *newP, XMLClear *oldP)
 if the clearTag to update is missing, a new one will be added
XMLClearupdateClear_WOSD (XMLSTR lpszNewValue, XMLCSTR lpszOldValue)
 if the clearTag to update is missing, a new one will be added
XMLElementPosition 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 childNode

Static Public Member Functions

static XMLCSTR getVersion ()
 Return the XMLParser library version number.
static XMLNode parseString (XMLCSTR lpXMLString, XMLCSTR tag=NULL, XMLResults *pResults=NULL)
 Parse an XML string and return the root of a XMLNode tree representing the string.
static XMLNode parseFile (XMLCSTR filename, XMLCSTR tag=NULL, XMLResults *pResults=NULL)
 Parse an XML file and return the root of a XMLNode tree representing the file.
static XMLNode openFileHelper (XMLCSTR filename, XMLCSTR tag=NULL)
 Parse an XML file and return the root of a XMLNode tree representing the file. A very crude error checking is made. An attempt to guess the Char Encoding used in the file is made.
static XMLCSTR getError (XMLError error)
 this gives you a user-friendly explanation of the parsing error
static XMLNode emptyNode ()
 return XMLNode::emptyXMLNode;
static XMLNode createXMLTopNode (XMLCSTR lpszName, char isDeclaration=FALSE)
 Create the top node of an XMLNode structure.
static XMLNode createXMLTopNode_WOSD (XMLSTR lpszName, char isDeclaration=FALSE)
 Create the top node of an XMLNode structure.
static char setGlobalOptions (XMLCharEncoding characterEncoding=XMLNode::char_encoding_UTF8, char guessWideCharChars=1, char dropWhiteSpace=1, char removeCommentsInMiddleOfText=1)
 Sets the global options for the conversions.
static XMLCharEncoding guessCharEncoding (void *buffer, int bufLen, char useXMLEncodingAttribute=1)
 Guess the character encoding of the string (ascii, utf8 or shift-JIS)

Static Public Attributes

static XMLNode emptyXMLNode
static XMLClear emptyXMLClear = { NULL, NULL, NULL}
static XMLAttribute emptyXMLAttribute = { NULL, NULL}

Detailed Description

Main Class representing a XML node.

All operations are performed using this class.

Note:
The constructors of the XMLNode class are protected, so use instead one of these four methods to get your first instance of XMLNode:

Definition at line 165 of file xmlParser.h.


Member Typedef Documentation

Enumeration for XML character encoding.


Member Enumeration Documentation

Enumeration for XML character encoding.

Enumerator:
char_encoding_error 
char_encoding_UTF8 
char_encoding_legacy 
char_encoding_ShiftJIS 
char_encoding_GB2312 
char_encoding_Big5 
char_encoding_GBK 

Definition at line 417 of file xmlParser.h.


Constructor & Destructor Documentation

XMLNode::~XMLNode ( )

Definition at line 2161 of file xmlParser.cpp.

XMLNode::XMLNode ( const XMLNode A)

to allow shallow/fast copy:

Definition at line 2224 of file xmlParser.cpp.

XMLNode::XMLNode ( ) [inline]

Definition at line 290 of file xmlParser.h.


Member Function Documentation

XMLCSTR XMLNode::getVersion ( ) [static]

Return the XMLParser library version number.

Definition at line 72 of file xmlParser.cpp.

XMLNode & XMLNode::operator= ( const XMLNode A)

to allow shallow/fast copy:

Definition at line 2212 of file xmlParser.cpp.


Member Data Documentation

XMLAttribute XMLNode::emptyXMLAttribute = { NULL, NULL} [static]

Definition at line 293 of file xmlParser.h.

XMLClear XMLNode::emptyXMLClear = { NULL, NULL, NULL} [static]

Definition at line 292 of file xmlParser.h.

Definition at line 290 of file xmlParser.h.


The documentation for this struct was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines