Esempio n. 1
0
/****f* xml_element/xml_elem_free
 * NAME
 *   xml_elem_free
 * SYNOPSIS
 *   void xml_elem_free(xml_element* root)
 * FUNCTION
 *   free an xml element and all of its child elements
 * INPUTS
 *   root - the root of an xml tree you would like to free
 * RESULT
 *   void
 * NOTES
 * SEE ALSO
 *   xml_elem_free_non_recurse ()
 *   xml_elem_new ()
 * SOURCE
 */
void xml_elem_free(xml_element* root) {
   if(root) {
      xml_element* kids = Q_Head(&root->children);
      while(kids) {
         xml_elem_free(kids);
         kids = Q_Next(&root->children);
      }
      xml_elem_free_non_recurse(root);
   }
}
/****f* VALUE/XMLRPC_IntrospectionCreateDescription
 * NAME
 *   XMLRPC_IntrospectionCreateDescription
 * SYNOPSIS
 *   XMLRPC_VALUE XMLRPC_IntrospectionCreateDescription(const char* xml, XMLRPC_ERROR err)
 * FUNCTION
 *   converts raw xml describing types and methods into an
 *   XMLRPC_VALUE suitable for use with XMLRPC_ServerAddIntrospectionData()
 * INPUTS
 *   xml - xml data conforming to introspection spec at <url tbd>
 *   err - optional pointer to error struct. filled in if error occurs and not NULL.
 * RESULT
 *   XMLRPC_VALUE - newly created value, or NULL if fatal error.
 * BUGS
 *   Currently does little or no validation of xml.
 *   Only parse errors are currently reported in err, not structural errors.
 * SEE ALSO
 *   XMLRPC_ServerAddIntrospectionData ()
 * SOURCE
 */
XMLRPC_VALUE XMLRPC_IntrospectionCreateDescription(const char* xml, XMLRPC_ERROR err) {
   XMLRPC_VALUE xReturn = NULL;
   xml_element* root = xml_elem_parse_buf(xml, 0, 0, err ? &err->xml_elem_error : NULL);

   if(root) {
      xReturn = xml_element_to_method_description(root, err);

      xml_elem_free(root);
   }

   return xReturn;

}