DCMTK
Version 3.6.1 20120515
OFFIS DICOM Toolkit
|
Main Class representing a XML node. More...
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. | |
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 (const XMLNode &A) | |
to allow shallow/fast copy: | |
XMLNode & | operator= (const XMLNode &A) |
to allow shallow/fast copy: | |
XMLNode | addChild (XMLCSTR lpszName, char isDecl=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. | |
XMLAttribute * | addAttribute (XMLCSTR lpszName, XMLCSTR lpszValuev) |
Add a new attribute. | |
XMLCSTR | addText (XMLCSTR lpszValue, XMLElementPosition pos=-1) |
Add a new text content. | |
XMLClear * | addClear (XMLCSTR lpszValue, XMLCSTR lpszOpen=NULL, XMLCSTR lpszClose=NULL, XMLElementPosition pos=-1) |
Add a new clear tag. | |
XMLCSTR | updateName (XMLCSTR lpszName) |
change node's name | |
XMLAttribute * | updateAttribute (XMLAttribute *newAttribute, XMLAttribute *oldAttribute) |
if the attribute to update is missing, a new one will be added | |
XMLAttribute * | updateAttribute (XMLCSTR lpszNewValue, XMLCSTR lpszNewName=NULL, int i=0) |
if the attribute to update is missing, a new one will be added | |
XMLAttribute * | updateAttribute (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 | |
XMLClear * | updateClear (XMLCSTR lpszNewContent, int i=0) |
if the clearTag to update is missing, a new one will be added | |
XMLClear * | updateClear (XMLClear *newP, XMLClear *oldP) |
if the clearTag to update is missing, a new one will be added | |
XMLClear * | updateClear (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. | |
XMLAttribute * | addAttribute_WOSD (XMLSTR lpszName, XMLSTR lpszValue) |
Add a new attribute. | |
XMLCSTR | addText_WOSD (XMLSTR lpszValue, XMLElementPosition pos=-1) |
Add a new text content. | |
XMLClear * | addClear_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 | |
XMLAttribute * | updateAttribute_WOSD (XMLAttribute *newAttribute, XMLAttribute *oldAttribute) |
if the attribute to update is missing, a new one will be added | |
XMLAttribute * | updateAttribute_WOSD (XMLSTR lpszNewValue, XMLSTR lpszNewName=NULL, int i=0) |
if the attribute to update is missing, a new one will be added | |
XMLAttribute * | updateAttribute_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 | |
XMLClear * | updateClear_WOSD (XMLSTR lpszNewContent, int i=0) |
if the clearTag to update is missing, a new one will be added | |
XMLClear * | updateClear_WOSD (XMLClear *newP, XMLClear *oldP) |
if the clearTag to update is missing, a new one will be added | |
XMLClear * | updateClear_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) |
This function is currently disabled but might be enabled in the future in a modified version. | |
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 isDecl=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 |
static XMLAttribute | emptyXMLAttribute |
Private Types | |
typedef struct XMLNode::XMLNodeDataTag | XMLNodeData |
Private Member Functions | |
XMLNode (struct XMLNodeDataTag *pParent, XMLSTR lpszName, char isDecl) | |
Constructors are protected, so use instead one of: XMLNode::parseString, XMLNode::parseFile, XMLNode::openFileHelper, XMLNode::createXMLTopNode. | |
XMLNode (struct XMLNodeDataTag *p) | |
Constructors are protected, so use instead one of: XMLNode::parseString, XMLNode::parseFile, XMLNode::openFileHelper, XMLNode::createXMLTopNode. | |
char | parseClearTag (void *px, void *pa) |
char | maybeAddTxT (void *pa, XMLCSTR tokenPStr) |
int | ParseXMLElement (void *pXML) |
void * | addToOrder (int memInc, int *_pos, int nc, void *p, int size, XMLElementType xtype) |
int | indexText (XMLCSTR lpszValue) const |
int | indexClear (XMLCSTR lpszValue) const |
XMLNode | addChild_priv (int, XMLSTR, char, int) |
XMLAttribute * | addAttribute_priv (int, XMLSTR, XMLSTR) |
XMLCSTR | addText_priv (int, XMLSTR, int) |
XMLClear * | addClear_priv (int, XMLSTR, XMLCSTR, XMLCSTR, int) |
void | emptyTheNode (char force) |
Static Private Member Functions | |
static XMLElementPosition | findPosition (XMLNodeData *d, int index, XMLElementType xtype) |
static int | CreateXMLStringR (XMLNodeData *pEntry, XMLSTR lpszMarker, int nFormat) |
static int | removeOrderElement (XMLNodeData *d, XMLElementType t, int index) |
static void | exactMemory (XMLNodeData *d) |
static int | detachFromParent (XMLNodeData *d) |
Private Attributes | |
XMLNodeData * | d |
Main Class representing a XML node.
All operations are performed using this class.
struct XMLNode::XMLNodeDataTag |
Class Members | ||
---|---|---|
char | isDeclaration | |
XMLCSTR | lpszName | |
int | nAttribute | |
int | nChild | |
int | nClear | |
int | nText | |
XMLAttribute * | pAttribute | |
XMLNode * | pChild | |
XMLClear * | pClear | |
int * | pOrder | |
struct XMLNodeDataTag * | pParent | |
XMLCSTR * | pText | |
int | ref_count |