Inheritance diagram for DSRXMLDocument:
Public Member Functions | |
DSRXMLDocument () | |
default constructor | |
virtual | ~DSRXMLDocument () |
destructor | |
void | clear () |
clear all internal member variables | |
OFBool | valid () const |
check whether the current internal state is valid | |
OFConsole * | getLogStream () const |
get the current log stream. | |
void | setLogStream (OFConsole *stream) |
set the log stream. | |
OFCondition | read (const OFString &filename, const size_t flags=0) |
read XML document from file. | |
OFBool | encodingHandlerValid () const |
check whether the currently set character encoding handler is valid. | |
OFCondition | setEncodingHandler (const char *charset) |
set the specified character encoding handler. | |
DSRXMLCursor | getRootNode () const |
get root node of the document | |
DSRXMLCursor | getNamedNode (const DSRXMLCursor &cursor, const char *name, const OFBool required=OFTrue) const |
get a particular named node of the document. | |
OFBool | matchNode (const DSRXMLCursor &cursor, const char *name) const |
check whether particular node matches a given name | |
OFCondition | checkNode (const DSRXMLCursor &cursor, const char *name) const |
check whether particular node matches a given name and report an error if not | |
OFBool | hasAttribute (const DSRXMLCursor &cursor, const char *name) const |
check whether particular node has a specific attribute | |
OFString & | getStringFromAttribute (const DSRXMLCursor &cursor, OFString &stringValue, const char *name, const OFBool encoding=OFFalse, const OFBool required=OFTrue) const |
get string value from particular XML attribute. | |
OFCondition | getElementFromAttribute (const DSRXMLCursor &cursor, DcmElement &delem, const char *name, const OFBool encoding=OFFalse, const OFBool required=OFTrue) const |
get element value from particular XML attribute | |
OFString & | getStringFromNodeContent (const DSRXMLCursor &cursor, OFString &stringValue, const char *name=NULL, const OFBool encoding=OFFalse, const OFBool clearString=OFTrue) const |
get string value from particular XML element | |
OFCondition | getElementFromNodeContent (const DSRXMLCursor &cursor, DcmElement &delem, const char *name=NULL, const OFBool encoding=OFFalse) const |
get element value from particular XML element | |
E_ValueType | getValueTypeFromNode (const DSRXMLCursor &cursor) const |
get value type from particular node. | |
E_RelationshipType | getRelationshipTypeFromNode (const DSRXMLCursor &cursor) const |
get relationship type from particular node. | |
void | printUnexpectedNodeWarning (const DSRXMLCursor &cursor) const |
print warning message for unexpected node | |
void | printGeneralNodeError (const DSRXMLCursor &cursor, const OFCondition &result) const |
print general node error message | |
Protected Member Functions | |
OFBool | convertUtf8ToCharset (const xmlChar *fromString, OFString &toString) const |
convert given string from 'libxml' format (UTF8) to current character set | |
void | printMissingAttributeError (const DSRXMLCursor &cursor, const char *name) const |
print error message for missing attribute | |
Static Protected Member Functions | |
static OFString & | getFullNodePath (const DSRXMLCursor &cursor, OFString &stringValue, const OFBool omitCurrent=OFFalse) |
get the full path (incl. | |
Private Member Functions | |
DSRXMLDocument (const DSRXMLDocument &) | |
DSRXMLDocument & | operator= (const DSRXMLDocument &) |
Private Attributes | |
xmlDocPtr | Document |
pointer to the internal representation of the XML document (libxml) | |
xmlCharEncodingHandlerPtr | EncodingHandler |
pointer to the currently selected character encoding handler (libxml) | |
OFConsole * | LogStream |
output stream for error messages, NULL for no messages |
This class encapsulates the access to the 'libxml' routines. Since the public interface of this class does not use any 'libxml' specific data structures it should be possible to replace the XML library with little effort (if required).
Definition at line 67 of file dsrxmld.h.
|
check whether particular node matches a given name and report an error if not
|
|
convert given string from 'libxml' format (UTF8) to current character set
|
|
check whether the currently set character encoding handler is valid. If no encoding handler is set this is equivalent to an invalid handler.
|
|
get element value from particular XML attribute
|
|
get element value from particular XML element
|
|
get the full path (incl. all predecessors) to the current node. Returns "<invalid>" in case of an invalid 'cursor'.
|
|
get the current log stream. See setLogStream() for details.
|
|
get a particular named node of the document. Please note that the search process is limited to the current node level, i.e. no deep search is performed.
|
|
get relationship type from particular node. The relationship type is either stored in the element "relationship" or in the attribute "relType".
|
|
get root node of the document
|
|
get string value from particular XML attribute. The result variable 'stringValue' is automatically cleared at the beginning.
|
|
get string value from particular XML element
|
|
get value type from particular node. The value type is either stored as the element name or in the attribute "valType". Additionally, by-reference relationships are also supported (either by attribute "ref" being present or element named "reference").
|
|
check whether particular node has a specific attribute
|
|
check whether particular node matches a given name
|
|
print general node error message
|
|
print error message for missing attribute
|
|
print warning message for unexpected node
|
|
read XML document from file. In order to enable the optional Schema validation the flag XF_validateSchema has to be set. XF_enableLibxmlErrorOutput enables the debug output from 'libxml'.
|
|
set the specified character encoding handler. NB: 'libxml' relies on GNU 'libiconv' for most character sets.
|
|
set the log stream. The log stream is used to report warning and error messages. Unfortunately, the stream cannot be used for 'libxml' messages. Therefore, the error output of 'libxml' is disabled by default (see read() for details).
|
|
check whether the current internal state is valid
|