|
CAEN Utility
2.0.2
Utilities for CAEN projects
|
Wrapper functions to libxml. More...
Functions | |
| c_xmlfile_t * | c_xml_newfile (const char *filename) |
| c_xmlfile_t * | c_xml_newfile_from_memory (const char *buffer, int size) |
| void | c_xml_freefile (c_xmlfile_t *file) |
| xmlNode * | c_xml_getrootnode (const c_xmlfile_t *file) |
| const char * | c_xml_getpath (const c_xmlfile_t *file) |
| xmlNodeSet * | c_xml_getnodeset (c_xmlfile_t *file, const xmlChar *query) |
| void | c_xml_freenodeset (xmlNodeSet *nodeset) |
| const char * | c_xml_getattributevalue (const xmlNode *node, const char *attribute, bool warnEnable) |
| xmlNode * | c_xml_getfirstnodefromxpathquery (c_xmlfile_t *file, const xmlChar *query) |
| xmlNode * | c_xml_getnextelementfromname (xmlNode *node, const char *nodename) |
| xmlNode * | c_getfirstsiblingelementfromname (xmlNode *node, const char *nodename) |
| xmlNode * | c_xml_getfirstchildrenelementfromname (xmlNode *node, const char *nodename) |
| xmlNode * | c_xml_getfirstdescendantelementfromname (xmlNode *node, const char *nodename) |
| int32_t | c_xml_getcodefromnodechild (const xmlNode *node, double *code) |
| int32_t | c_xml_getcodefromnode (const xmlNode *node, double *code) |
| int32_t | c_xml_getcodefromcodename (const c_xmlfile_t *file, const char *__restrict category, const char *__restrict codename, double *code) |
| const char * | c_xml_getattributevaluefromcodename (const c_xmlfile_t *file, const char *__restrict category, const char *__restrict codename, const char *__restrict attrname) |
| c_fcnhandle_t | c_xml_getfunctionpointerfromcodename (const c_xmlfile_t *file, const char *codename) |
| int | c_xml_snprintf (xmlChar *buf, int len, const char *msg,...) |
| int | c_xml_strlen (const xmlChar *str) |
| const char * | c_xml_parserversion (void) |
| void | c_xml_parsercleanup (void) |
Wrapper functions to libxml.
| c_xmlfile_t* c_xml_newfile | ( | const char * | filename | ) |
Create a new c_xmlfile_t struct given its filename, and call xmlReadFile().
| [in] | filename | path to XML file or URL |
Definition at line 54 of file CAENXMLParser.c.
| c_xmlfile_t* c_xml_newfile_from_memory | ( | const char * | buffer, |
| int | size | ||
| ) |
Create a new c_xmlfile_t struct given a buffer in memory, and call xmlReadMemory().
| [in] | buffer | a pointer to a char array |
| [in] | size | the size of the array |
Definition at line 79 of file CAENXMLParser.c.
| void c_xml_freefile | ( | c_xmlfile_t * | file | ) |
Free memory allocated by c_xml_newfile() of c_xml_newfile_from_buffer() and close the document.
| [in] | file | a pointer returned by c_xml_newfile() or c_xml_newfile_from_memory(). If NULL, no operation is performed. |
Definition at line 106 of file CAENXMLParser.c.
| xmlNode* c_xml_getrootnode | ( | const c_xmlfile_t * | file | ) |
Wrapper to xmlDocGetRootElement(file->doc).
| [in] | file | the file |
Definition at line 117 of file CAENXMLParser.c.
| const char* c_xml_getpath | ( | const c_xmlfile_t * | file | ) |
Get the complete path of the document.
| [in] | file | the file |
Definition at line 238 of file CAENXMLParser.c.
| xmlNodeSet* c_xml_getnodeset | ( | c_xmlfile_t * | file, |
| const xmlChar * | query | ||
| ) |
Uses 'query' expression to get a nodeset from 'file'.
| [in] | file | the file |
| [in] | query | the expression |
Definition at line 121 of file CAENXMLParser.c.
| void c_xml_freenodeset | ( | xmlNodeSet * | nodeset | ) |
Wrapper to xmlXPathFreeNodeSet(nodeset).
| [in] | nodeset | a pointer returned by c_xml_getnodeset(). If NULL, no operation is performed. |
Definition at line 146 of file CAENXMLParser.c.
| const char* c_xml_getattributevalue | ( | const xmlNode * | node, |
| const char * | attribute, | ||
| bool | warnEnable | ||
| ) |
Parses an xmlNode to get the value of the one named 'attr'.
| [in] | node | a node |
| [in] | attribute | the name of the attribute to get |
| [in] | warnEnable | if true, print a message to the log in case of error |
Definition at line 151 of file CAENXMLParser.c.
| xmlNode* c_xml_getfirstnodefromxpathquery | ( | c_xmlfile_t * | file, |
| const xmlChar * | query | ||
| ) |
Returns the first random-ordered node which matches the query. To be used only for queries which produce for sure a single result.
| [in] | file | the file |
| [in] | query | the query |
Definition at line 162 of file CAENXMLParser.c.
| xmlNode* c_xml_getnextelementfromname | ( | xmlNode * | node, |
| const char * | nodename | ||
| ) |
Parses an xmlNode to get the first one called 'nodename'.
| [in] | node | a node |
| [in] | nodename | the name |
Definition at line 176 of file CAENXMLParser.c.
| xmlNode* c_getfirstsiblingelementfromname | ( | xmlNode * | node, |
| const char * | nodename | ||
| ) |
Parses an xmlNode siblings to get the first one called 'nodename'.
| [in] | node | a node |
| [in] | nodename | the name |
Definition at line 188 of file CAENXMLParser.c.
| xmlNode* c_xml_getfirstchildrenelementfromname | ( | xmlNode * | node, |
| const char * | nodename | ||
| ) |
Parses an xmlNode children to get the first one called 'nodename'.
| [in] | node | a node |
| [in] | nodename | the name |
Definition at line 197 of file CAENXMLParser.c.
| xmlNode* c_xml_getfirstdescendantelementfromname | ( | xmlNode * | node, |
| const char * | nodename | ||
| ) |
Parses an xmlNode descendants to get the first one whose hierachy is 'nodename'.
| [in] | node | a node |
| [in] | nodename | the name |
Definition at line 207 of file CAENXMLParser.c.
| int32_t c_xml_getcodefromnodechild | ( | const xmlNode * | node, |
| double * | code | ||
| ) |
Get value in 'node' first child, taking into account possible double or hexadecimal representation.
| [in] | node | a node |
| [out] | code | the value |
Definition at line 244 of file CAENXMLParser.c.
| int32_t c_xml_getcodefromnode | ( | const xmlNode * | node, |
| double * | code | ||
| ) |
Get value in 'node[/code]', taking into account possible double or hexadecimal representation.
| [in] | node | a node |
| [out] | code | the returned value |
Definition at line 270 of file CAENXMLParser.c.
| int32_t c_xml_getcodefromcodename | ( | const c_xmlfile_t * | file, |
| const char *__restrict | category, | ||
| const char *__restrict | codename, | ||
| double * | code | ||
| ) |
Looks for a node called '/Definitions/${category}/${codename}' to get its value converted to double. Both double and hexadecimal integer parsing are supported.
| [in] | file | the file |
| [in] | category | the category name |
| [in] | codename | the codename |
| [out] | code | the returned value |
Definition at line 293 of file CAENXMLParser.c.
| const char* c_xml_getattributevaluefromcodename | ( | const c_xmlfile_t * | file, |
| const char *__restrict | category, | ||
| const char *__restrict | codename, | ||
| const char *__restrict | attrname | ||
| ) |
Looks for a node called '/Definitions/${category}/${codename}' to get the attribute named 'attrname'.
| [in] | file | the file |
| [in] | category | the category name |
| [in] | codename | the codename |
| [in] | attrname | the atribute |
Definition at line 320 of file CAENXMLParser.c.
| c_fcnhandle_t c_xml_getfunctionpointerfromcodename | ( | const c_xmlfile_t * | file, |
| const char * | codename | ||
| ) |
Looks for a node called '/Definitions/XMLFunctions/${codename}' to dynamically load a function with name 'codename' from library specified by node's 'libname' attribute.
| [in] | file | the file |
| [in] | codename | the codename |
Definition at line 349 of file CAENXMLParser.c.
| int c_xml_snprintf | ( | xmlChar * | buf, |
| int | len, | ||
| const char * | msg, | ||
| ... | |||
| ) |
Wrapper to xmlStrPrintf().
| [out] | buf | the result buffer |
| [in] | len | the result buffer length |
| [in] | msg | the message with printf formatting |
| [in] | ... | extra parameters for the message |
Definition at line 401 of file CAENXMLParser.c.
| int c_xml_strlen | ( | const xmlChar * | str | ) |
Length of a xmlChar's string. Wrapper to xmlStrlen().
| [in] | str | the xmlChar array |
Definition at line 416 of file CAENXMLParser.c.
| const char* c_xml_parserversion | ( | void | ) |
Version of LibXML parser. Wrapper to xmlParserVersion.
Definition at line 420 of file CAENXMLParser.c.
| void c_xml_parsercleanup | ( | void | ) |
Cleanup of allocated resources. To be used when the module will not be used anymore. Wrapper to xmlCleanupParser(). Also close the libray, if some calls to c_xml_getfunctionpointerfromcodename() occurred.
Definition at line 388 of file CAENXMLParser.c.