//
// This code was generated by Enunciate.
// http://enunciate.codehaus.org/
//
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <libxml/xmlwriter.h>
#include <libxml/xmlreader.h>

#ifndef DEBUG_ENUNCIATE
#define DEBUG_ENUNCIATE 0
#endif

#ifndef ENUNCIATE_C_UTILITIES
#define ENUNCIATE_C_UTILITIES

/**
 * A basic xml node, used when (de)serializing unknown or "any" xml type.
 * We can't use the libxml xmlNodePtr because we can't reliably "free" it.
 */
struct xmlBasicNode {
  /**
   * The (local) name of the node.
   */
  xmlChar *name;

  /**
   * The namespace of the node.
   */
  xmlChar *ns;

  /**
   * The namespace prefix of the node.
   */
  xmlChar *prefix;

  /**
   * The (text) value of the node.
   */
  xmlChar *value;

  /**
   * The child elements of the node.
   */
  struct xmlBasicNode *child_elements;

  /**
   * The attributes of the node.
   */
  struct xmlBasicNode *attributes;

  /**
   * The next sibling (for a list of nodes).
   */
  struct xmlBasicNode *sibling;
};

/*******************xml utilities************************************/

static int xmlTextReaderAdvanceToNextStartOrEndElement(xmlTextReaderPtr reader) {
  int status = xmlTextReaderRead(reader);
  while (status && xmlTextReaderNodeType(reader) != XML_READER_TYPE_ELEMENT && xmlTextReaderNodeType(reader) != XML_READER_TYPE_END_ELEMENT) {
    status = xmlTextReaderRead(reader);
  }
  return status;
}

static int xmlTextReaderSkipElement(xmlTextReaderPtr reader) {
  int status = xmlTextReaderNext(reader);
  while (status && xmlTextReaderNodeType(reader) != XML_READER_TYPE_ELEMENT && xmlTextReaderNodeType(reader) != XML_READER_TYPE_END_ELEMENT) {
    status = xmlTextReaderRead(reader);
  }
  return status;
}

static xmlChar *xmlTextReaderReadEntireNodeValue(xmlTextReaderPtr reader) {
  xmlChar *buffer = calloc(1, sizeof(xmlChar));
  const xmlChar *snippet;
  int status;
  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ATTRIBUTE) {
    return xmlTextReaderValue(reader);
  }
  else if (xmlTextReaderIsEmptyElement(reader) == 0) {
    status = xmlTextReaderRead(reader);
    while (status && (xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT || xmlTextReaderNodeType(reader) == XML_READER_TYPE_CDATA || xmlTextReaderNodeType(reader) == XML_READER_TYPE_ENTITY_REFERENCE)) {
      snippet = xmlTextReaderConstValue(reader);
      buffer = realloc(buffer, (xmlStrlen(buffer) + xmlStrlen(snippet) + 1) * sizeof(xmlChar));
      xmlStrcat(buffer, snippet);
      status = xmlTextReaderRead(reader);
    }
  }
  return buffer;
}

/*******************base 64 utilities************************************/

/*
 * Base64 Translation Table as described in RFC1113.
 *
 * This code was graciously ripped from http://base64.sourceforge.net
 */
static const char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

/*
 * Base64 Translation Table to decode (created by author)
 *
 * This code was graciously ripped from http://base64.sourceforge.net
 */
static const char cd64[]="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq";

/*
 * encode 3 8-bit binary bytes as 4 '6-bit' characters
 *
 * This code was graciously ripped from http://base64.sourceforge.net
 *
 * @param in the block to encode
 * @param out the block to encode to
 * @param len the length of the 'in' block.
 */
static void _encode_base64_block(unsigned char in[3], unsigned char out[4], int len) {
  out[0] = cb64[ in[0] >> 2 ];
  out[1] = cb64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ];
  out[2] = (unsigned char) (len > 1 ? cb64[ ((in[1] & 0x0f) << 2) | ((in[2] & 0xc0) >> 6) ] : '=');
  out[3] = (unsigned char) (len > 2 ? cb64[ in[2] & 0x3f ] : '=');
}

/*
 * decode 4 '6-bit' characters into 3 8-bit binary bytes
 *
 * This code was graciously ripped from http://base64.sourceforge.net
 */
static void _decode_base64_block( unsigned char in[4], unsigned char out[3] )
{
    out[ 0 ] = (unsigned char ) (in[0] << 2 | in[1] >> 4);
    out[ 1 ] = (unsigned char ) (in[1] << 4 | in[2] >> 2);
    out[ 2 ] = (unsigned char ) (((in[2] << 6) & 0xc0) | in[3]);
}

/*
 * base64 encode a stream adding padding and line breaks as per spec.
 *
 * This code was graciously ripped from http://base64.sourceforge.net
 *
 * @param instream The stream to encode.
 * @param insize The size of the stream to encode.
 * @return The encoded string.
 */
xmlChar *_encode_base64(unsigned char *instream, int insize) {
  unsigned char in[3];
  unsigned char out[4];
  xmlChar *encoded;
  int i, in_index = 0, out_index = 0, blocklen;

  if (insize == 0) {
    return BAD_CAST "\0";
  }

  encoded = calloc(((insize / 3) * 4) + 10, sizeof(xmlChar));
  while (in_index <= insize) {
    blocklen = 0;
    for (i = 0; i < 3; i++) {
      in[i] = instream[in_index++];
      if (in_index <= insize) {
        blocklen++;
      }
      else {
        in[i] = 0;
      }
    }
    if (blocklen) {
      _encode_base64_block(in, out, blocklen);
      for( i = 0; i < 4; i++ ) {
        encoded[out_index++] = out[i];
      }
    }
  }

  return encoded;
}

/*
 * Decode a base64 encoded stream discarding padding, line breaks and noise
 *
 * This code was graciously ripped from http://base64.sourceforge.net
 *
 * @param invalue The string to decode.
 * @param outsize Holder for the length of the returned data.
 * @return The decoded data.
 */
unsigned char *_decode_base64( const xmlChar *invalue, int *outsize ) {
  xmlChar in[4];
  unsigned char out[3], v;
  int i, in_index = 0, out_index = 0, blocklen;
  unsigned char *outstream;

  if (invalue == NULL) {
    return NULL;
  }

  outstream = calloc(((xmlStrlen(invalue) / 4) * 3) + 1, sizeof(unsigned char));
  while (invalue[in_index] != '\0') {
    for (blocklen = 0, i = 0; i < 4 && invalue[in_index]; i++) {
      v = 0;
      while (invalue[in_index] != '\0' && v == 0) {
        v = (unsigned char) invalue[in_index++];
        v = (unsigned char) ((v < 43 || v > 122) ? 0 : cd64[ v - 43 ]);
        if (v) {
          v = (unsigned char) ((v == '$') ? 0 : v - 61);
        }
      }

      if (invalue[in_index] != '\0') {
        blocklen++;
        if (v) {
          in[i] = (unsigned char) (v - 1);
        }
      }
      else {
        in[i] = 0;
      }
    }

    if (blocklen) {
      _decode_base64_block( in, out );
      for( i = 0; i < blocklen - 1; i++ ) {
        outstream[out_index++] = out[i];
      }
    }
  }

  if (outsize != NULL) {
    *outsize = out_index;
  }

  return outstream;
}

#endif /* ENUNCIATE_C_UTILITIES */

#ifndef BASIC_XML_FUNCTIONS_Xs
#define BASIC_XML_FUNCTIONS_Xs

/*******************xs:boolean************************************/

/**
 * Read a boolean value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to 1 if "true" was read. pointer to 0 otherwise.
 */
static int *xmlTextReaderReadXsBooleanType(xmlTextReaderPtr reader) {
  xmlChar *nodeValue = xmlTextReaderReadEntireNodeValue(reader);
  int *value = malloc(sizeof(int));
  *value = (xmlStrcmp(BAD_CAST "true", nodeValue) == 0) ? 1 : 0;
  free(nodeValue);
  return value;
}

/**
 * Write a boolean value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsBooleanType(xmlTextWriterPtr writer, int *value) {
  if (*value) {
    return xmlTextWriterWriteString(writer, BAD_CAST "false");
  }
  else {
    return xmlTextWriterWriteString(writer, BAD_CAST "true");
  }
}

/**
 * Frees a boolean type from memory.
 *
 * @param value The value to free.
 */
static void freeXsBooleanType(int *value) {
  //no-op
}

/*******************xs:byte************************************/

/**
 * Read a byte value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the byte.
 */
static unsigned char *xmlTextReaderReadXsByteType(xmlTextReaderPtr reader) {
  xmlChar *nodeValue = xmlTextReaderReadEntireNodeValue(reader);
  unsigned char *value = malloc(sizeof(unsigned char));
  *value = (unsigned char) atoi((char *) nodeValue);
  free(nodeValue);
  return value;
}

/**
 * Write a byte value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsByteType(xmlTextWriterPtr writer, unsigned char *value) {
  return xmlTextWriterWriteFormatString(writer, "%i", *value);
}

/**
 * Frees a byte type from memory.
 *
 * @param value The value to free.
 */
static void freeXsByteType(unsigned char *value) {
  //no-op
}

/*******************xs:double************************************/

/**
 * Read a double value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the double.
 */
static double *xmlTextReaderReadXsDoubleType(xmlTextReaderPtr reader) {
  xmlChar *nodeValue = xmlTextReaderReadEntireNodeValue(reader);
  double *value = malloc(sizeof(double));
  *value = atof((char *) nodeValue);
  free(nodeValue);
  return value;
}

/**
 * Write a double value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsDoubleType(xmlTextWriterPtr writer, double *value) {
  return xmlTextWriterWriteFormatString(writer, "%f", *value);
}

/**
 * Frees a double type from memory.
 *
 * @param value The value to free.
 */
static void freeXsDoubleType(double *value) {
  //no-op
}

/*******************xs:float************************************/

/**
 * Read a float value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the float.
 */
static float *xmlTextReaderReadXsFloatType(xmlTextReaderPtr reader) {
  xmlChar *nodeValue = xmlTextReaderReadEntireNodeValue(reader);
  float *value = malloc(sizeof(float));
  *value = atof((char *)nodeValue);
  free(nodeValue);
  return value;
}

/**
 * Write a float value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsFloatType(xmlTextWriterPtr writer, float *value) {
  return xmlTextWriterWriteFormatString(writer, "%f", *value);
}

/**
 * Frees a float type from memory.
 *
 * @param value The value to free.
 */
static void freeXsFloatType(float *value) {
  //no-op
}

/*******************xs:int************************************/

/**
 * Read a int value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @param value The value to be written.
 * @return pointer to the int.
 */
static int *xmlTextReaderReadXsIntType(xmlTextReaderPtr reader) {
  xmlChar *nodeValue = xmlTextReaderReadEntireNodeValue(reader);
  int *value = malloc(sizeof(int));
  *value = atoi((char *)nodeValue);
  free(nodeValue);
  return value;
}

/**
 * Write a int value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsIntType(xmlTextWriterPtr writer, int *value) {
  return xmlTextWriterWriteFormatString(writer, "%i", *value);
}

/**
 * Frees a int type from memory.
 *
 * @param value The value to free.
 */
static void freeXsIntType(int *value) {
  //no-op
}

/*******************xs:long************************************/

/**
 * Read a long value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the long.
 */
static long *xmlTextReaderReadXsLongType(xmlTextReaderPtr reader) {
  xmlChar *nodeValue = xmlTextReaderReadEntireNodeValue(reader);
  long *value = malloc(sizeof(long));
  *value = atol((char *)nodeValue);
  free(nodeValue);
  return value;
}

/**
 * Write a long value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsLongType(xmlTextWriterPtr writer, long *value) {
  return xmlTextWriterWriteFormatString(writer, "%ld", *value);
}

/**
 * Frees a long type from memory.
 *
 * @param value The value to free.
 */
static void freeXsLongType(long *value) {
  //no-op
}

/*******************xs:short************************************/

/**
 * Read a short value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the short.
 */
static short *xmlTextReaderReadXsShortType(xmlTextReaderPtr reader) {
  xmlChar *nodeValue = xmlTextReaderReadEntireNodeValue(reader);
  short *value = malloc(sizeof(short));
  *value = atoi((char *)nodeValue);
  return value;
}

/**
 * Write a short value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsShortType(xmlTextWriterPtr writer, short *value) {
  return xmlTextWriterWriteFormatString(writer, "%hi", *value);
}

/**
 * Frees a short type from memory.
 *
 * @param value The value to free.
 */
static void freeXsShortType(short *value) {
  //no-op
}

/*******************xs:string************************************/

/**
 * Read a string value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the string.
 */
static xmlChar *xmlTextReaderReadXsStringType(xmlTextReaderPtr reader) {
  return xmlTextReaderReadEntireNodeValue(reader);
}

/**
 * Write a string value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsStringType(xmlTextWriterPtr writer, xmlChar *value) {
  return xmlTextWriterWriteString(writer, value);
}

/**
 * Frees a string type from memory.
 *
 * @param value The value to free.
 */
static void freeXsStringType(xmlChar *value) {
  //no-op
}

/*******************xs:ID************************************/

/**
 * Read a ID value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the ID.
 */
static xmlChar *xmlTextReaderReadXsIDType(xmlTextReaderPtr reader) {
  return xmlTextReaderReadXsStringType(reader);
}

/**
 * Write a ID value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsIDType(xmlTextWriterPtr writer, xmlChar *value) {
  return xmlTextWriterWriteString(writer, value);
}

/**
 * Frees a ID type from memory.
 *
 * @param value The value to free.
 */
static void freeXsIDType(xmlChar *value) {
  freeXsStringType(value);
}

/*******************xs:IDREF************************************/

/**
 * Read a IDREF value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the IDREF.
 */
static xmlChar *xmlTextReaderReadXsIDREFType(xmlTextReaderPtr reader) {
  return xmlTextReaderReadXsStringType(reader);
}

/**
 * Write a IDREF value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsIDREFType(xmlTextWriterPtr writer, xmlChar *value) {
  return xmlTextWriterWriteString(writer, value);
}

/**
 * Frees a IDREF type from memory.
 *
 * @param value The value to free.
 */
static void freeXsIDREFType(xmlChar *value) {
  freeXsStringType(value);
}

/*******************xs:integer************************************/

/**
 * Read a (big) integer value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the integer.
 */
static xmlChar *xmlTextReaderReadXsIntegerType(xmlTextReaderPtr reader) {
  return xmlTextReaderReadXsStringType(reader);
}

/**
 * Write a integer value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsIntegerType(xmlTextWriterPtr writer, xmlChar *value) {
  return xmlTextWriterWriteString(writer, value);
}

/**
 * Frees a integer type from memory.
 *
 * @param value The value to free.
 */
static void freeXsIntegerType(xmlChar *value) {
  freeXsStringType(value);
}

/*******************xs:decimal************************************/

/**
 * Read a (big) decimal value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the decimal.
 */
static xmlChar *xmlTextReaderReadXsDecimalType(xmlTextReaderPtr reader) {
  return xmlTextReaderReadXsStringType(reader);
}

/**
 * Write a decimal value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsDecimalType(xmlTextWriterPtr writer, xmlChar *value) {
  return xmlTextWriterWriteString(writer, value);
}

/**
 * Frees a decimal type from memory.
 *
 * @param value The value to free.
 */
static void freeXsDecimalType(xmlChar *value) {
  freeXsStringType(value);
}

/*******************xs:duration************************************/

/**
 * Read a duration value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the duration.
 */
static xmlChar *xmlTextReaderReadXsDurationType(xmlTextReaderPtr reader) {
  return xmlTextReaderReadXsStringType(reader);
}

/**
 * Write a duration value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsDurationType(xmlTextWriterPtr writer, xmlChar *value) {
  return xmlTextWriterWriteString(writer, value);
}

/**
 * Frees a duration type from memory.
 *
 * @param value The value to free.
 */
static void freeXsDurationType(xmlChar *value) {
  freeXsStringType(value);
}

/*******************xs:QName************************************/

/**
 * Read a QName value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the QName.
 */
static xmlChar *xmlTextReaderReadXsQNameType(xmlTextReaderPtr reader) {
  return xmlTextReaderReadXsStringType(reader);
}

/**
 * Write a QName value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsQNameType(xmlTextWriterPtr writer, xmlChar *value) {
  return xmlTextWriterWriteString(writer, value);
}

/**
 * Frees a QName type from memory.
 *
 * @param value The value to free.
 */
static void freeXsQNameType(xmlChar *value) {
  freeXsStringType(value);
}

/*******************xs:anyURI************************************/

/**
 * Read a anyURI value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the anyURI.
 */
static xmlChar *xmlTextReaderReadXsAnyURIType(xmlTextReaderPtr reader) {
  return xmlTextReaderReadXsStringType(reader);
}

/**
 * Write a anyURI value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsAnyURIType(xmlTextWriterPtr writer, xmlChar *value) {
  return xmlTextWriterWriteString(writer, value);
}

/**
 * Frees a anyURI type from memory.
 *
 * @param value The value to free.
 */
static void freeXsAnyURIType(xmlChar *value) {
  freeXsStringType(value);
}

/*******************xs:dateTime************************************/

/**
 * Read a dateTime value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the dateTime.
 */
static struct tm *xmlTextReaderReadXsDateTimeType(xmlTextReaderPtr reader) {
  struct tm * time = calloc(1, sizeof(struct tm));
  xmlChar *timevalue = xmlTextReaderReadEntireNodeValue(reader);
  int success = 0, index = 0, token_index = 0, len = xmlStrlen(timevalue), offset_hours = 0, offset_min = 0;
  char token[len];

  //date time format: yyyy-mm-ddThh:MM:ss+oo:oo
  //go to first '-' character.
  token_index = 0;
  while (index < len && timevalue[index] != '-') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_year = atoi(token) - 1900;
  if (token_index > 0) {
    success++; //assume 'year' was successfully read.
    index++;
  }

  //go to next '-' character.
  token_index = 0;
  while (index < len && timevalue[index] != '-') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_mon = atoi(token) - 1;
  if (token_index > 0) {
    success++; //assume 'month' was successfully read.
    index++;
  }

  //go to 'T' character.
  token_index = 0;
  while (index < len && timevalue[index] != 'T') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_mday = atoi(token);
  if (token_index > 0) {
    success++; //assume 'day' was successfully read.
    index++;
  }

  //go to ':' character.
  token_index = 0;
  while (index < len && timevalue[index] != ':') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_hour = atoi(token);
  if (token_index > 0) {
    success++; //assume 'hour' was successfully read.
    index++;
  }

  //go to ':' character.
  token_index = 0;
  while (index < len && timevalue[index] != ':') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_min = atoi(token);
  if (token_index > 0) {
    success++; //assume 'minutes' was successfully read.
    index++;
  }

  //go to '+' or '-' character.
  token_index = 0;
  while (index < len && timevalue[index] != '+' && timevalue[index] != '-') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_sec = atof(token);
  if (token_index > 0) {
    success++; //assume 'seconds' was successfully read.
    if (timevalue[index] == '+') {
      index++;
    }
  }

  //go to ':' character.
  token_index = 0;
  while (index < len && timevalue[index] != ':') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  offset_hours = atoi(token);
  if (token_index > 0) {
    success++; //assume gmt offset hours was successfully read.
    index++;
  }

  //go to end.
  token_index = 0;
  while (index < len) {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  offset_min = atoi(token);
  if (token_index > 0) {
    success++; //assume gmt offset minutes was successfully read.
    index++;
  }
  time->tm_gmtoff = ((offset_hours * 60) + offset_min) * 60;

  free(timevalue);
  return time;
}

/**
 * Write a dateTime value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsDateTimeType(xmlTextWriterPtr writer, struct tm *value) {
  return xmlTextWriterWriteFormatString(writer, "%04i-%02i-%02iT%02i:%02i:%02i.000%+03i:%02i", value->tm_year + 1900, value->tm_mon + 1, value->tm_mday, value->tm_hour, value->tm_min, value->tm_sec, (int) (value->tm_gmtoff / 3600), (int) ((value->tm_gmtoff / 60) % 60));
}

/**
 * Frees a dateTime type from memory.
 *
 * @param value The value to free.
 */
static void freeXsDateTimeType(struct tm *value) {
  //no-op
}

/*******************xs:time************************************/

/**
 * Read a time value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the time.
 */
static struct tm *xmlTextReaderReadXsTimeType(xmlTextReaderPtr reader) {
  struct tm * time = calloc(1, sizeof(struct tm));
  xmlChar *timevalue = xmlTextReaderReadEntireNodeValue(reader);
  int success = 0, index = 0, token_index = 0, len = xmlStrlen(timevalue), offset_hours = 0, offset_min = 0;
  char token[len];

  //date time format: hh:MM:ss+oo:oo
  //go to ':' character.
  token_index = 0;
  while (index < len && timevalue[index] != ':') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_hour = atoi(token);
  if (token_index > 0) {
    success++; //assume 'hour' was successfully read.
    index++;
  }

  //go to ':' character.
  token_index = 0;
  while (index < len && timevalue[index] != ':') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_min = atoi(token);
  if (token_index > 0) {
    success++; //assume 'minutes' was successfully read.
    index++;
  }

  //go to '+' or '-' character.
  token_index = 0;
  while (index < len && timevalue[index] != '+' && timevalue[index] != '-') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_sec = atof(token);
  if (token_index > 0) {
    success++; //assume 'seconds' was successfully read.
    if (timevalue[index] == '+') {
      index++;
    }
  }

  //go to ':' character.
  token_index = 0;
  while (index < len && timevalue[index] != ':') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  offset_hours = atoi(token);
  if (token_index > 0) {
    success++; //assume gmt offset hours was successfully read.
    index++;
  }

  //go to end.
  token_index = 0;
  while (index < len) {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  offset_min = atoi(token);
  if (token_index > 0) {
    success++; //assume gmt offset minutes was successfully read.
    index++;
  }
  time->tm_gmtoff = ((offset_hours * 60) + offset_min) * 60;

  free(timevalue);
  return time;
}

/**
 * Write a time value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsTimeType(xmlTextWriterPtr writer, struct tm *value) {
  return xmlTextWriterWriteFormatString(writer, "%02i:%02i:%02i.000%+03i:%02i", value->tm_hour, value->tm_min, value->tm_sec, (int) (value->tm_gmtoff / 3600), (int) ((value->tm_gmtoff / 60) % 60));
}

/**
 * Frees a time type from memory.
 *
 * @param value The value to free.
 */
static void freeXsTimeType(struct tm *value) {
  //no-op
}

/*******************xs:date************************************/

/**
 * Read a date value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the date.
 */
static struct tm *xmlTextReaderReadXsDateType(xmlTextReaderPtr reader) {
  struct tm * time = calloc(1, sizeof(struct tm));
  xmlChar *timevalue = xmlTextReaderReadEntireNodeValue(reader);
  int success = 0, index = 0, token_index = 0, len = xmlStrlen(timevalue), offset_hours = 0, offset_min = 0;
  char token[len];

  //date time format: yyyy-mm-dd+oo:oo
  //go to first '-' character.
  token_index = 0;
  while (index < len && timevalue[index] != '-') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_year = atoi(token) - 1900;
  if (token_index > 0) {
    success++; //assume 'year' was successfully read.
    index++;
  }

  //go to next '-' character.
  token_index = 0;
  while (index < len && timevalue[index] != '-') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_mon = atoi(token) - 1;
  if (token_index > 0) {
    success++; //assume 'month' was successfully read.
    index++;
  }

  //go to '+' or '-' character.
  token_index = 0;
  while (index < len && timevalue[index] != '+' && timevalue[index] != '-') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  time->tm_sec = atof(token);
  if (token_index > 0) {
    success++; //assume 'seconds' was successfully read.
    if (timevalue[index] == '+') {
      index++;
    }
  }

  //go to ':' character.
  token_index = 0;
  while (index < len && timevalue[index] != ':') {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  offset_hours = atoi(token);
  if (token_index > 0) {
    success++; //assume gmt offset hours was successfully read.
    index++;
  }

  //go to end.
  token_index = 0;
  while (index < len) {
    token[token_index++] = timevalue[index++];
  }
  token[token_index] = '\n';
  offset_min = atoi(token);
  if (token_index > 0) {
    success++; //assume gmt offset minutes was successfully read.
    index++;
  }
  time->tm_gmtoff = ((offset_hours * 60) + offset_min) * 60;

  free(timevalue);
  return time;
}

/**
 * Write a date value to the writer.
 *
 * @param writer The writer.
 * @param value The value to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsDateType(xmlTextWriterPtr writer, struct tm *value) {
  return xmlTextWriterWriteFormatString(writer, "%04i-%02i-%02i%+03i:%02i", value->tm_year + 1900, value->tm_mon + 1, value->tm_mday, (int) (value->tm_gmtoff / 3600), (int) ((value->tm_gmtoff / 60) % 60));
}

/**
 * Frees a date type from memory.
 *
 * @param value The value to free.
 */
static void freeXsDateType(struct tm *value) {
  //no-op
}

/*******************xs:anyType************************************/

/**
 * Frees a anyType type from memory.
 *
 * @param node The node to free.
 */
static void freeXsAnyTypeType(struct xmlBasicNode *node) {
  if (node->attributes != NULL) {
    freeXsAnyTypeType(node->attributes);
  }
  if (node->value != NULL) {
    free(node->value);
  }
  if (node->child_elements != NULL) {
    freeXsAnyTypeType(node->child_elements);
  }
  if (node->name != NULL) {
    free(node->name);
  }
  if (node->prefix != NULL) {
    free(node->prefix);
  }
  if (node->ns != NULL) {
    free(node->ns);
  }
  if (node->sibling != NULL) {
    freeXsAnyTypeType(node->sibling);
    free(node->sibling);
  }
}

/**
 * Read a anyType value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the anyType., or NULL if error.
 */
static struct xmlBasicNode *xmlTextReaderReadXsAnyTypeType(xmlTextReaderPtr reader) {
  struct xmlBasicNode *child, *next, *node = calloc(1, sizeof(struct xmlBasicNode));
  int status, depth = xmlTextReaderDepth(reader);
  const xmlChar *text;

  node->name = xmlTextReaderLocalName(reader);
  node->ns = xmlTextReaderNamespaceUri(reader);
  node->prefix = xmlTextReaderPrefix(reader);

  if (xmlTextReaderHasAttributes(reader)) {
    child = NULL;
    while (xmlTextReaderMoveToNextAttribute(reader)) {
      next = calloc(1, sizeof(struct xmlBasicNode));
      if (child == NULL) {
        node->attributes = next;
      }
      else {
        child->sibling = next;
      }
      child = next;
      child->name = xmlTextReaderLocalName(reader);
      child->ns = xmlTextReaderNamespaceUri(reader);
      child->prefix = xmlTextReaderPrefix(reader);
      child->value = xmlTextReaderValue(reader);
    }

    status = xmlTextReaderMoveToElement(reader);
    if (status < 1) {
      //panic: unable to return to the element node.
      freeXsAnyTypeType(node);
      free(node);
      return NULL;
    }
  }

  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    status = xmlTextReaderRead(reader);
    while (status == 1 && xmlTextReaderDepth(reader) > depth) {
      switch (xmlTextReaderNodeType(reader)) {
        case XML_READER_TYPE_ELEMENT:
          child = xmlTextReaderReadXsAnyTypeType(reader);
          if (child == NULL) {
            //panic: xml read error
            freeXsAnyTypeType(node);
            free(node);
            return NULL;
          }

          next = node->child_elements;
          if (next == NULL) {
            node->child_elements = child;
          }
          else {
            while (1) {
              if (next->sibling == NULL) {
                next->sibling = child;
                break;
              }
              next = next->sibling;
            }
          }

          break;
        case XML_READER_TYPE_TEXT:
        case XML_READER_TYPE_CDATA:
          text = xmlTextReaderConstValue(reader);
          node->value = xmlStrncat(node->value, text, xmlStrlen(text));
          break;
        default:
          //skip anything else.
          break;
      }

      status = xmlTextReaderRead(reader);
    }

    if (status < 1) {
      //panic: xml read error
      freeXsAnyTypeType(node);
      free(node);
      return NULL;
    }
  }

  return node;
}

/**
 * Write a anyType value to the writer.
 *
 * @param writer The writer.
 * @param node The node to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsAnyTypeType(xmlTextWriterPtr writer, struct xmlBasicNode *node) {
  int status;
  int totalBytes = 0;
  struct xmlBasicNode *next;

  status = xmlTextWriterStartElementNS(writer, node->prefix, node->name, node->ns);
  if (status < 0) {
    return status;
  }
  totalBytes += status;

  next = node->attributes;
  while (next != NULL) {
    status = xmlTextWriterWriteAttributeNS(writer, next->prefix, next->name, next->ns, next->value);
    if (status < 0) {
      return status;
    }
    totalBytes += status;
    next = next->sibling;
  }

  if (node->value != NULL) {
    status = xmlTextWriterWriteString(writer, node->value);
    if (status < 0) {
      //panic: xml write error
      return status;
    }
    totalBytes += status;
  }

  next = node->child_elements;
  while (next != NULL) {
    status = xmlTextWriterWriteXsAnyTypeType(writer, next);
    if (status < 0) {
      return status;
    }
    totalBytes += status;
    next = next->sibling;
  }

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Read a anyType element value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the anyType., or NULL if error.
 */
static struct xmlBasicNode *xmlTextReaderReadXsAnyTypeElement(xmlTextReaderPtr reader) {
  return xmlTextReaderReadXsAnyTypeType(reader);
}

/**
 * Write a anyType element value to the writer.
 *
 * @param writer The writer.
 * @param node The node to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsAnyTypeElement(xmlTextWriterPtr writer, struct xmlBasicNode *node) {
  return xmlTextWriterWriteXsAnyTypeType(writer, node);
}

/**
 * Write a anyType element value to the writer.
 *
 * @param writer The writer.
 * @param node The node to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsAnyTypeElementNS(xmlTextWriterPtr writer, struct xmlBasicNode *node, int writeNamespaces) {
  return xmlTextWriterWriteXsAnyTypeType(writer, node);
}

/**
 * Free a anyType element value.
 *
 * @param node The node.
 */
static void freeXsAnyTypeElement(struct xmlBasicNode *node) {
  freeXsAnyTypeType(node);
}

/*******************xs:anySimpleType************************************/

/**
 * Frees a anyType type from memory.
 *
 * @param node The node to free.
 */
static void freeXsAnySimpleTypeType(struct xmlBasicNode *node) {
  freeXsAnyTypeType(node);
}

/**
 * Read a anyType value from the reader.
 *
 * @param reader The reader (pointing at a node with a value).
 * @return pointer to the anyType., or NULL if error.
 */
static struct xmlBasicNode *xmlTextReaderReadXsAnySimpleTypeType(xmlTextReaderPtr reader) {
  struct xmlBasicNode *node = calloc(1, sizeof(struct xmlBasicNode));

  node->name = xmlTextReaderLocalName(reader);
  node->ns = xmlTextReaderNamespaceUri(reader);
  node->prefix = xmlTextReaderPrefix(reader);
  node->value = xmlTextReaderReadEntireNodeValue(reader);

  return node;
}

/**
 * Write a anyType value to the writer.
 *
 * @param writer The writer.
 * @param node The node to be written.
 * @return the bytes written (may be 0 because of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteXsAnySimpleTypeType(xmlTextWriterPtr writer, struct xmlBasicNode *node) {
  if (node->value != NULL) {
    return xmlTextWriterWriteXsStringType(writer, node->value);
  }

  return 0;
}

#endif /* BASIC_XML_FUNCTIONS_Xs */

#ifndef DEF_agentrank_ns0_agents_H
#define DEF_agentrank_ns0_agents_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_agents {


  /**
   * agent list
   */
  struct agentrank_ns0_agent *agent;

  /**
   * Size of the agent array.
   */
  int _sizeof_agent;
};

/**
 * Reads a Agents element from XML. The element to be read is "agents", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Agents, or NULL in case of error.
 */
struct agentrank_ns0_agents *xml_read_agentrank_ns0_agents(xmlTextReaderPtr reader);

/**
 * Writes a Agents to XML under element name "agents".
 *
 * @param writer The XML writer.
 * @param _agents The Agents to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_agents(xmlTextWriterPtr writer, struct agentrank_ns0_agents *_agents);

/**
 * Frees a Agents.
 *
 * @param _agents The Agents to free.
 */
void free_agentrank_ns0_agents(struct agentrank_ns0_agents *_agents);

/**
 * Reads a Agents element from XML. The element to be read is "agents", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Agents, or NULL in case of error.
 */
struct agentrank_ns0_agents *xmlTextReaderReadNs0AgentsElement(xmlTextReaderPtr reader);

/**
 * Writes a Agents to XML under element name "agents".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _agents The Agents to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0AgentsElement(xmlTextWriterPtr writer, struct agentrank_ns0_agents *_agents);

/**
 * Writes a Agents to XML under element name "agents".
 *
 * @param writer The XML writer.
 * @param _agents The Agents to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0AgentsElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_agents *_agents, int writeNamespaces);

/**
 * Frees the children of a Agents.
 *
 * @param _agents The Agents whose children are to be free.
 */
static void freeNs0AgentsElement(struct agentrank_ns0_agents *_agents);

/**
 * Reads a Agents from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Agents, or NULL in case of error.
 */
static struct agentrank_ns0_agents *xmlTextReaderReadNs0AgentsType(xmlTextReaderPtr reader);

/**
 * Writes a Agents to XML.
 *
 * @param writer The XML writer.
 * @param _agents The Agents to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0AgentsType(xmlTextWriterPtr writer, struct agentrank_ns0_agents *_agents);

/**
 * Frees the elements of a Agents.
 *
 * @param _agents The Agents to free.
 */
static void freeNs0AgentsType(struct agentrank_ns0_agents *_agents);

#endif /* DEF_agentrank_ns0_agents_H */
#ifndef DEF_agentrank_ns0_contactAgent_H
#define DEF_agentrank_ns0_contactAgent_H

/**
 *  User: marc Date: Oct 1, 2009 Time: 5:26:25 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_contactAgent {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_status *status;
};

/**
 * Reads a ContactAgent element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The ContactAgent, or NULL in case of error.
 */
struct agentrank_ns0_contactAgent *xml_read_agentrank_ns0_contactAgent(xmlTextReaderPtr reader);

/**
 * Writes a ContactAgent to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _contactAgent The ContactAgent to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_contactAgent(xmlTextWriterPtr writer, struct agentrank_ns0_contactAgent *_contactAgent);

/**
 * Frees a ContactAgent.
 *
 * @param _contactAgent The ContactAgent to free.
 */
void free_agentrank_ns0_contactAgent(struct agentrank_ns0_contactAgent *_contactAgent);

/**
 * Reads a ContactAgent element from XML. The element to be read is "response", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The ContactAgent, or NULL in case of error.
 */
struct agentrank_ns0_contactAgent *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader);

/**
 * Writes a ContactAgent to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _contactAgent The ContactAgent to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_contactAgent *_contactAgent);

/**
 * Writes a ContactAgent to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _contactAgent The ContactAgent to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_contactAgent *_contactAgent, int writeNamespaces);

/**
 * Frees the children of a ContactAgent.
 *
 * @param _contactAgent The ContactAgent whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_contactAgent *_contactAgent);

/**
 * Reads a ContactAgent from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The ContactAgent, or NULL in case of error.
 */
static struct agentrank_ns0_contactAgent *xmlTextReaderReadNs0ContactAgentType(xmlTextReaderPtr reader);

/**
 * Writes a ContactAgent to XML.
 *
 * @param writer The XML writer.
 * @param _contactAgent The ContactAgent to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ContactAgentType(xmlTextWriterPtr writer, struct agentrank_ns0_contactAgent *_contactAgent);

/**
 * Frees the elements of a ContactAgent.
 *
 * @param _contactAgent The ContactAgent to free.
 */
static void freeNs0ContactAgentType(struct agentrank_ns0_contactAgent *_contactAgent);

#endif /* DEF_agentrank_ns0_contactAgent_H */
#ifndef DEF_agentrank_ns0_findAgents_H
#define DEF_agentrank_ns0_findAgents_H

/**
 *  User: marc Date: Oct 1, 2009 Time: 5:26:25 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_findAgents {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_agents *agent;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_status *status;
};

/**
 * Reads a FindAgents element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The FindAgents, or NULL in case of error.
 */
struct agentrank_ns0_findAgents *xml_read_agentrank_ns0_findAgents(xmlTextReaderPtr reader);

/**
 * Writes a FindAgents to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _findAgents The FindAgents to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_findAgents(xmlTextWriterPtr writer, struct agentrank_ns0_findAgents *_findAgents);

/**
 * Frees a FindAgents.
 *
 * @param _findAgents The FindAgents to free.
 */
void free_agentrank_ns0_findAgents(struct agentrank_ns0_findAgents *_findAgents);

/**
 * Reads a FindAgents element from XML. The element to be read is "response", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The FindAgents, or NULL in case of error.
 */
struct agentrank_ns0_findAgents *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader);

/**
 * Writes a FindAgents to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _findAgents The FindAgents to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_findAgents *_findAgents);

/**
 * Writes a FindAgents to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _findAgents The FindAgents to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_findAgents *_findAgents, int writeNamespaces);

/**
 * Frees the children of a FindAgents.
 *
 * @param _findAgents The FindAgents whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_findAgents *_findAgents);

/**
 * Reads a FindAgents from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The FindAgents, or NULL in case of error.
 */
static struct agentrank_ns0_findAgents *xmlTextReaderReadNs0FindAgentsType(xmlTextReaderPtr reader);

/**
 * Writes a FindAgents to XML.
 *
 * @param writer The XML writer.
 * @param _findAgents The FindAgents to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0FindAgentsType(xmlTextWriterPtr writer, struct agentrank_ns0_findAgents *_findAgents);

/**
 * Frees the elements of a FindAgents.
 *
 * @param _findAgents The FindAgents to free.
 */
static void freeNs0FindAgentsType(struct agentrank_ns0_findAgents *_findAgents);

#endif /* DEF_agentrank_ns0_findAgents_H */
#ifndef DEF_agentrank_ns0_findProfiles_H
#define DEF_agentrank_ns0_findProfiles_H

/**
 *  User: marc Date: Oct 1, 2009 Time: 5:26:25 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_findProfiles {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_status *status;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_profiles *profiles;
};

/**
 * Reads a FindProfiles element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The FindProfiles, or NULL in case of error.
 */
struct agentrank_ns0_findProfiles *xml_read_agentrank_ns0_findProfiles(xmlTextReaderPtr reader);

/**
 * Writes a FindProfiles to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _findProfiles The FindProfiles to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_findProfiles(xmlTextWriterPtr writer, struct agentrank_ns0_findProfiles *_findProfiles);

/**
 * Frees a FindProfiles.
 *
 * @param _findProfiles The FindProfiles to free.
 */
void free_agentrank_ns0_findProfiles(struct agentrank_ns0_findProfiles *_findProfiles);

/**
 * Reads a FindProfiles element from XML. The element to be read is "response", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The FindProfiles, or NULL in case of error.
 */
struct agentrank_ns0_findProfiles *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader);

/**
 * Writes a FindProfiles to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _findProfiles The FindProfiles to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_findProfiles *_findProfiles);

/**
 * Writes a FindProfiles to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _findProfiles The FindProfiles to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_findProfiles *_findProfiles, int writeNamespaces);

/**
 * Frees the children of a FindProfiles.
 *
 * @param _findProfiles The FindProfiles whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_findProfiles *_findProfiles);

/**
 * Reads a FindProfiles from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The FindProfiles, or NULL in case of error.
 */
static struct agentrank_ns0_findProfiles *xmlTextReaderReadNs0FindProfilesType(xmlTextReaderPtr reader);

/**
 * Writes a FindProfiles to XML.
 *
 * @param writer The XML writer.
 * @param _findProfiles The FindProfiles to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0FindProfilesType(xmlTextWriterPtr writer, struct agentrank_ns0_findProfiles *_findProfiles);

/**
 * Frees the elements of a FindProfiles.
 *
 * @param _findProfiles The FindProfiles to free.
 */
static void freeNs0FindProfilesType(struct agentrank_ns0_findProfiles *_findProfiles);

#endif /* DEF_agentrank_ns0_findProfiles_H */
#ifndef DEF_agentrank_ns0_forecasting_H
#define DEF_agentrank_ns0_forecasting_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_forecasting {


  /**
   * chart image
   */
  struct agentrank_ns0_image *image;

  /**
   * forecasts
   */
  struct agentrank_ns0_forecasts *forecasts;
};

/**
 * Reads a Forecasting element from XML. The element to be read is "forecasting", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Forecasting, or NULL in case of error.
 */
struct agentrank_ns0_forecasting *xml_read_agentrank_ns0_forecasting(xmlTextReaderPtr reader);

/**
 * Writes a Forecasting to XML under element name "forecasting".
 *
 * @param writer The XML writer.
 * @param _forecasting The Forecasting to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_forecasting(xmlTextWriterPtr writer, struct agentrank_ns0_forecasting *_forecasting);

/**
 * Frees a Forecasting.
 *
 * @param _forecasting The Forecasting to free.
 */
void free_agentrank_ns0_forecasting(struct agentrank_ns0_forecasting *_forecasting);

/**
 * Reads a Forecasting element from XML. The element to be read is "forecasting", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Forecasting, or NULL in case of error.
 */
struct agentrank_ns0_forecasting *xmlTextReaderReadNs0ForecastingElement(xmlTextReaderPtr reader);

/**
 * Writes a Forecasting to XML under element name "forecasting".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _forecasting The Forecasting to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ForecastingElement(xmlTextWriterPtr writer, struct agentrank_ns0_forecasting *_forecasting);

/**
 * Writes a Forecasting to XML under element name "forecasting".
 *
 * @param writer The XML writer.
 * @param _forecasting The Forecasting to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ForecastingElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_forecasting *_forecasting, int writeNamespaces);

/**
 * Frees the children of a Forecasting.
 *
 * @param _forecasting The Forecasting whose children are to be free.
 */
static void freeNs0ForecastingElement(struct agentrank_ns0_forecasting *_forecasting);

/**
 * Reads a Forecasting from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Forecasting, or NULL in case of error.
 */
static struct agentrank_ns0_forecasting *xmlTextReaderReadNs0ForecastingType(xmlTextReaderPtr reader);

/**
 * Writes a Forecasting to XML.
 *
 * @param writer The XML writer.
 * @param _forecasting The Forecasting to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ForecastingType(xmlTextWriterPtr writer, struct agentrank_ns0_forecasting *_forecasting);

/**
 * Frees the elements of a Forecasting.
 *
 * @param _forecasting The Forecasting to free.
 */
static void freeNs0ForecastingType(struct agentrank_ns0_forecasting *_forecasting);

#endif /* DEF_agentrank_ns0_forecasting_H */
#ifndef DEF_agentrank_ns0_getAgent_H
#define DEF_agentrank_ns0_getAgent_H

/**
 *  User: marc Date: Oct 1, 2009 Time: 5:26:25 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_getAgent {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_agent *agent;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_status *status;
};

/**
 * Reads a GetAgent element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetAgent, or NULL in case of error.
 */
struct agentrank_ns0_getAgent *xml_read_agentrank_ns0_getAgent(xmlTextReaderPtr reader);

/**
 * Writes a GetAgent to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getAgent The GetAgent to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_getAgent(xmlTextWriterPtr writer, struct agentrank_ns0_getAgent *_getAgent);

/**
 * Frees a GetAgent.
 *
 * @param _getAgent The GetAgent to free.
 */
void free_agentrank_ns0_getAgent(struct agentrank_ns0_getAgent *_getAgent);

/**
 * Reads a GetAgent element from XML. The element to be read is "response", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The GetAgent, or NULL in case of error.
 */
struct agentrank_ns0_getAgent *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader);

/**
 * Writes a GetAgent to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getAgent The GetAgent to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getAgent *_getAgent);

/**
 * Writes a GetAgent to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getAgent The GetAgent to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getAgent *_getAgent, int writeNamespaces);

/**
 * Frees the children of a GetAgent.
 *
 * @param _getAgent The GetAgent whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getAgent *_getAgent);

/**
 * Reads a GetAgent from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The GetAgent, or NULL in case of error.
 */
static struct agentrank_ns0_getAgent *xmlTextReaderReadNs0GetAgentType(xmlTextReaderPtr reader);

/**
 * Writes a GetAgent to XML.
 *
 * @param writer The XML writer.
 * @param _getAgent The GetAgent to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0GetAgentType(xmlTextWriterPtr writer, struct agentrank_ns0_getAgent *_getAgent);

/**
 * Frees the elements of a GetAgent.
 *
 * @param _getAgent The GetAgent to free.
 */
static void freeNs0GetAgentType(struct agentrank_ns0_getAgent *_getAgent);

#endif /* DEF_agentrank_ns0_getAgent_H */
#ifndef DEF_agentrank_ns0_getForecasting_H
#define DEF_agentrank_ns0_getForecasting_H

/**
 *  User: marc Date: Oct 1, 2009 Time: 5:26:25 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_getForecasting {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_forecasting *forecasting;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_status *status;
};

/**
 * Reads a GetForecasting element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetForecasting, or NULL in case of error.
 */
struct agentrank_ns0_getForecasting *xml_read_agentrank_ns0_getForecasting(xmlTextReaderPtr reader);

/**
 * Writes a GetForecasting to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getForecasting The GetForecasting to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_getForecasting(xmlTextWriterPtr writer, struct agentrank_ns0_getForecasting *_getForecasting);

/**
 * Frees a GetForecasting.
 *
 * @param _getForecasting The GetForecasting to free.
 */
void free_agentrank_ns0_getForecasting(struct agentrank_ns0_getForecasting *_getForecasting);

/**
 * Reads a GetForecasting element from XML. The element to be read is "response", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The GetForecasting, or NULL in case of error.
 */
struct agentrank_ns0_getForecasting *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader);

/**
 * Writes a GetForecasting to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getForecasting The GetForecasting to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getForecasting *_getForecasting);

/**
 * Writes a GetForecasting to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getForecasting The GetForecasting to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getForecasting *_getForecasting, int writeNamespaces);

/**
 * Frees the children of a GetForecasting.
 *
 * @param _getForecasting The GetForecasting whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getForecasting *_getForecasting);

/**
 * Reads a GetForecasting from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The GetForecasting, or NULL in case of error.
 */
static struct agentrank_ns0_getForecasting *xmlTextReaderReadNs0GetForecastingType(xmlTextReaderPtr reader);

/**
 * Writes a GetForecasting to XML.
 *
 * @param writer The XML writer.
 * @param _getForecasting The GetForecasting to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0GetForecastingType(xmlTextWriterPtr writer, struct agentrank_ns0_getForecasting *_getForecasting);

/**
 * Frees the elements of a GetForecasting.
 *
 * @param _getForecasting The GetForecasting to free.
 */
static void freeNs0GetForecastingType(struct agentrank_ns0_getForecasting *_getForecasting);

#endif /* DEF_agentrank_ns0_getForecasting_H */
#ifndef DEF_agentrank_ns0_getMarket_H
#define DEF_agentrank_ns0_getMarket_H

/**
 *  User: marc Date: Oct 1, 2009 Time: 5:26:25 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_getMarket {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_market *market;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_status *status;
};

/**
 * Reads a GetMarket element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetMarket, or NULL in case of error.
 */
struct agentrank_ns0_getMarket *xml_read_agentrank_ns0_getMarket(xmlTextReaderPtr reader);

/**
 * Writes a GetMarket to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getMarket The GetMarket to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_getMarket(xmlTextWriterPtr writer, struct agentrank_ns0_getMarket *_getMarket);

/**
 * Frees a GetMarket.
 *
 * @param _getMarket The GetMarket to free.
 */
void free_agentrank_ns0_getMarket(struct agentrank_ns0_getMarket *_getMarket);

/**
 * Reads a GetMarket element from XML. The element to be read is "response", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The GetMarket, or NULL in case of error.
 */
struct agentrank_ns0_getMarket *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader);

/**
 * Writes a GetMarket to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getMarket The GetMarket to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getMarket *_getMarket);

/**
 * Writes a GetMarket to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getMarket The GetMarket to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getMarket *_getMarket, int writeNamespaces);

/**
 * Frees the children of a GetMarket.
 *
 * @param _getMarket The GetMarket whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getMarket *_getMarket);

/**
 * Reads a GetMarket from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The GetMarket, or NULL in case of error.
 */
static struct agentrank_ns0_getMarket *xmlTextReaderReadNs0GetMarketType(xmlTextReaderPtr reader);

/**
 * Writes a GetMarket to XML.
 *
 * @param writer The XML writer.
 * @param _getMarket The GetMarket to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0GetMarketType(xmlTextWriterPtr writer, struct agentrank_ns0_getMarket *_getMarket);

/**
 * Frees the elements of a GetMarket.
 *
 * @param _getMarket The GetMarket to free.
 */
static void freeNs0GetMarketType(struct agentrank_ns0_getMarket *_getMarket);

#endif /* DEF_agentrank_ns0_getMarket_H */
#ifndef DEF_agentrank_ns0_getProfile_H
#define DEF_agentrank_ns0_getProfile_H

/**
 *  User: marc Date: Oct 1, 2009 Time: 5:26:25 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_getProfile {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_status *status;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_profile *profile;
};

/**
 * Reads a GetProfile element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetProfile, or NULL in case of error.
 */
struct agentrank_ns0_getProfile *xml_read_agentrank_ns0_getProfile(xmlTextReaderPtr reader);

/**
 * Writes a GetProfile to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getProfile The GetProfile to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_getProfile(xmlTextWriterPtr writer, struct agentrank_ns0_getProfile *_getProfile);

/**
 * Frees a GetProfile.
 *
 * @param _getProfile The GetProfile to free.
 */
void free_agentrank_ns0_getProfile(struct agentrank_ns0_getProfile *_getProfile);

/**
 * Reads a GetProfile element from XML. The element to be read is "response", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The GetProfile, or NULL in case of error.
 */
struct agentrank_ns0_getProfile *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader);

/**
 * Writes a GetProfile to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getProfile The GetProfile to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getProfile *_getProfile);

/**
 * Writes a GetProfile to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getProfile The GetProfile to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getProfile *_getProfile, int writeNamespaces);

/**
 * Frees the children of a GetProfile.
 *
 * @param _getProfile The GetProfile whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getProfile *_getProfile);

/**
 * Reads a GetProfile from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The GetProfile, or NULL in case of error.
 */
static struct agentrank_ns0_getProfile *xmlTextReaderReadNs0GetProfileType(xmlTextReaderPtr reader);

/**
 * Writes a GetProfile to XML.
 *
 * @param writer The XML writer.
 * @param _getProfile The GetProfile to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0GetProfileType(xmlTextWriterPtr writer, struct agentrank_ns0_getProfile *_getProfile);

/**
 * Frees the elements of a GetProfile.
 *
 * @param _getProfile The GetProfile to free.
 */
static void freeNs0GetProfileType(struct agentrank_ns0_getProfile *_getProfile);

#endif /* DEF_agentrank_ns0_getProfile_H */
#ifndef DEF_agentrank_ns0_getReviews_H
#define DEF_agentrank_ns0_getReviews_H

/**
 *  User: marc Date: Oct 1, 2009 Time: 5:26:25 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_getReviews {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_status *status;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_reviews *reviews;
};

/**
 * Reads a GetReviews element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetReviews, or NULL in case of error.
 */
struct agentrank_ns0_getReviews *xml_read_agentrank_ns0_getReviews(xmlTextReaderPtr reader);

/**
 * Writes a GetReviews to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getReviews The GetReviews to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_getReviews(xmlTextWriterPtr writer, struct agentrank_ns0_getReviews *_getReviews);

/**
 * Frees a GetReviews.
 *
 * @param _getReviews The GetReviews to free.
 */
void free_agentrank_ns0_getReviews(struct agentrank_ns0_getReviews *_getReviews);

/**
 * Reads a GetReviews element from XML. The element to be read is "response", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The GetReviews, or NULL in case of error.
 */
struct agentrank_ns0_getReviews *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader);

/**
 * Writes a GetReviews to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getReviews The GetReviews to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getReviews *_getReviews);

/**
 * Writes a GetReviews to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getReviews The GetReviews to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getReviews *_getReviews, int writeNamespaces);

/**
 * Frees the children of a GetReviews.
 *
 * @param _getReviews The GetReviews whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getReviews *_getReviews);

/**
 * Reads a GetReviews from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The GetReviews, or NULL in case of error.
 */
static struct agentrank_ns0_getReviews *xmlTextReaderReadNs0GetReviewsType(xmlTextReaderPtr reader);

/**
 * Writes a GetReviews to XML.
 *
 * @param writer The XML writer.
 * @param _getReviews The GetReviews to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0GetReviewsType(xmlTextWriterPtr writer, struct agentrank_ns0_getReviews *_getReviews);

/**
 * Frees the elements of a GetReviews.
 *
 * @param _getReviews The GetReviews to free.
 */
static void freeNs0GetReviewsType(struct agentrank_ns0_getReviews *_getReviews);

#endif /* DEF_agentrank_ns0_getReviews_H */
#ifndef DEF_agentrank_ns0_getSales_H
#define DEF_agentrank_ns0_getSales_H

/**
 *  User: marc Date: Oct 1, 2009 Time: 5:26:25 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_getSales {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_sales *sales;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_status *status;
};

/**
 * Reads a GetSales element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetSales, or NULL in case of error.
 */
struct agentrank_ns0_getSales *xml_read_agentrank_ns0_getSales(xmlTextReaderPtr reader);

/**
 * Writes a GetSales to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getSales The GetSales to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_getSales(xmlTextWriterPtr writer, struct agentrank_ns0_getSales *_getSales);

/**
 * Frees a GetSales.
 *
 * @param _getSales The GetSales to free.
 */
void free_agentrank_ns0_getSales(struct agentrank_ns0_getSales *_getSales);

/**
 * Reads a GetSales element from XML. The element to be read is "response", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The GetSales, or NULL in case of error.
 */
struct agentrank_ns0_getSales *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader);

/**
 * Writes a GetSales to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getSales The GetSales to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getSales *_getSales);

/**
 * Writes a GetSales to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getSales The GetSales to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getSales *_getSales, int writeNamespaces);

/**
 * Frees the children of a GetSales.
 *
 * @param _getSales The GetSales whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getSales *_getSales);

/**
 * Reads a GetSales from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The GetSales, or NULL in case of error.
 */
static struct agentrank_ns0_getSales *xmlTextReaderReadNs0GetSalesType(xmlTextReaderPtr reader);

/**
 * Writes a GetSales to XML.
 *
 * @param writer The XML writer.
 * @param _getSales The GetSales to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0GetSalesType(xmlTextWriterPtr writer, struct agentrank_ns0_getSales *_getSales);

/**
 * Frees the elements of a GetSales.
 *
 * @param _getSales The GetSales to free.
 */
static void freeNs0GetSalesType(struct agentrank_ns0_getSales *_getSales);

#endif /* DEF_agentrank_ns0_getSales_H */
#ifndef DEF_agentrank_ns0_histories_H
#define DEF_agentrank_ns0_histories_H

/**
 *  User: marc
 Date: Apr 25, 2009
 Time: 2:40:22 PM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC
 MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO TECHNOLOGIES.

 */
struct agentrank_ns0_histories {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_history *history;

  /**
   * Size of the history array.
   */
  int _sizeof_history;
};

/**
 * Reads a Histories from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Histories, or NULL in case of error.
 */
static struct agentrank_ns0_histories *xmlTextReaderReadNs0HistoriesType(xmlTextReaderPtr reader);

/**
 * Writes a Histories to XML.
 *
 * @param writer The XML writer.
 * @param _histories The Histories to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0HistoriesType(xmlTextWriterPtr writer, struct agentrank_ns0_histories *_histories);

/**
 * Frees the elements of a Histories.
 *
 * @param _histories The Histories to free.
 */
static void freeNs0HistoriesType(struct agentrank_ns0_histories *_histories);

#endif /* DEF_agentrank_ns0_histories_H */
#ifndef DEF_agentrank_ns0_history_H
#define DEF_agentrank_ns0_history_H

/**
 *  User: marc
 Date: Apr 25, 2009
 Time: 2:40:38 PM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC
 MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO TECHNOLOGIES.

 */
struct agentrank_ns0_history {


  /**
   * (no documentation provided)
   */
  struct tm *date;

  /**
   * (no documentation provided)
   */
  xmlChar *market;

  /**
   * (no documentation provided)
   */
  xmlChar *metric;

  /**
   * (no documentation provided)
   */
  xmlChar *value;
};

/**
 * Reads a History from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The History, or NULL in case of error.
 */
static struct agentrank_ns0_history *xmlTextReaderReadNs0HistoryType(xmlTextReaderPtr reader);

/**
 * Writes a History to XML.
 *
 * @param writer The XML writer.
 * @param _history The History to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0HistoryType(xmlTextWriterPtr writer, struct agentrank_ns0_history *_history);

/**
 * Frees the elements of a History.
 *
 * @param _history The History to free.
 */
static void freeNs0HistoryType(struct agentrank_ns0_history *_history);

#endif /* DEF_agentrank_ns0_history_H */
#ifndef DEF_agentrank_ns0_location_H
#define DEF_agentrank_ns0_location_H

/**
 *  User: marc
 Date: Mar 4, 2008
 Time: 6:39:03 PM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC
 MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO TECHNOLOGIES.

 */
struct agentrank_ns0_location {


  /**
   * (no documentation provided)
   */
  int id;

  /**
   * (no documentation provided)
   */
  xmlChar *type;

  /**
   * (no documentation provided)
   */
  xmlChar *name;
};

/**
 * Reads a Location from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Location, or NULL in case of error.
 */
static struct agentrank_ns0_location *xmlTextReaderReadNs0LocationType(xmlTextReaderPtr reader);

/**
 * Writes a Location to XML.
 *
 * @param writer The XML writer.
 * @param _location The Location to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0LocationType(xmlTextWriterPtr writer, struct agentrank_ns0_location *_location);

/**
 * Frees the elements of a Location.
 *
 * @param _location The Location to free.
 */
static void freeNs0LocationType(struct agentrank_ns0_location *_location);

#endif /* DEF_agentrank_ns0_location_H */
#ifndef DEF_agentrank_ns0_locations_H
#define DEF_agentrank_ns0_locations_H

/**
 *  User: marc
 Date: Mar 4, 2008
 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC
 MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO TECHNOLOGIES.

 */
struct agentrank_ns0_locations {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_location *location;

  /**
   * Size of the location array.
   */
  int _sizeof_location;
};

/**
 * Reads a Locations element from XML. The element to be read is "locations", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Locations, or NULL in case of error.
 */
struct agentrank_ns0_locations *xml_read_agentrank_ns0_locations(xmlTextReaderPtr reader);

/**
 * Writes a Locations to XML under element name "locations".
 *
 * @param writer The XML writer.
 * @param _locations The Locations to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_locations(xmlTextWriterPtr writer, struct agentrank_ns0_locations *_locations);

/**
 * Frees a Locations.
 *
 * @param _locations The Locations to free.
 */
void free_agentrank_ns0_locations(struct agentrank_ns0_locations *_locations);

/**
 * Reads a Locations element from XML. The element to be read is "locations", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Locations, or NULL in case of error.
 */
struct agentrank_ns0_locations *xmlTextReaderReadNs0LocationsElement(xmlTextReaderPtr reader);

/**
 * Writes a Locations to XML under element name "locations".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _locations The Locations to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0LocationsElement(xmlTextWriterPtr writer, struct agentrank_ns0_locations *_locations);

/**
 * Writes a Locations to XML under element name "locations".
 *
 * @param writer The XML writer.
 * @param _locations The Locations to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0LocationsElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_locations *_locations, int writeNamespaces);

/**
 * Frees the children of a Locations.
 *
 * @param _locations The Locations whose children are to be free.
 */
static void freeNs0LocationsElement(struct agentrank_ns0_locations *_locations);

/**
 * Reads a Locations from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Locations, or NULL in case of error.
 */
static struct agentrank_ns0_locations *xmlTextReaderReadNs0LocationsType(xmlTextReaderPtr reader);

/**
 * Writes a Locations to XML.
 *
 * @param writer The XML writer.
 * @param _locations The Locations to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0LocationsType(xmlTextWriterPtr writer, struct agentrank_ns0_locations *_locations);

/**
 * Frees the elements of a Locations.
 *
 * @param _locations The Locations to free.
 */
static void freeNs0LocationsType(struct agentrank_ns0_locations *_locations);

#endif /* DEF_agentrank_ns0_locations_H */
#ifndef DEF_agentrank_ns0_market_H
#define DEF_agentrank_ns0_market_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_market {


  /**
   * market's canonical name
   */
  xmlChar *name;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_histories *histories;

  /**
   * collection of forecasts
   */
  struct agentrank_ns0_forecasts *forecasts;
};

/**
 * Reads a Market element from XML. The element to be read is "market", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Market, or NULL in case of error.
 */
struct agentrank_ns0_market *xml_read_agentrank_ns0_market(xmlTextReaderPtr reader);

/**
 * Writes a Market to XML under element name "market".
 *
 * @param writer The XML writer.
 * @param _market The Market to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_market(xmlTextWriterPtr writer, struct agentrank_ns0_market *_market);

/**
 * Frees a Market.
 *
 * @param _market The Market to free.
 */
void free_agentrank_ns0_market(struct agentrank_ns0_market *_market);

/**
 * Reads a Market element from XML. The element to be read is "market", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Market, or NULL in case of error.
 */
struct agentrank_ns0_market *xmlTextReaderReadNs0MarketElement(xmlTextReaderPtr reader);

/**
 * Writes a Market to XML under element name "market".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _market The Market to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0MarketElement(xmlTextWriterPtr writer, struct agentrank_ns0_market *_market);

/**
 * Writes a Market to XML under element name "market".
 *
 * @param writer The XML writer.
 * @param _market The Market to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0MarketElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_market *_market, int writeNamespaces);

/**
 * Frees the children of a Market.
 *
 * @param _market The Market whose children are to be free.
 */
static void freeNs0MarketElement(struct agentrank_ns0_market *_market);

/**
 * Reads a Market from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Market, or NULL in case of error.
 */
static struct agentrank_ns0_market *xmlTextReaderReadNs0MarketType(xmlTextReaderPtr reader);

/**
 * Writes a Market to XML.
 *
 * @param writer The XML writer.
 * @param _market The Market to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0MarketType(xmlTextWriterPtr writer, struct agentrank_ns0_market *_market);

/**
 * Frees the elements of a Market.
 *
 * @param _market The Market to free.
 */
static void freeNs0MarketType(struct agentrank_ns0_market *_market);

#endif /* DEF_agentrank_ns0_market_H */
#ifndef DEF_agentrank_ns0_photoSize_H
#define DEF_agentrank_ns0_photoSize_H

/**
 *  User: marc
 Date: Mar 4, 2008
 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC
 MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO TECHNOLOGIES.

 */
struct agentrank_ns0_photoSize {


  /**
   * (no documentation provided)
   */
  int height;

  /**
   * (no documentation provided)
   */
  int width;

  /**
   * (no documentation provided)
   */
  xmlChar *type;
};

/**
 * Reads a PhotoSize element from XML. The element to be read is "photoSize", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The PhotoSize, or NULL in case of error.
 */
struct agentrank_ns0_photoSize *xml_read_agentrank_ns0_photoSize(xmlTextReaderPtr reader);

/**
 * Writes a PhotoSize to XML under element name "photoSize".
 *
 * @param writer The XML writer.
 * @param _photoSize The PhotoSize to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_photoSize(xmlTextWriterPtr writer, struct agentrank_ns0_photoSize *_photoSize);

/**
 * Frees a PhotoSize.
 *
 * @param _photoSize The PhotoSize to free.
 */
void free_agentrank_ns0_photoSize(struct agentrank_ns0_photoSize *_photoSize);

/**
 * Reads a PhotoSize element from XML. The element to be read is "photoSize", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The PhotoSize, or NULL in case of error.
 */
struct agentrank_ns0_photoSize *xmlTextReaderReadNs0PhotoSizeElement(xmlTextReaderPtr reader);

/**
 * Writes a PhotoSize to XML under element name "photoSize".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _photoSize The PhotoSize to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0PhotoSizeElement(xmlTextWriterPtr writer, struct agentrank_ns0_photoSize *_photoSize);

/**
 * Writes a PhotoSize to XML under element name "photoSize".
 *
 * @param writer The XML writer.
 * @param _photoSize The PhotoSize to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0PhotoSizeElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_photoSize *_photoSize, int writeNamespaces);

/**
 * Frees the children of a PhotoSize.
 *
 * @param _photoSize The PhotoSize whose children are to be free.
 */
static void freeNs0PhotoSizeElement(struct agentrank_ns0_photoSize *_photoSize);

/**
 * Reads a PhotoSize from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The PhotoSize, or NULL in case of error.
 */
static struct agentrank_ns0_photoSize *xmlTextReaderReadNs0PhotoSizeType(xmlTextReaderPtr reader);

/**
 * Writes a PhotoSize to XML.
 *
 * @param writer The XML writer.
 * @param _photoSize The PhotoSize to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0PhotoSizeType(xmlTextWriterPtr writer, struct agentrank_ns0_photoSize *_photoSize);

/**
 * Frees the elements of a PhotoSize.
 *
 * @param _photoSize The PhotoSize to free.
 */
static void freeNs0PhotoSizeType(struct agentrank_ns0_photoSize *_photoSize);

#endif /* DEF_agentrank_ns0_photoSize_H */
#ifndef DEF_agentrank_ns0_photoSizes_H
#define DEF_agentrank_ns0_photoSizes_H

/**
 *  User: marc
 Date: Mar 4, 2008
 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC
 MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO TECHNOLOGIES.

 */
struct agentrank_ns0_photoSizes {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_photoSize *size;

  /**
   * Size of the size array.
   */
  int _sizeof_size;
};

/**
 * Reads a PhotoSizes element from XML. The element to be read is "photoSizes", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The PhotoSizes, or NULL in case of error.
 */
struct agentrank_ns0_photoSizes *xml_read_agentrank_ns0_photoSizes(xmlTextReaderPtr reader);

/**
 * Writes a PhotoSizes to XML under element name "photoSizes".
 *
 * @param writer The XML writer.
 * @param _photoSizes The PhotoSizes to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_photoSizes(xmlTextWriterPtr writer, struct agentrank_ns0_photoSizes *_photoSizes);

/**
 * Frees a PhotoSizes.
 *
 * @param _photoSizes The PhotoSizes to free.
 */
void free_agentrank_ns0_photoSizes(struct agentrank_ns0_photoSizes *_photoSizes);

/**
 * Reads a PhotoSizes element from XML. The element to be read is "photoSizes", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The PhotoSizes, or NULL in case of error.
 */
struct agentrank_ns0_photoSizes *xmlTextReaderReadNs0PhotoSizesElement(xmlTextReaderPtr reader);

/**
 * Writes a PhotoSizes to XML under element name "photoSizes".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _photoSizes The PhotoSizes to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0PhotoSizesElement(xmlTextWriterPtr writer, struct agentrank_ns0_photoSizes *_photoSizes);

/**
 * Writes a PhotoSizes to XML under element name "photoSizes".
 *
 * @param writer The XML writer.
 * @param _photoSizes The PhotoSizes to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0PhotoSizesElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_photoSizes *_photoSizes, int writeNamespaces);

/**
 * Frees the children of a PhotoSizes.
 *
 * @param _photoSizes The PhotoSizes whose children are to be free.
 */
static void freeNs0PhotoSizesElement(struct agentrank_ns0_photoSizes *_photoSizes);

/**
 * Reads a PhotoSizes from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The PhotoSizes, or NULL in case of error.
 */
static struct agentrank_ns0_photoSizes *xmlTextReaderReadNs0PhotoSizesType(xmlTextReaderPtr reader);

/**
 * Writes a PhotoSizes to XML.
 *
 * @param writer The XML writer.
 * @param _photoSizes The PhotoSizes to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0PhotoSizesType(xmlTextWriterPtr writer, struct agentrank_ns0_photoSizes *_photoSizes);

/**
 * Frees the elements of a PhotoSizes.
 *
 * @param _photoSizes The PhotoSizes to free.
 */
static void freeNs0PhotoSizesType(struct agentrank_ns0_photoSizes *_photoSizes);

#endif /* DEF_agentrank_ns0_photoSizes_H */
#ifndef DEF_agentrank_ns0_agent_H
#define DEF_agentrank_ns0_agent_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_agent {


  /**
   * (no documentation provided)
   */
  xmlChar *id;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_sales *sales;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_profile *profile;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_reviews *reviews;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_forecasts *forecasts;
};

/**
 * Reads a Agent element from XML. The element to be read is "agent", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Agent, or NULL in case of error.
 */
struct agentrank_ns0_agent *xml_read_agentrank_ns0_agent(xmlTextReaderPtr reader);

/**
 * Writes a Agent to XML under element name "agent".
 *
 * @param writer The XML writer.
 * @param _agent The Agent to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_agent(xmlTextWriterPtr writer, struct agentrank_ns0_agent *_agent);

/**
 * Frees a Agent.
 *
 * @param _agent The Agent to free.
 */
void free_agentrank_ns0_agent(struct agentrank_ns0_agent *_agent);

/**
 * Reads a Agent element from XML. The element to be read is "agent", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Agent, or NULL in case of error.
 */
struct agentrank_ns0_agent *xmlTextReaderReadNs0AgentElement(xmlTextReaderPtr reader);

/**
 * Writes a Agent to XML under element name "agent".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _agent The Agent to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0AgentElement(xmlTextWriterPtr writer, struct agentrank_ns0_agent *_agent);

/**
 * Writes a Agent to XML under element name "agent".
 *
 * @param writer The XML writer.
 * @param _agent The Agent to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0AgentElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_agent *_agent, int writeNamespaces);

/**
 * Frees the children of a Agent.
 *
 * @param _agent The Agent whose children are to be free.
 */
static void freeNs0AgentElement(struct agentrank_ns0_agent *_agent);

/**
 * Reads a Agent from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Agent, or NULL in case of error.
 */
static struct agentrank_ns0_agent *xmlTextReaderReadNs0AgentType(xmlTextReaderPtr reader);

/**
 * Writes a Agent to XML.
 *
 * @param writer The XML writer.
 * @param _agent The Agent to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0AgentType(xmlTextWriterPtr writer, struct agentrank_ns0_agent *_agent);

/**
 * Frees the elements of a Agent.
 *
 * @param _agent The Agent to free.
 */
static void freeNs0AgentType(struct agentrank_ns0_agent *_agent);

#endif /* DEF_agentrank_ns0_agent_H */
#ifndef DEF_agentrank_ns0_forecast_H
#define DEF_agentrank_ns0_forecast_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_forecast {


  /**
   * attribution link
   */
  struct agentrank_ns0_link *link;

  /**
   * future date
   */
  struct tm *date;

  /**
   * market name
   */
  xmlChar *market;

  /**
   * (no documentation provided)
   */
  xmlChar *metric;

  /**
   * (no documentation provided)
   */
  xmlChar *spot;

  /**
   * (no documentation provided)
   */
  xmlChar *future;
};

/**
 * Reads a Forecast element from XML. The element to be read is "forecast", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Forecast, or NULL in case of error.
 */
struct agentrank_ns0_forecast *xml_read_agentrank_ns0_forecast(xmlTextReaderPtr reader);

/**
 * Writes a Forecast to XML under element name "forecast".
 *
 * @param writer The XML writer.
 * @param _forecast The Forecast to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_forecast(xmlTextWriterPtr writer, struct agentrank_ns0_forecast *_forecast);

/**
 * Frees a Forecast.
 *
 * @param _forecast The Forecast to free.
 */
void free_agentrank_ns0_forecast(struct agentrank_ns0_forecast *_forecast);

/**
 * Reads a Forecast element from XML. The element to be read is "forecast", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Forecast, or NULL in case of error.
 */
struct agentrank_ns0_forecast *xmlTextReaderReadNs0ForecastElement(xmlTextReaderPtr reader);

/**
 * Writes a Forecast to XML under element name "forecast".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _forecast The Forecast to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ForecastElement(xmlTextWriterPtr writer, struct agentrank_ns0_forecast *_forecast);

/**
 * Writes a Forecast to XML under element name "forecast".
 *
 * @param writer The XML writer.
 * @param _forecast The Forecast to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ForecastElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_forecast *_forecast, int writeNamespaces);

/**
 * Frees the children of a Forecast.
 *
 * @param _forecast The Forecast whose children are to be free.
 */
static void freeNs0ForecastElement(struct agentrank_ns0_forecast *_forecast);

/**
 * Reads a Forecast from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Forecast, or NULL in case of error.
 */
static struct agentrank_ns0_forecast *xmlTextReaderReadNs0ForecastType(xmlTextReaderPtr reader);

/**
 * Writes a Forecast to XML.
 *
 * @param writer The XML writer.
 * @param _forecast The Forecast to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ForecastType(xmlTextWriterPtr writer, struct agentrank_ns0_forecast *_forecast);

/**
 * Frees the elements of a Forecast.
 *
 * @param _forecast The Forecast to free.
 */
static void freeNs0ForecastType(struct agentrank_ns0_forecast *_forecast);

#endif /* DEF_agentrank_ns0_forecast_H */
#ifndef DEF_agentrank_ns0_forecasts_H
#define DEF_agentrank_ns0_forecasts_H

/**
 *  A root element for a collection of forecasts.  The underlying data source can be either the forecasts of an individual agent or the aggregate forecasts of multiple agents.
 <p/>
 User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_forecasts {


  /**
   * total number of forecasts
   */
  int *total;

  /**
   * list
   */
  struct agentrank_ns0_forecast *forecast;

  /**
   * Size of the forecast array.
   */
  int _sizeof_forecast;
};

/**
 * Reads a Forecasts element from XML. The element to be read is "forecasts", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Forecasts, or NULL in case of error.
 */
struct agentrank_ns0_forecasts *xml_read_agentrank_ns0_forecasts(xmlTextReaderPtr reader);

/**
 * Writes a Forecasts to XML under element name "forecasts".
 *
 * @param writer The XML writer.
 * @param _forecasts The Forecasts to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_forecasts(xmlTextWriterPtr writer, struct agentrank_ns0_forecasts *_forecasts);

/**
 * Frees a Forecasts.
 *
 * @param _forecasts The Forecasts to free.
 */
void free_agentrank_ns0_forecasts(struct agentrank_ns0_forecasts *_forecasts);

/**
 * Reads a Forecasts element from XML. The element to be read is "forecasts", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Forecasts, or NULL in case of error.
 */
struct agentrank_ns0_forecasts *xmlTextReaderReadNs0ForecastsElement(xmlTextReaderPtr reader);

/**
 * Writes a Forecasts to XML under element name "forecasts".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _forecasts The Forecasts to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ForecastsElement(xmlTextWriterPtr writer, struct agentrank_ns0_forecasts *_forecasts);

/**
 * Writes a Forecasts to XML under element name "forecasts".
 *
 * @param writer The XML writer.
 * @param _forecasts The Forecasts to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ForecastsElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_forecasts *_forecasts, int writeNamespaces);

/**
 * Frees the children of a Forecasts.
 *
 * @param _forecasts The Forecasts whose children are to be free.
 */
static void freeNs0ForecastsElement(struct agentrank_ns0_forecasts *_forecasts);

/**
 * Reads a Forecasts from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Forecasts, or NULL in case of error.
 */
static struct agentrank_ns0_forecasts *xmlTextReaderReadNs0ForecastsType(xmlTextReaderPtr reader);

/**
 * Writes a Forecasts to XML.
 *
 * @param writer The XML writer.
 * @param _forecasts The Forecasts to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ForecastsType(xmlTextWriterPtr writer, struct agentrank_ns0_forecasts *_forecasts);

/**
 * Frees the elements of a Forecasts.
 *
 * @param _forecasts The Forecasts to free.
 */
static void freeNs0ForecastsType(struct agentrank_ns0_forecasts *_forecasts);

#endif /* DEF_agentrank_ns0_forecasts_H */
#ifndef DEF_agentrank_ns0_profile_H
#define DEF_agentrank_ns0_profile_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_profile {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_link *link;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_image *photo;

  /**
   * (no documentation provided)
   */
  float experience;

  /**
   * (no documentation provided)
   */
  xmlChar *full_name;

  /**
   * (no documentation provided)
   */
  int *agentrank;

  /**
   * (no documentation provided)
   */
  xmlChar *description;
};

/**
 * Reads a Profile element from XML. The element to be read is "profile", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Profile, or NULL in case of error.
 */
struct agentrank_ns0_profile *xml_read_agentrank_ns0_profile(xmlTextReaderPtr reader);

/**
 * Writes a Profile to XML under element name "profile".
 *
 * @param writer The XML writer.
 * @param _profile The Profile to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_profile(xmlTextWriterPtr writer, struct agentrank_ns0_profile *_profile);

/**
 * Frees a Profile.
 *
 * @param _profile The Profile to free.
 */
void free_agentrank_ns0_profile(struct agentrank_ns0_profile *_profile);

/**
 * Reads a Profile element from XML. The element to be read is "profile", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Profile, or NULL in case of error.
 */
struct agentrank_ns0_profile *xmlTextReaderReadNs0ProfileElement(xmlTextReaderPtr reader);

/**
 * Writes a Profile to XML under element name "profile".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _profile The Profile to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ProfileElement(xmlTextWriterPtr writer, struct agentrank_ns0_profile *_profile);

/**
 * Writes a Profile to XML under element name "profile".
 *
 * @param writer The XML writer.
 * @param _profile The Profile to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ProfileElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_profile *_profile, int writeNamespaces);

/**
 * Frees the children of a Profile.
 *
 * @param _profile The Profile whose children are to be free.
 */
static void freeNs0ProfileElement(struct agentrank_ns0_profile *_profile);

/**
 * Reads a Profile from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Profile, or NULL in case of error.
 */
static struct agentrank_ns0_profile *xmlTextReaderReadNs0ProfileType(xmlTextReaderPtr reader);

/**
 * Writes a Profile to XML.
 *
 * @param writer The XML writer.
 * @param _profile The Profile to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ProfileType(xmlTextWriterPtr writer, struct agentrank_ns0_profile *_profile);

/**
 * Frees the elements of a Profile.
 *
 * @param _profile The Profile to free.
 */
static void freeNs0ProfileType(struct agentrank_ns0_profile *_profile);

#endif /* DEF_agentrank_ns0_profile_H */
#ifndef DEF_agentrank_ns0_profiles_H
#define DEF_agentrank_ns0_profiles_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_profiles {


  /**
   * list of profiles
   */
  struct agentrank_ns0_profile *profile;

  /**
   * Size of the profile array.
   */
  int _sizeof_profile;
};

/**
 * Reads a Profiles element from XML. The element to be read is "profiles", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Profiles, or NULL in case of error.
 */
struct agentrank_ns0_profiles *xml_read_agentrank_ns0_profiles(xmlTextReaderPtr reader);

/**
 * Writes a Profiles to XML under element name "profiles".
 *
 * @param writer The XML writer.
 * @param _profiles The Profiles to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_profiles(xmlTextWriterPtr writer, struct agentrank_ns0_profiles *_profiles);

/**
 * Frees a Profiles.
 *
 * @param _profiles The Profiles to free.
 */
void free_agentrank_ns0_profiles(struct agentrank_ns0_profiles *_profiles);

/**
 * Reads a Profiles element from XML. The element to be read is "profiles", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Profiles, or NULL in case of error.
 */
struct agentrank_ns0_profiles *xmlTextReaderReadNs0ProfilesElement(xmlTextReaderPtr reader);

/**
 * Writes a Profiles to XML under element name "profiles".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _profiles The Profiles to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ProfilesElement(xmlTextWriterPtr writer, struct agentrank_ns0_profiles *_profiles);

/**
 * Writes a Profiles to XML under element name "profiles".
 *
 * @param writer The XML writer.
 * @param _profiles The Profiles to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ProfilesElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_profiles *_profiles, int writeNamespaces);

/**
 * Frees the children of a Profiles.
 *
 * @param _profiles The Profiles whose children are to be free.
 */
static void freeNs0ProfilesElement(struct agentrank_ns0_profiles *_profiles);

/**
 * Reads a Profiles from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Profiles, or NULL in case of error.
 */
static struct agentrank_ns0_profiles *xmlTextReaderReadNs0ProfilesType(xmlTextReaderPtr reader);

/**
 * Writes a Profiles to XML.
 *
 * @param writer The XML writer.
 * @param _profiles The Profiles to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ProfilesType(xmlTextWriterPtr writer, struct agentrank_ns0_profiles *_profiles);

/**
 * Frees the elements of a Profiles.
 *
 * @param _profiles The Profiles to free.
 */
static void freeNs0ProfilesType(struct agentrank_ns0_profiles *_profiles);

#endif /* DEF_agentrank_ns0_profiles_H */
#ifndef DEF_agentrank_ns0_sale_H
#define DEF_agentrank_ns0_sale_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_sale {


  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_link *link;

  /**
   * (no documentation provided)
   */
  xmlChar *zip;

  /**
   * (no documentation provided)
   */
  xmlChar *city;

  /**
   * (no documentation provided)
   */
  xmlChar *state;

  /**
   * (no documentation provided)
   */
  xmlChar *address;

  /**
   * (no documentation provided)
   */
  xmlChar *precision;

  /**
   * (no documentation provided)
   */
  xmlChar *property_type;

  /**
   * (no documentation provided)
   */
  xmlChar *transaction_side;

  /**
   * (no documentation provided)
   */
  int *market_days;

  /**
   * (no documentation provided)
   */
  xmlChar *latitude;

  /**
   * (no documentation provided)
   */
  xmlChar *longitude;

  /**
   * (no documentation provided)
   */
  xmlChar *list_price_final;

  /**
   * (no documentation provided)
   */
  xmlChar *sale_price_final;

  /**
   * (no documentation provided)
   */
  xmlChar *list_price_original;

  /**
   * (no documentation provided)
   */
  xmlChar *price_per_size_unit;
};

/**
 * Reads a Sale element from XML. The element to be read is "sale", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Sale, or NULL in case of error.
 */
struct agentrank_ns0_sale *xml_read_agentrank_ns0_sale(xmlTextReaderPtr reader);

/**
 * Writes a Sale to XML under element name "sale".
 *
 * @param writer The XML writer.
 * @param _sale The Sale to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_sale(xmlTextWriterPtr writer, struct agentrank_ns0_sale *_sale);

/**
 * Frees a Sale.
 *
 * @param _sale The Sale to free.
 */
void free_agentrank_ns0_sale(struct agentrank_ns0_sale *_sale);

/**
 * Reads a Sale element from XML. The element to be read is "sale", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Sale, or NULL in case of error.
 */
struct agentrank_ns0_sale *xmlTextReaderReadNs0SaleElement(xmlTextReaderPtr reader);

/**
 * Writes a Sale to XML under element name "sale".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _sale The Sale to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0SaleElement(xmlTextWriterPtr writer, struct agentrank_ns0_sale *_sale);

/**
 * Writes a Sale to XML under element name "sale".
 *
 * @param writer The XML writer.
 * @param _sale The Sale to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0SaleElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_sale *_sale, int writeNamespaces);

/**
 * Frees the children of a Sale.
 *
 * @param _sale The Sale whose children are to be free.
 */
static void freeNs0SaleElement(struct agentrank_ns0_sale *_sale);

/**
 * Reads a Sale from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Sale, or NULL in case of error.
 */
static struct agentrank_ns0_sale *xmlTextReaderReadNs0SaleType(xmlTextReaderPtr reader);

/**
 * Writes a Sale to XML.
 *
 * @param writer The XML writer.
 * @param _sale The Sale to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0SaleType(xmlTextWriterPtr writer, struct agentrank_ns0_sale *_sale);

/**
 * Frees the elements of a Sale.
 *
 * @param _sale The Sale to free.
 */
static void freeNs0SaleType(struct agentrank_ns0_sale *_sale);

#endif /* DEF_agentrank_ns0_sale_H */
#ifndef DEF_agentrank_ns0_sales_H
#define DEF_agentrank_ns0_sales_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_sales {


  /**
   * chart links
   */
  struct agentrank_ns0_links *charts;

  /**
   * total number of sides
   */
  int *total;

  /**
   * list of sales
   */
  struct agentrank_ns0_sale *sale;

  /**
   * Size of the sale array.
   */
  int _sizeof_sale;
};

/**
 * Reads a Sales element from XML. The element to be read is "sales", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Sales, or NULL in case of error.
 */
struct agentrank_ns0_sales *xml_read_agentrank_ns0_sales(xmlTextReaderPtr reader);

/**
 * Writes a Sales to XML under element name "sales".
 *
 * @param writer The XML writer.
 * @param _sales The Sales to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_sales(xmlTextWriterPtr writer, struct agentrank_ns0_sales *_sales);

/**
 * Frees a Sales.
 *
 * @param _sales The Sales to free.
 */
void free_agentrank_ns0_sales(struct agentrank_ns0_sales *_sales);

/**
 * Reads a Sales element from XML. The element to be read is "sales", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Sales, or NULL in case of error.
 */
struct agentrank_ns0_sales *xmlTextReaderReadNs0SalesElement(xmlTextReaderPtr reader);

/**
 * Writes a Sales to XML under element name "sales".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _sales The Sales to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0SalesElement(xmlTextWriterPtr writer, struct agentrank_ns0_sales *_sales);

/**
 * Writes a Sales to XML under element name "sales".
 *
 * @param writer The XML writer.
 * @param _sales The Sales to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0SalesElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_sales *_sales, int writeNamespaces);

/**
 * Frees the children of a Sales.
 *
 * @param _sales The Sales whose children are to be free.
 */
static void freeNs0SalesElement(struct agentrank_ns0_sales *_sales);

/**
 * Reads a Sales from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Sales, or NULL in case of error.
 */
static struct agentrank_ns0_sales *xmlTextReaderReadNs0SalesType(xmlTextReaderPtr reader);

/**
 * Writes a Sales to XML.
 *
 * @param writer The XML writer.
 * @param _sales The Sales to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0SalesType(xmlTextWriterPtr writer, struct agentrank_ns0_sales *_sales);

/**
 * Frees the elements of a Sales.
 *
 * @param _sales The Sales to free.
 */
static void freeNs0SalesType(struct agentrank_ns0_sales *_sales);

#endif /* DEF_agentrank_ns0_sales_H */
#ifndef DEF_agentrank_ns0_content_H
#define DEF_agentrank_ns0_content_H

/**
 *  User: marc Date: May 12, 2009 Time: 8:28:24 PM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_content {


  /**
   * (no documentation provided)
   */
  xmlChar *type;

  /**
   * (no documentation provided)
   */
  xmlChar *value;
};

/**
 * Reads a Content element from XML. The element to be read is "content", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Content, or NULL in case of error.
 */
struct agentrank_ns0_content *xml_read_agentrank_ns0_content(xmlTextReaderPtr reader);

/**
 * Writes a Content to XML under element name "content".
 *
 * @param writer The XML writer.
 * @param _content The Content to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_content(xmlTextWriterPtr writer, struct agentrank_ns0_content *_content);

/**
 * Frees a Content.
 *
 * @param _content The Content to free.
 */
void free_agentrank_ns0_content(struct agentrank_ns0_content *_content);

/**
 * Reads a Content element from XML. The element to be read is "content", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Content, or NULL in case of error.
 */
struct agentrank_ns0_content *xmlTextReaderReadNs0ContentElement(xmlTextReaderPtr reader);

/**
 * Writes a Content to XML under element name "content".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _content The Content to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ContentElement(xmlTextWriterPtr writer, struct agentrank_ns0_content *_content);

/**
 * Writes a Content to XML under element name "content".
 *
 * @param writer The XML writer.
 * @param _content The Content to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ContentElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_content *_content, int writeNamespaces);

/**
 * Frees the children of a Content.
 *
 * @param _content The Content whose children are to be free.
 */
static void freeNs0ContentElement(struct agentrank_ns0_content *_content);

/**
 * Reads a Content from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Content, or NULL in case of error.
 */
static struct agentrank_ns0_content *xmlTextReaderReadNs0ContentType(xmlTextReaderPtr reader);

/**
 * Writes a Content to XML.
 *
 * @param writer The XML writer.
 * @param _content The Content to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ContentType(xmlTextWriterPtr writer, struct agentrank_ns0_content *_content);

/**
 * Frees the elements of a Content.
 *
 * @param _content The Content to free.
 */
static void freeNs0ContentType(struct agentrank_ns0_content *_content);

#endif /* DEF_agentrank_ns0_content_H */
#ifndef DEF_agentrank_ns0_image_H
#define DEF_agentrank_ns0_image_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_image {


  /**
   * (no documentation provided)
   */
  int height;

  /**
   * (no documentation provided)
   */
  xmlChar *alt;

  /**
   * (no documentation provided)
   */
  int width;

  /**
   * (no documentation provided)
   */
  xmlChar *url;
};

/**
 * Reads a Image element from XML. The element to be read is "image", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Image, or NULL in case of error.
 */
struct agentrank_ns0_image *xml_read_agentrank_ns0_image(xmlTextReaderPtr reader);

/**
 * Writes a Image to XML under element name "image".
 *
 * @param writer The XML writer.
 * @param _image The Image to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_image(xmlTextWriterPtr writer, struct agentrank_ns0_image *_image);

/**
 * Frees a Image.
 *
 * @param _image The Image to free.
 */
void free_agentrank_ns0_image(struct agentrank_ns0_image *_image);

/**
 * Reads a Image element from XML. The element to be read is "image", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Image, or NULL in case of error.
 */
struct agentrank_ns0_image *xmlTextReaderReadNs0ImageElement(xmlTextReaderPtr reader);

/**
 * Writes a Image to XML under element name "image".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _image The Image to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ImageElement(xmlTextWriterPtr writer, struct agentrank_ns0_image *_image);

/**
 * Writes a Image to XML under element name "image".
 *
 * @param writer The XML writer.
 * @param _image The Image to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ImageElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_image *_image, int writeNamespaces);

/**
 * Frees the children of a Image.
 *
 * @param _image The Image whose children are to be free.
 */
static void freeNs0ImageElement(struct agentrank_ns0_image *_image);

/**
 * Reads a Image from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Image, or NULL in case of error.
 */
static struct agentrank_ns0_image *xmlTextReaderReadNs0ImageType(xmlTextReaderPtr reader);

/**
 * Writes a Image to XML.
 *
 * @param writer The XML writer.
 * @param _image The Image to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ImageType(xmlTextWriterPtr writer, struct agentrank_ns0_image *_image);

/**
 * Frees the elements of a Image.
 *
 * @param _image The Image to free.
 */
static void freeNs0ImageType(struct agentrank_ns0_image *_image);

#endif /* DEF_agentrank_ns0_image_H */
#ifndef DEF_agentrank_ns0_link_H
#define DEF_agentrank_ns0_link_H

/**
 *  User: marc Date: Mar 24, 2008 Time: 6:44:23 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_link {


  /**
   * (no documentation provided)
   */
  xmlChar *id;

  /**
   * (no documentation provided)
   */
  xmlChar *title;

  /**
   * (no documentation provided)
   */
  xmlChar *text;

  /**
   * (no documentation provided)
   */
  xmlChar *mouseover;

  /**
   * (no documentation provided)
   */
  xmlChar *rel;

  /**
   * (no documentation provided)
   */
  xmlChar *type;

  /**
   * (no documentation provided)
   */
  xmlChar *href;
};

/**
 * Reads a Link element from XML. The element to be read is "link", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Link, or NULL in case of error.
 */
struct agentrank_ns0_link *xml_read_agentrank_ns0_link(xmlTextReaderPtr reader);

/**
 * Writes a Link to XML under element name "link".
 *
 * @param writer The XML writer.
 * @param _link The Link to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_link(xmlTextWriterPtr writer, struct agentrank_ns0_link *_link);

/**
 * Frees a Link.
 *
 * @param _link The Link to free.
 */
void free_agentrank_ns0_link(struct agentrank_ns0_link *_link);

/**
 * Reads a Link element from XML. The element to be read is "link", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Link, or NULL in case of error.
 */
struct agentrank_ns0_link *xmlTextReaderReadNs0LinkElement(xmlTextReaderPtr reader);

/**
 * Writes a Link to XML under element name "link".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _link The Link to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0LinkElement(xmlTextWriterPtr writer, struct agentrank_ns0_link *_link);

/**
 * Writes a Link to XML under element name "link".
 *
 * @param writer The XML writer.
 * @param _link The Link to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0LinkElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_link *_link, int writeNamespaces);

/**
 * Frees the children of a Link.
 *
 * @param _link The Link whose children are to be free.
 */
static void freeNs0LinkElement(struct agentrank_ns0_link *_link);

/**
 * Reads a Link from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Link, or NULL in case of error.
 */
static struct agentrank_ns0_link *xmlTextReaderReadNs0LinkType(xmlTextReaderPtr reader);

/**
 * Writes a Link to XML.
 *
 * @param writer The XML writer.
 * @param _link The Link to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0LinkType(xmlTextWriterPtr writer, struct agentrank_ns0_link *_link);

/**
 * Frees the elements of a Link.
 *
 * @param _link The Link to free.
 */
static void freeNs0LinkType(struct agentrank_ns0_link *_link);

#endif /* DEF_agentrank_ns0_link_H */
#ifndef DEF_agentrank_ns0_links_H
#define DEF_agentrank_ns0_links_H

/**
 *  User: marc Date: May 13, 2009 Time: 5:44:51 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_links {


  /**
   * get list of links
   */
  struct agentrank_ns0_link *link;

  /**
   * Size of the link array.
   */
  int _sizeof_link;
};

/**
 * Reads a Links element from XML. The element to be read is "links", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Links, or NULL in case of error.
 */
struct agentrank_ns0_links *xml_read_agentrank_ns0_links(xmlTextReaderPtr reader);

/**
 * Writes a Links to XML under element name "links".
 *
 * @param writer The XML writer.
 * @param _links The Links to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_links(xmlTextWriterPtr writer, struct agentrank_ns0_links *_links);

/**
 * Frees a Links.
 *
 * @param _links The Links to free.
 */
void free_agentrank_ns0_links(struct agentrank_ns0_links *_links);

/**
 * Reads a Links element from XML. The element to be read is "links", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Links, or NULL in case of error.
 */
struct agentrank_ns0_links *xmlTextReaderReadNs0LinksElement(xmlTextReaderPtr reader);

/**
 * Writes a Links to XML under element name "links".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _links The Links to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0LinksElement(xmlTextWriterPtr writer, struct agentrank_ns0_links *_links);

/**
 * Writes a Links to XML under element name "links".
 *
 * @param writer The XML writer.
 * @param _links The Links to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0LinksElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_links *_links, int writeNamespaces);

/**
 * Frees the children of a Links.
 *
 * @param _links The Links whose children are to be free.
 */
static void freeNs0LinksElement(struct agentrank_ns0_links *_links);

/**
 * Reads a Links from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Links, or NULL in case of error.
 */
static struct agentrank_ns0_links *xmlTextReaderReadNs0LinksType(xmlTextReaderPtr reader);

/**
 * Writes a Links to XML.
 *
 * @param writer The XML writer.
 * @param _links The Links to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0LinksType(xmlTextWriterPtr writer, struct agentrank_ns0_links *_links);

/**
 * Frees the elements of a Links.
 *
 * @param _links The Links to free.
 */
static void freeNs0LinksType(struct agentrank_ns0_links *_links);

#endif /* DEF_agentrank_ns0_links_H */
#ifndef DEF_agentrank_ns0_messages_H
#define DEF_agentrank_ns0_messages_H

/**
 *  User: marc Date: Jul 17, 2009 Time: 3:05:10 PM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_messages {


  /**
   * list of messages
   */
  xmlChar *message;

  /**
   * Size of the message array.
   */
  int _sizeof_message;
};

/**
 * Reads a Messages element from XML. The element to be read is "messages", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Messages, or NULL in case of error.
 */
struct agentrank_ns0_messages *xml_read_agentrank_ns0_messages(xmlTextReaderPtr reader);

/**
 * Writes a Messages to XML under element name "messages".
 *
 * @param writer The XML writer.
 * @param _messages The Messages to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_messages(xmlTextWriterPtr writer, struct agentrank_ns0_messages *_messages);

/**
 * Frees a Messages.
 *
 * @param _messages The Messages to free.
 */
void free_agentrank_ns0_messages(struct agentrank_ns0_messages *_messages);

/**
 * Reads a Messages element from XML. The element to be read is "messages", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Messages, or NULL in case of error.
 */
struct agentrank_ns0_messages *xmlTextReaderReadNs0MessagesElement(xmlTextReaderPtr reader);

/**
 * Writes a Messages to XML under element name "messages".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _messages The Messages to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0MessagesElement(xmlTextWriterPtr writer, struct agentrank_ns0_messages *_messages);

/**
 * Writes a Messages to XML under element name "messages".
 *
 * @param writer The XML writer.
 * @param _messages The Messages to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0MessagesElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_messages *_messages, int writeNamespaces);

/**
 * Frees the children of a Messages.
 *
 * @param _messages The Messages whose children are to be free.
 */
static void freeNs0MessagesElement(struct agentrank_ns0_messages *_messages);

/**
 * Reads a Messages from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Messages, or NULL in case of error.
 */
static struct agentrank_ns0_messages *xmlTextReaderReadNs0MessagesType(xmlTextReaderPtr reader);

/**
 * Writes a Messages to XML.
 *
 * @param writer The XML writer.
 * @param _messages The Messages to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0MessagesType(xmlTextWriterPtr writer, struct agentrank_ns0_messages *_messages);

/**
 * Frees the elements of a Messages.
 *
 * @param _messages The Messages to free.
 */
static void freeNs0MessagesType(struct agentrank_ns0_messages *_messages);

#endif /* DEF_agentrank_ns0_messages_H */
#ifndef DEF_agentrank_ns0_status_H
#define DEF_agentrank_ns0_status_H

/**
 *  User: marc Date: May 13, 2009 Time: 5:37:18 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_status {


  /**
   * (no documentation provided)
   */
  int code;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_messages *messages;
};

/**
 * Reads a Status element from XML. The element to be read is "status", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Status, or NULL in case of error.
 */
struct agentrank_ns0_status *xml_read_agentrank_ns0_status(xmlTextReaderPtr reader);

/**
 * Writes a Status to XML under element name "status".
 *
 * @param writer The XML writer.
 * @param _status The Status to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_status(xmlTextWriterPtr writer, struct agentrank_ns0_status *_status);

/**
 * Frees a Status.
 *
 * @param _status The Status to free.
 */
void free_agentrank_ns0_status(struct agentrank_ns0_status *_status);

/**
 * Reads a Status element from XML. The element to be read is "status", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Status, or NULL in case of error.
 */
struct agentrank_ns0_status *xmlTextReaderReadNs0StatusElement(xmlTextReaderPtr reader);

/**
 * Writes a Status to XML under element name "status".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _status The Status to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0StatusElement(xmlTextWriterPtr writer, struct agentrank_ns0_status *_status);

/**
 * Writes a Status to XML under element name "status".
 *
 * @param writer The XML writer.
 * @param _status The Status to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0StatusElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_status *_status, int writeNamespaces);

/**
 * Frees the children of a Status.
 *
 * @param _status The Status whose children are to be free.
 */
static void freeNs0StatusElement(struct agentrank_ns0_status *_status);

/**
 * Reads a Status from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Status, or NULL in case of error.
 */
static struct agentrank_ns0_status *xmlTextReaderReadNs0StatusType(xmlTextReaderPtr reader);

/**
 * Writes a Status to XML.
 *
 * @param writer The XML writer.
 * @param _status The Status to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0StatusType(xmlTextWriterPtr writer, struct agentrank_ns0_status *_status);

/**
 * Frees the elements of a Status.
 *
 * @param _status The Status to free.
 */
static void freeNs0StatusType(struct agentrank_ns0_status *_status);

#endif /* DEF_agentrank_ns0_status_H */
#ifndef DEF_agentrank_ns0_editUser_H
#define DEF_agentrank_ns0_editUser_H

/**
 *  Created by IntelliJ IDEA. User: marc Date: Jul 24, 2010 Time: 7:07:31 AM

 */
struct agentrank_ns0_editUser {


  /**
   * (no documentation provided)
   */
  xmlChar *id;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_links *links;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_status *status;
};

/**
 * Reads a EditUser element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The EditUser, or NULL in case of error.
 */
struct agentrank_ns0_editUser *xml_read_agentrank_ns0_editUser(xmlTextReaderPtr reader);

/**
 * Writes a EditUser to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _editUser The EditUser to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_editUser(xmlTextWriterPtr writer, struct agentrank_ns0_editUser *_editUser);

/**
 * Frees a EditUser.
 *
 * @param _editUser The EditUser to free.
 */
void free_agentrank_ns0_editUser(struct agentrank_ns0_editUser *_editUser);

/**
 * Reads a EditUser element from XML. The element to be read is "response", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The EditUser, or NULL in case of error.
 */
struct agentrank_ns0_editUser *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader);

/**
 * Writes a EditUser to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _editUser The EditUser to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_editUser *_editUser);

/**
 * Writes a EditUser to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _editUser The EditUser to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_editUser *_editUser, int writeNamespaces);

/**
 * Frees the children of a EditUser.
 *
 * @param _editUser The EditUser whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_editUser *_editUser);

/**
 * Reads a EditUser from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The EditUser, or NULL in case of error.
 */
static struct agentrank_ns0_editUser *xmlTextReaderReadNs0EditUserType(xmlTextReaderPtr reader);

/**
 * Writes a EditUser to XML.
 *
 * @param writer The XML writer.
 * @param _editUser The EditUser to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0EditUserType(xmlTextWriterPtr writer, struct agentrank_ns0_editUser *_editUser);

/**
 * Frees the elements of a EditUser.
 *
 * @param _editUser The EditUser to free.
 */
static void freeNs0EditUserType(struct agentrank_ns0_editUser *_editUser);

#endif /* DEF_agentrank_ns0_editUser_H */
#ifndef DEF_agentrank_ns0_review_H
#define DEF_agentrank_ns0_review_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:39:03 PM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_review {


  /**
   * (no documentation provided)
   */
  xmlChar *id;

  /**
   * (no documentation provided)
   */
  struct agentrank_ns0_link *link;

  /**
   * (no documentation provided)
   */
  struct tm *date;

  /**
   * (no documentation provided)
   */
  xmlChar *name;

  /**
   * (no documentation provided)
   */
  xmlChar *email;

  /**
   * (no documentation provided)
   */
  xmlChar *comment;

  /**
   * (no documentation provided)
   */
  xmlChar *satisfied;

  /**
   * (no documentation provided)
   */
  xmlChar *recommend;
};

/**
 * Reads a Review from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Review, or NULL in case of error.
 */
static struct agentrank_ns0_review *xmlTextReaderReadNs0ReviewType(xmlTextReaderPtr reader);

/**
 * Writes a Review to XML.
 *
 * @param writer The XML writer.
 * @param _review The Review to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ReviewType(xmlTextWriterPtr writer, struct agentrank_ns0_review *_review);

/**
 * Frees the elements of a Review.
 *
 * @param _review The Review to free.
 */
static void freeNs0ReviewType(struct agentrank_ns0_review *_review);

#endif /* DEF_agentrank_ns0_review_H */
#ifndef DEF_agentrank_ns0_reviews_H
#define DEF_agentrank_ns0_reviews_H

/**
 *  User: marc Date: Mar 4, 2008 Time: 6:15:00 AM
 <p/>
 THIS SOFTWARE IS COPYRIGHTED.  THE SOFTWARE MAY NOT BE COPIED REPRODUCED, TRANSLATED, OR REDUCED TO ANY ELECTRONIC MEDIUM OR MACHINE READABLE FORM WITHOUT THE PRIOR WRITTEN CONSENT OF SOCO
 TECHNOLOGIES.

 */
struct agentrank_ns0_reviews {


  /**
   * review count
   */
  int *total;

  /**
   * list of client reviews
   */
  struct agentrank_ns0_review *review;

  /**
   * Size of the review array.
   */
  int _sizeof_review;

  /**
   * (no documentation provided)
   */
  xmlChar *satisfied;

  /**
   * (no documentation provided)
   */
  xmlChar *recommend;
};

/**
 * Reads a Reviews element from XML. The element to be read is "reviews", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Reviews, or NULL in case of error.
 */
struct agentrank_ns0_reviews *xml_read_agentrank_ns0_reviews(xmlTextReaderPtr reader);

/**
 * Writes a Reviews to XML under element name "reviews".
 *
 * @param writer The XML writer.
 * @param _reviews The Reviews to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
int xml_write_agentrank_ns0_reviews(xmlTextWriterPtr writer, struct agentrank_ns0_reviews *_reviews);

/**
 * Frees a Reviews.
 *
 * @param _reviews The Reviews to free.
 */
void free_agentrank_ns0_reviews(struct agentrank_ns0_reviews *_reviews);

/**
 * Reads a Reviews element from XML. The element to be read is "reviews", and
 * it is assumed that the reader is already pointing to the element.
 *
 * @param reader The XML reader.
 * @return The Reviews, or NULL in case of error.
 */
struct agentrank_ns0_reviews *xmlTextReaderReadNs0ReviewsElement(xmlTextReaderPtr reader);

/**
 * Writes a Reviews to XML under element name "reviews".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _reviews The Reviews to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ReviewsElement(xmlTextWriterPtr writer, struct agentrank_ns0_reviews *_reviews);

/**
 * Writes a Reviews to XML under element name "reviews".
 *
 * @param writer The XML writer.
 * @param _reviews The Reviews to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ReviewsElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_reviews *_reviews, int writeNamespaces);

/**
 * Frees the children of a Reviews.
 *
 * @param _reviews The Reviews whose children are to be free.
 */
static void freeNs0ReviewsElement(struct agentrank_ns0_reviews *_reviews);

/**
 * Reads a Reviews from XML. The reader is assumed to be at the start element.
 *
 * @param reader The XML reader.
 * @return The Reviews, or NULL in case of error.
 */
static struct agentrank_ns0_reviews *xmlTextReaderReadNs0ReviewsType(xmlTextReaderPtr reader);

/**
 * Writes a Reviews to XML.
 *
 * @param writer The XML writer.
 * @param _reviews The Reviews to write.
 * @return The bytes written (may be 0 in case of buffering) or -1 in case of error.
 */
static int xmlTextWriterWriteNs0ReviewsType(xmlTextWriterPtr writer, struct agentrank_ns0_reviews *_reviews);

/**
 * Frees the elements of a Reviews.
 *
 * @param _reviews The Reviews to free.
 */
static void freeNs0ReviewsType(struct agentrank_ns0_reviews *_reviews);

#endif /* DEF_agentrank_ns0_reviews_H */
#ifndef DEF_agentrank_ns0_agents_M
#define DEF_agentrank_ns0_agents_M

/**
 * Reads a Agents element from XML. The element to be read is "agents", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Agents, or NULL in case of error.
 */
struct agentrank_ns0_agents *xml_read_agentrank_ns0_agents(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0AgentsElement(reader);
}

/**
 * Writes a Agents to XML under element name "agents".
 *
 * @param writer The XML writer.
 * @param _agents The Agents to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_agents(xmlTextWriterPtr writer, struct agentrank_ns0_agents *_agents) {
  return xmlTextWriterWriteNs0AgentsElementNS(writer, _agents, 1);
}

/**
 * Frees a Agents.
 *
 * @param _agents The Agents to free.
 */
void free_agentrank_ns0_agents(struct agentrank_ns0_agents *_agents) {
  freeNs0AgentsType(_agents);
  free(_agents);
}

/**
 * Reads a Agents element from XML. The element to be read is "agents", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Agents, or NULL in case of error.
 */
struct agentrank_ns0_agents *xmlTextReaderReadNs0AgentsElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_agents *_agents = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "agents", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}agents.\n");
#endif
    _agents = xmlTextReaderReadNs0AgentsType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_agents == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}agents failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}agents failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _agents;
}

/**
 * Writes a Agents to XML under element name "agents".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _agents The Agents to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0AgentsElement(xmlTextWriterPtr writer, struct agentrank_ns0_agents *_agents) {
  return xmlTextWriterWriteNs0AgentsElementNS(writer, _agents, 0);
}

/**
 * Writes a Agents to XML under element name "agents".
 *
 * @param writer The XML writer.
 * @param _agents The Agents to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0AgentsElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_agents *_agents, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "agents", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}agents. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}agents for root element {}agents...\n");
#endif
  status = xmlTextWriterWriteNs0AgentsType(writer, _agents);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}agents. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}agents. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Agents.
 *
 * @param _agents The Agents whose children are to be free.
 */
static void freeNs0AgentsElement(struct agentrank_ns0_agents *_agents) {
  freeNs0AgentsType(_agents);
}

/**
 * Reads a Agents from XML. The reader is assumed to be at the start element.
 *
 * @return the Agents, or NULL in case of error.
 */
static struct agentrank_ns0_agents *xmlTextReaderReadNs0AgentsType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_agents *_agents = calloc(1, sizeof(struct agentrank_ns0_agents));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0AgentsType(_agents);
        free(_agents);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "agent", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}agent of type {}agent.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0AgentType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}agent of type {}agent.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0AgentsType(_agents);
          free(_agents);
          return NULL;
        }

        _agents->agent = realloc(_agents->agent, (_agents->_sizeof_agent + 1) * sizeof(struct agentrank_ns0_agent));
        memcpy(&(_agents->agent[_agents->_sizeof_agent++]), _child_accessor, sizeof(struct agentrank_ns0_agent));
        free(_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}agents.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}agents. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _agents;
}

/**
 * Writes a Agents to XML.
 *
 * @param writer The XML writer.
 * @param _agents The Agents to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0AgentsType(xmlTextWriterPtr writer, struct agentrank_ns0_agents *_agents) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  for (i = 0; i < _agents->_sizeof_agent; i++) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "agent", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}agent. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}agent for element {}agent...\n", status);
#endif
    status = xmlTextWriterWriteNs0AgentType(writer, &(_agents->agent[i]));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}agent for element {}agent. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}agent. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Agents.
 *
 * @param _agents The Agents to free.
 */
static void freeNs0AgentsType(struct agentrank_ns0_agents *_agents) {
  int i;
  if (_agents->agent != NULL) {
    for (i = 0; i < _agents->_sizeof_agent; i++) {
#if DEBUG_ENUNCIATE > 1
      printf("Freeing accessor agent[%i] of type agentrank_ns0_agents...\n", i);
#endif
      freeNs0AgentType(&(_agents->agent[i]));
    }
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor agent of type agentrank_ns0_agents...\n");
#endif
    free(_agents->agent);
  }
}
#endif /* DEF_agentrank_ns0_agents_M */
#ifndef DEF_agentrank_ns0_contactAgent_M
#define DEF_agentrank_ns0_contactAgent_M

/**
 * Reads a ContactAgent element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The ContactAgent, or NULL in case of error.
 */
struct agentrank_ns0_contactAgent *xml_read_agentrank_ns0_contactAgent(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ResponseElement(reader);
}

/**
 * Writes a ContactAgent to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _contactAgent The ContactAgent to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_contactAgent(xmlTextWriterPtr writer, struct agentrank_ns0_contactAgent *_contactAgent) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _contactAgent, 1);
}

/**
 * Frees a ContactAgent.
 *
 * @param _contactAgent The ContactAgent to free.
 */
void free_agentrank_ns0_contactAgent(struct agentrank_ns0_contactAgent *_contactAgent) {
  freeNs0ContactAgentType(_contactAgent);
  free(_contactAgent);
}

/**
 * Reads a ContactAgent element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The ContactAgent, or NULL in case of error.
 */
struct agentrank_ns0_contactAgent *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_contactAgent *_contactAgent = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "response", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}response.\n");
#endif
    _contactAgent = xmlTextReaderReadNs0ContactAgentType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_contactAgent == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}response failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}response failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _contactAgent;
}

/**
 * Writes a ContactAgent to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _contactAgent The ContactAgent to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_contactAgent *_contactAgent) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _contactAgent, 0);
}

/**
 * Writes a ContactAgent to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _contactAgent The ContactAgent to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_contactAgent *_contactAgent, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "response", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}contactAgent for root element {}response...\n");
#endif
  status = xmlTextWriterWriteNs0ContactAgentType(writer, _contactAgent);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a ContactAgent.
 *
 * @param _contactAgent The ContactAgent whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_contactAgent *_contactAgent) {
  freeNs0ContactAgentType(_contactAgent);
}

/**
 * Reads a ContactAgent from XML. The reader is assumed to be at the start element.
 *
 * @return the ContactAgent, or NULL in case of error.
 */
static struct agentrank_ns0_contactAgent *xmlTextReaderReadNs0ContactAgentType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_contactAgent *_contactAgent = calloc(1, sizeof(struct agentrank_ns0_contactAgent));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0ContactAgentType(_contactAgent);
        free(_contactAgent);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "status", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}status of type {}status.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0StatusType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}status of type {}status.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ContactAgentType(_contactAgent);
          free(_contactAgent);
          return NULL;
        }

        _contactAgent->status = ((struct agentrank_ns0_status*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}contactAgent.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}contactAgent. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _contactAgent;
}

/**
 * Writes a ContactAgent to XML.
 *
 * @param writer The XML writer.
 * @param _contactAgent The ContactAgent to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0ContactAgentType(xmlTextWriterPtr writer, struct agentrank_ns0_contactAgent *_contactAgent) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_contactAgent->status != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "status", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}status for element {}status...\n", status);
#endif
    status = xmlTextWriterWriteNs0StatusType(writer, (_contactAgent->status));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}status for element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a ContactAgent.
 *
 * @param _contactAgent The ContactAgent to free.
 */
static void freeNs0ContactAgentType(struct agentrank_ns0_contactAgent *_contactAgent) {
  int i;
  if (_contactAgent->status != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor status of type agentrank_ns0_contactAgent...\n");
#endif
    freeNs0StatusType(_contactAgent->status);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor status of type agentrank_ns0_contactAgent...\n");
#endif
    free(_contactAgent->status);
  }
}
#endif /* DEF_agentrank_ns0_contactAgent_M */
#ifndef DEF_agentrank_ns0_findAgents_M
#define DEF_agentrank_ns0_findAgents_M

/**
 * Reads a FindAgents element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The FindAgents, or NULL in case of error.
 */
struct agentrank_ns0_findAgents *xml_read_agentrank_ns0_findAgents(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ResponseElement(reader);
}

/**
 * Writes a FindAgents to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _findAgents The FindAgents to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_findAgents(xmlTextWriterPtr writer, struct agentrank_ns0_findAgents *_findAgents) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _findAgents, 1);
}

/**
 * Frees a FindAgents.
 *
 * @param _findAgents The FindAgents to free.
 */
void free_agentrank_ns0_findAgents(struct agentrank_ns0_findAgents *_findAgents) {
  freeNs0FindAgentsType(_findAgents);
  free(_findAgents);
}

/**
 * Reads a FindAgents element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The FindAgents, or NULL in case of error.
 */
struct agentrank_ns0_findAgents *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_findAgents *_findAgents = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "response", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}response.\n");
#endif
    _findAgents = xmlTextReaderReadNs0FindAgentsType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_findAgents == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}response failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}response failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _findAgents;
}

/**
 * Writes a FindAgents to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _findAgents The FindAgents to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_findAgents *_findAgents) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _findAgents, 0);
}

/**
 * Writes a FindAgents to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _findAgents The FindAgents to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_findAgents *_findAgents, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "response", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}findAgents for root element {}response...\n");
#endif
  status = xmlTextWriterWriteNs0FindAgentsType(writer, _findAgents);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a FindAgents.
 *
 * @param _findAgents The FindAgents whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_findAgents *_findAgents) {
  freeNs0FindAgentsType(_findAgents);
}

/**
 * Reads a FindAgents from XML. The reader is assumed to be at the start element.
 *
 * @return the FindAgents, or NULL in case of error.
 */
static struct agentrank_ns0_findAgents *xmlTextReaderReadNs0FindAgentsType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_findAgents *_findAgents = calloc(1, sizeof(struct agentrank_ns0_findAgents));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0FindAgentsType(_findAgents);
        free(_findAgents);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "agent", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}agent of type {}agents.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0AgentsType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}agent of type {}agents.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0FindAgentsType(_findAgents);
          free(_findAgents);
          return NULL;
        }

        _findAgents->agent = ((struct agentrank_ns0_agents*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "status", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}status of type {}status.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0StatusType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}status of type {}status.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0FindAgentsType(_findAgents);
          free(_findAgents);
          return NULL;
        }

        _findAgents->status = ((struct agentrank_ns0_status*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}findAgents.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}findAgents. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _findAgents;
}

/**
 * Writes a FindAgents to XML.
 *
 * @param writer The XML writer.
 * @param _findAgents The FindAgents to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0FindAgentsType(xmlTextWriterPtr writer, struct agentrank_ns0_findAgents *_findAgents) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_findAgents->agent != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "agent", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}agent. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}agents for element {}agent...\n", status);
#endif
    status = xmlTextWriterWriteNs0AgentsType(writer, (_findAgents->agent));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}agents for element {}agent. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}agent. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_findAgents->status != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "status", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}status for element {}status...\n", status);
#endif
    status = xmlTextWriterWriteNs0StatusType(writer, (_findAgents->status));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}status for element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a FindAgents.
 *
 * @param _findAgents The FindAgents to free.
 */
static void freeNs0FindAgentsType(struct agentrank_ns0_findAgents *_findAgents) {
  int i;
  if (_findAgents->agent != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor agent of type agentrank_ns0_findAgents...\n");
#endif
    freeNs0AgentsType(_findAgents->agent);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor agent of type agentrank_ns0_findAgents...\n");
#endif
    free(_findAgents->agent);
  }
  if (_findAgents->status != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor status of type agentrank_ns0_findAgents...\n");
#endif
    freeNs0StatusType(_findAgents->status);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor status of type agentrank_ns0_findAgents...\n");
#endif
    free(_findAgents->status);
  }
}
#endif /* DEF_agentrank_ns0_findAgents_M */
#ifndef DEF_agentrank_ns0_findProfiles_M
#define DEF_agentrank_ns0_findProfiles_M

/**
 * Reads a FindProfiles element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The FindProfiles, or NULL in case of error.
 */
struct agentrank_ns0_findProfiles *xml_read_agentrank_ns0_findProfiles(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ResponseElement(reader);
}

/**
 * Writes a FindProfiles to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _findProfiles The FindProfiles to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_findProfiles(xmlTextWriterPtr writer, struct agentrank_ns0_findProfiles *_findProfiles) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _findProfiles, 1);
}

/**
 * Frees a FindProfiles.
 *
 * @param _findProfiles The FindProfiles to free.
 */
void free_agentrank_ns0_findProfiles(struct agentrank_ns0_findProfiles *_findProfiles) {
  freeNs0FindProfilesType(_findProfiles);
  free(_findProfiles);
}

/**
 * Reads a FindProfiles element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The FindProfiles, or NULL in case of error.
 */
struct agentrank_ns0_findProfiles *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_findProfiles *_findProfiles = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "response", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}response.\n");
#endif
    _findProfiles = xmlTextReaderReadNs0FindProfilesType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_findProfiles == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}response failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}response failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _findProfiles;
}

/**
 * Writes a FindProfiles to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _findProfiles The FindProfiles to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_findProfiles *_findProfiles) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _findProfiles, 0);
}

/**
 * Writes a FindProfiles to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _findProfiles The FindProfiles to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_findProfiles *_findProfiles, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "response", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}findProfiles for root element {}response...\n");
#endif
  status = xmlTextWriterWriteNs0FindProfilesType(writer, _findProfiles);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a FindProfiles.
 *
 * @param _findProfiles The FindProfiles whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_findProfiles *_findProfiles) {
  freeNs0FindProfilesType(_findProfiles);
}

/**
 * Reads a FindProfiles from XML. The reader is assumed to be at the start element.
 *
 * @return the FindProfiles, or NULL in case of error.
 */
static struct agentrank_ns0_findProfiles *xmlTextReaderReadNs0FindProfilesType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_findProfiles *_findProfiles = calloc(1, sizeof(struct agentrank_ns0_findProfiles));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0FindProfilesType(_findProfiles);
        free(_findProfiles);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "status", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}status of type {}status.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0StatusType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}status of type {}status.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0FindProfilesType(_findProfiles);
          free(_findProfiles);
          return NULL;
        }

        _findProfiles->status = ((struct agentrank_ns0_status*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "profiles", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}profiles of type {}profiles.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ProfilesType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}profiles of type {}profiles.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0FindProfilesType(_findProfiles);
          free(_findProfiles);
          return NULL;
        }

        _findProfiles->profiles = ((struct agentrank_ns0_profiles*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}findProfiles.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}findProfiles. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _findProfiles;
}

/**
 * Writes a FindProfiles to XML.
 *
 * @param writer The XML writer.
 * @param _findProfiles The FindProfiles to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0FindProfilesType(xmlTextWriterPtr writer, struct agentrank_ns0_findProfiles *_findProfiles) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_findProfiles->status != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "status", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}status for element {}status...\n", status);
#endif
    status = xmlTextWriterWriteNs0StatusType(writer, (_findProfiles->status));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}status for element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_findProfiles->profiles != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "profiles", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}profiles. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}profiles for element {}profiles...\n", status);
#endif
    status = xmlTextWriterWriteNs0ProfilesType(writer, (_findProfiles->profiles));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}profiles for element {}profiles. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}profiles. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a FindProfiles.
 *
 * @param _findProfiles The FindProfiles to free.
 */
static void freeNs0FindProfilesType(struct agentrank_ns0_findProfiles *_findProfiles) {
  int i;
  if (_findProfiles->status != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor status of type agentrank_ns0_findProfiles...\n");
#endif
    freeNs0StatusType(_findProfiles->status);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor status of type agentrank_ns0_findProfiles...\n");
#endif
    free(_findProfiles->status);
  }
  if (_findProfiles->profiles != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor profiles of type agentrank_ns0_findProfiles...\n");
#endif
    freeNs0ProfilesType(_findProfiles->profiles);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor profiles of type agentrank_ns0_findProfiles...\n");
#endif
    free(_findProfiles->profiles);
  }
}
#endif /* DEF_agentrank_ns0_findProfiles_M */
#ifndef DEF_agentrank_ns0_forecasting_M
#define DEF_agentrank_ns0_forecasting_M

/**
 * Reads a Forecasting element from XML. The element to be read is "forecasting", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Forecasting, or NULL in case of error.
 */
struct agentrank_ns0_forecasting *xml_read_agentrank_ns0_forecasting(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ForecastingElement(reader);
}

/**
 * Writes a Forecasting to XML under element name "forecasting".
 *
 * @param writer The XML writer.
 * @param _forecasting The Forecasting to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_forecasting(xmlTextWriterPtr writer, struct agentrank_ns0_forecasting *_forecasting) {
  return xmlTextWriterWriteNs0ForecastingElementNS(writer, _forecasting, 1);
}

/**
 * Frees a Forecasting.
 *
 * @param _forecasting The Forecasting to free.
 */
void free_agentrank_ns0_forecasting(struct agentrank_ns0_forecasting *_forecasting) {
  freeNs0ForecastingType(_forecasting);
  free(_forecasting);
}

/**
 * Reads a Forecasting element from XML. The element to be read is "forecasting", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Forecasting, or NULL in case of error.
 */
struct agentrank_ns0_forecasting *xmlTextReaderReadNs0ForecastingElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_forecasting *_forecasting = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "forecasting", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}forecasting.\n");
#endif
    _forecasting = xmlTextReaderReadNs0ForecastingType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_forecasting == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}forecasting failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}forecasting failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _forecasting;
}

/**
 * Writes a Forecasting to XML under element name "forecasting".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _forecasting The Forecasting to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ForecastingElement(xmlTextWriterPtr writer, struct agentrank_ns0_forecasting *_forecasting) {
  return xmlTextWriterWriteNs0ForecastingElementNS(writer, _forecasting, 0);
}

/**
 * Writes a Forecasting to XML under element name "forecasting".
 *
 * @param writer The XML writer.
 * @param _forecasting The Forecasting to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ForecastingElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_forecasting *_forecasting, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "forecasting", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}forecasting. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}forecasting for root element {}forecasting...\n");
#endif
  status = xmlTextWriterWriteNs0ForecastingType(writer, _forecasting);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}forecasting. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}forecasting. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Forecasting.
 *
 * @param _forecasting The Forecasting whose children are to be free.
 */
static void freeNs0ForecastingElement(struct agentrank_ns0_forecasting *_forecasting) {
  freeNs0ForecastingType(_forecasting);
}

/**
 * Reads a Forecasting from XML. The reader is assumed to be at the start element.
 *
 * @return the Forecasting, or NULL in case of error.
 */
static struct agentrank_ns0_forecasting *xmlTextReaderReadNs0ForecastingType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_forecasting *_forecasting = calloc(1, sizeof(struct agentrank_ns0_forecasting));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0ForecastingType(_forecasting);
        free(_forecasting);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "image", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}image of type {}image.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ImageType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}image of type {}image.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ForecastingType(_forecasting);
          free(_forecasting);
          return NULL;
        }

        _forecasting->image = ((struct agentrank_ns0_image*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "forecasts", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}forecasts of type {}forecasts.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ForecastsType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}forecasts of type {}forecasts.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ForecastingType(_forecasting);
          free(_forecasting);
          return NULL;
        }

        _forecasting->forecasts = ((struct agentrank_ns0_forecasts*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}forecasting.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}forecasting. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _forecasting;
}

/**
 * Writes a Forecasting to XML.
 *
 * @param writer The XML writer.
 * @param _forecasting The Forecasting to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0ForecastingType(xmlTextWriterPtr writer, struct agentrank_ns0_forecasting *_forecasting) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_forecasting->image != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "image", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}image. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}image for element {}image...\n", status);
#endif
    status = xmlTextWriterWriteNs0ImageType(writer, (_forecasting->image));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}image for element {}image. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}image. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_forecasting->forecasts != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "forecasts", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}forecasts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}forecasts for element {}forecasts...\n", status);
#endif
    status = xmlTextWriterWriteNs0ForecastsType(writer, (_forecasting->forecasts));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}forecasts for element {}forecasts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}forecasts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Forecasting.
 *
 * @param _forecasting The Forecasting to free.
 */
static void freeNs0ForecastingType(struct agentrank_ns0_forecasting *_forecasting) {
  int i;
  if (_forecasting->image != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor image of type agentrank_ns0_forecasting...\n");
#endif
    freeNs0ImageType(_forecasting->image);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor image of type agentrank_ns0_forecasting...\n");
#endif
    free(_forecasting->image);
  }
  if (_forecasting->forecasts != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor forecasts of type agentrank_ns0_forecasting...\n");
#endif
    freeNs0ForecastsType(_forecasting->forecasts);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor forecasts of type agentrank_ns0_forecasting...\n");
#endif
    free(_forecasting->forecasts);
  }
}
#endif /* DEF_agentrank_ns0_forecasting_M */
#ifndef DEF_agentrank_ns0_getAgent_M
#define DEF_agentrank_ns0_getAgent_M

/**
 * Reads a GetAgent element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetAgent, or NULL in case of error.
 */
struct agentrank_ns0_getAgent *xml_read_agentrank_ns0_getAgent(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ResponseElement(reader);
}

/**
 * Writes a GetAgent to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getAgent The GetAgent to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_getAgent(xmlTextWriterPtr writer, struct agentrank_ns0_getAgent *_getAgent) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getAgent, 1);
}

/**
 * Frees a GetAgent.
 *
 * @param _getAgent The GetAgent to free.
 */
void free_agentrank_ns0_getAgent(struct agentrank_ns0_getAgent *_getAgent) {
  freeNs0GetAgentType(_getAgent);
  free(_getAgent);
}

/**
 * Reads a GetAgent element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The GetAgent, or NULL in case of error.
 */
struct agentrank_ns0_getAgent *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_getAgent *_getAgent = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "response", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}response.\n");
#endif
    _getAgent = xmlTextReaderReadNs0GetAgentType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_getAgent == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}response failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}response failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _getAgent;
}

/**
 * Writes a GetAgent to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getAgent The GetAgent to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getAgent *_getAgent) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getAgent, 0);
}

/**
 * Writes a GetAgent to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getAgent The GetAgent to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getAgent *_getAgent, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "response", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}getAgent for root element {}response...\n");
#endif
  status = xmlTextWriterWriteNs0GetAgentType(writer, _getAgent);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a GetAgent.
 *
 * @param _getAgent The GetAgent whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getAgent *_getAgent) {
  freeNs0GetAgentType(_getAgent);
}

/**
 * Reads a GetAgent from XML. The reader is assumed to be at the start element.
 *
 * @return the GetAgent, or NULL in case of error.
 */
static struct agentrank_ns0_getAgent *xmlTextReaderReadNs0GetAgentType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_getAgent *_getAgent = calloc(1, sizeof(struct agentrank_ns0_getAgent));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0GetAgentType(_getAgent);
        free(_getAgent);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "agent", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}agent of type {}agent.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0AgentType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}agent of type {}agent.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetAgentType(_getAgent);
          free(_getAgent);
          return NULL;
        }

        _getAgent->agent = ((struct agentrank_ns0_agent*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "status", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}status of type {}status.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0StatusType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}status of type {}status.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetAgentType(_getAgent);
          free(_getAgent);
          return NULL;
        }

        _getAgent->status = ((struct agentrank_ns0_status*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}getAgent.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}getAgent. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _getAgent;
}

/**
 * Writes a GetAgent to XML.
 *
 * @param writer The XML writer.
 * @param _getAgent The GetAgent to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0GetAgentType(xmlTextWriterPtr writer, struct agentrank_ns0_getAgent *_getAgent) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_getAgent->agent != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "agent", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}agent. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}agent for element {}agent...\n", status);
#endif
    status = xmlTextWriterWriteNs0AgentType(writer, (_getAgent->agent));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}agent for element {}agent. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}agent. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_getAgent->status != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "status", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}status for element {}status...\n", status);
#endif
    status = xmlTextWriterWriteNs0StatusType(writer, (_getAgent->status));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}status for element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a GetAgent.
 *
 * @param _getAgent The GetAgent to free.
 */
static void freeNs0GetAgentType(struct agentrank_ns0_getAgent *_getAgent) {
  int i;
  if (_getAgent->agent != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor agent of type agentrank_ns0_getAgent...\n");
#endif
    freeNs0AgentType(_getAgent->agent);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor agent of type agentrank_ns0_getAgent...\n");
#endif
    free(_getAgent->agent);
  }
  if (_getAgent->status != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor status of type agentrank_ns0_getAgent...\n");
#endif
    freeNs0StatusType(_getAgent->status);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor status of type agentrank_ns0_getAgent...\n");
#endif
    free(_getAgent->status);
  }
}
#endif /* DEF_agentrank_ns0_getAgent_M */
#ifndef DEF_agentrank_ns0_getForecasting_M
#define DEF_agentrank_ns0_getForecasting_M

/**
 * Reads a GetForecasting element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetForecasting, or NULL in case of error.
 */
struct agentrank_ns0_getForecasting *xml_read_agentrank_ns0_getForecasting(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ResponseElement(reader);
}

/**
 * Writes a GetForecasting to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getForecasting The GetForecasting to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_getForecasting(xmlTextWriterPtr writer, struct agentrank_ns0_getForecasting *_getForecasting) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getForecasting, 1);
}

/**
 * Frees a GetForecasting.
 *
 * @param _getForecasting The GetForecasting to free.
 */
void free_agentrank_ns0_getForecasting(struct agentrank_ns0_getForecasting *_getForecasting) {
  freeNs0GetForecastingType(_getForecasting);
  free(_getForecasting);
}

/**
 * Reads a GetForecasting element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The GetForecasting, or NULL in case of error.
 */
struct agentrank_ns0_getForecasting *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_getForecasting *_getForecasting = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "response", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}response.\n");
#endif
    _getForecasting = xmlTextReaderReadNs0GetForecastingType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_getForecasting == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}response failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}response failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _getForecasting;
}

/**
 * Writes a GetForecasting to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getForecasting The GetForecasting to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getForecasting *_getForecasting) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getForecasting, 0);
}

/**
 * Writes a GetForecasting to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getForecasting The GetForecasting to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getForecasting *_getForecasting, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "response", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}getForecasting for root element {}response...\n");
#endif
  status = xmlTextWriterWriteNs0GetForecastingType(writer, _getForecasting);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a GetForecasting.
 *
 * @param _getForecasting The GetForecasting whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getForecasting *_getForecasting) {
  freeNs0GetForecastingType(_getForecasting);
}

/**
 * Reads a GetForecasting from XML. The reader is assumed to be at the start element.
 *
 * @return the GetForecasting, or NULL in case of error.
 */
static struct agentrank_ns0_getForecasting *xmlTextReaderReadNs0GetForecastingType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_getForecasting *_getForecasting = calloc(1, sizeof(struct agentrank_ns0_getForecasting));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0GetForecastingType(_getForecasting);
        free(_getForecasting);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "forecasting", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}forecasting of type {}forecasting.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ForecastingType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}forecasting of type {}forecasting.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetForecastingType(_getForecasting);
          free(_getForecasting);
          return NULL;
        }

        _getForecasting->forecasting = ((struct agentrank_ns0_forecasting*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "status", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}status of type {}status.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0StatusType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}status of type {}status.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetForecastingType(_getForecasting);
          free(_getForecasting);
          return NULL;
        }

        _getForecasting->status = ((struct agentrank_ns0_status*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}getForecasting.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}getForecasting. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _getForecasting;
}

/**
 * Writes a GetForecasting to XML.
 *
 * @param writer The XML writer.
 * @param _getForecasting The GetForecasting to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0GetForecastingType(xmlTextWriterPtr writer, struct agentrank_ns0_getForecasting *_getForecasting) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_getForecasting->forecasting != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "forecasting", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}forecasting. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}forecasting for element {}forecasting...\n", status);
#endif
    status = xmlTextWriterWriteNs0ForecastingType(writer, (_getForecasting->forecasting));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}forecasting for element {}forecasting. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}forecasting. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_getForecasting->status != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "status", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}status for element {}status...\n", status);
#endif
    status = xmlTextWriterWriteNs0StatusType(writer, (_getForecasting->status));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}status for element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a GetForecasting.
 *
 * @param _getForecasting The GetForecasting to free.
 */
static void freeNs0GetForecastingType(struct agentrank_ns0_getForecasting *_getForecasting) {
  int i;
  if (_getForecasting->forecasting != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor forecasting of type agentrank_ns0_getForecasting...\n");
#endif
    freeNs0ForecastingType(_getForecasting->forecasting);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor forecasting of type agentrank_ns0_getForecasting...\n");
#endif
    free(_getForecasting->forecasting);
  }
  if (_getForecasting->status != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor status of type agentrank_ns0_getForecasting...\n");
#endif
    freeNs0StatusType(_getForecasting->status);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor status of type agentrank_ns0_getForecasting...\n");
#endif
    free(_getForecasting->status);
  }
}
#endif /* DEF_agentrank_ns0_getForecasting_M */
#ifndef DEF_agentrank_ns0_getMarket_M
#define DEF_agentrank_ns0_getMarket_M

/**
 * Reads a GetMarket element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetMarket, or NULL in case of error.
 */
struct agentrank_ns0_getMarket *xml_read_agentrank_ns0_getMarket(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ResponseElement(reader);
}

/**
 * Writes a GetMarket to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getMarket The GetMarket to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_getMarket(xmlTextWriterPtr writer, struct agentrank_ns0_getMarket *_getMarket) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getMarket, 1);
}

/**
 * Frees a GetMarket.
 *
 * @param _getMarket The GetMarket to free.
 */
void free_agentrank_ns0_getMarket(struct agentrank_ns0_getMarket *_getMarket) {
  freeNs0GetMarketType(_getMarket);
  free(_getMarket);
}

/**
 * Reads a GetMarket element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The GetMarket, or NULL in case of error.
 */
struct agentrank_ns0_getMarket *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_getMarket *_getMarket = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "response", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}response.\n");
#endif
    _getMarket = xmlTextReaderReadNs0GetMarketType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_getMarket == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}response failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}response failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _getMarket;
}

/**
 * Writes a GetMarket to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getMarket The GetMarket to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getMarket *_getMarket) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getMarket, 0);
}

/**
 * Writes a GetMarket to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getMarket The GetMarket to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getMarket *_getMarket, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "response", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}getMarket for root element {}response...\n");
#endif
  status = xmlTextWriterWriteNs0GetMarketType(writer, _getMarket);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a GetMarket.
 *
 * @param _getMarket The GetMarket whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getMarket *_getMarket) {
  freeNs0GetMarketType(_getMarket);
}

/**
 * Reads a GetMarket from XML. The reader is assumed to be at the start element.
 *
 * @return the GetMarket, or NULL in case of error.
 */
static struct agentrank_ns0_getMarket *xmlTextReaderReadNs0GetMarketType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_getMarket *_getMarket = calloc(1, sizeof(struct agentrank_ns0_getMarket));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0GetMarketType(_getMarket);
        free(_getMarket);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "market", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}market of type {}market.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0MarketType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}market of type {}market.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetMarketType(_getMarket);
          free(_getMarket);
          return NULL;
        }

        _getMarket->market = ((struct agentrank_ns0_market*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "status", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}status of type {}status.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0StatusType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}status of type {}status.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetMarketType(_getMarket);
          free(_getMarket);
          return NULL;
        }

        _getMarket->status = ((struct agentrank_ns0_status*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}getMarket.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}getMarket. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _getMarket;
}

/**
 * Writes a GetMarket to XML.
 *
 * @param writer The XML writer.
 * @param _getMarket The GetMarket to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0GetMarketType(xmlTextWriterPtr writer, struct agentrank_ns0_getMarket *_getMarket) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_getMarket->market != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "market", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}market. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}market for element {}market...\n", status);
#endif
    status = xmlTextWriterWriteNs0MarketType(writer, (_getMarket->market));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}market for element {}market. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}market. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_getMarket->status != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "status", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}status for element {}status...\n", status);
#endif
    status = xmlTextWriterWriteNs0StatusType(writer, (_getMarket->status));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}status for element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a GetMarket.
 *
 * @param _getMarket The GetMarket to free.
 */
static void freeNs0GetMarketType(struct agentrank_ns0_getMarket *_getMarket) {
  int i;
  if (_getMarket->market != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor market of type agentrank_ns0_getMarket...\n");
#endif
    freeNs0MarketType(_getMarket->market);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor market of type agentrank_ns0_getMarket...\n");
#endif
    free(_getMarket->market);
  }
  if (_getMarket->status != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor status of type agentrank_ns0_getMarket...\n");
#endif
    freeNs0StatusType(_getMarket->status);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor status of type agentrank_ns0_getMarket...\n");
#endif
    free(_getMarket->status);
  }
}
#endif /* DEF_agentrank_ns0_getMarket_M */
#ifndef DEF_agentrank_ns0_getProfile_M
#define DEF_agentrank_ns0_getProfile_M

/**
 * Reads a GetProfile element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetProfile, or NULL in case of error.
 */
struct agentrank_ns0_getProfile *xml_read_agentrank_ns0_getProfile(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ResponseElement(reader);
}

/**
 * Writes a GetProfile to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getProfile The GetProfile to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_getProfile(xmlTextWriterPtr writer, struct agentrank_ns0_getProfile *_getProfile) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getProfile, 1);
}

/**
 * Frees a GetProfile.
 *
 * @param _getProfile The GetProfile to free.
 */
void free_agentrank_ns0_getProfile(struct agentrank_ns0_getProfile *_getProfile) {
  freeNs0GetProfileType(_getProfile);
  free(_getProfile);
}

/**
 * Reads a GetProfile element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The GetProfile, or NULL in case of error.
 */
struct agentrank_ns0_getProfile *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_getProfile *_getProfile = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "response", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}response.\n");
#endif
    _getProfile = xmlTextReaderReadNs0GetProfileType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_getProfile == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}response failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}response failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _getProfile;
}

/**
 * Writes a GetProfile to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getProfile The GetProfile to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getProfile *_getProfile) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getProfile, 0);
}

/**
 * Writes a GetProfile to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getProfile The GetProfile to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getProfile *_getProfile, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "response", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}getProfile for root element {}response...\n");
#endif
  status = xmlTextWriterWriteNs0GetProfileType(writer, _getProfile);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a GetProfile.
 *
 * @param _getProfile The GetProfile whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getProfile *_getProfile) {
  freeNs0GetProfileType(_getProfile);
}

/**
 * Reads a GetProfile from XML. The reader is assumed to be at the start element.
 *
 * @return the GetProfile, or NULL in case of error.
 */
static struct agentrank_ns0_getProfile *xmlTextReaderReadNs0GetProfileType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_getProfile *_getProfile = calloc(1, sizeof(struct agentrank_ns0_getProfile));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0GetProfileType(_getProfile);
        free(_getProfile);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "status", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}status of type {}status.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0StatusType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}status of type {}status.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetProfileType(_getProfile);
          free(_getProfile);
          return NULL;
        }

        _getProfile->status = ((struct agentrank_ns0_status*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "profile", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}profile of type {}profile.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ProfileType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}profile of type {}profile.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetProfileType(_getProfile);
          free(_getProfile);
          return NULL;
        }

        _getProfile->profile = ((struct agentrank_ns0_profile*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}getProfile.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}getProfile. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _getProfile;
}

/**
 * Writes a GetProfile to XML.
 *
 * @param writer The XML writer.
 * @param _getProfile The GetProfile to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0GetProfileType(xmlTextWriterPtr writer, struct agentrank_ns0_getProfile *_getProfile) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_getProfile->status != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "status", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}status for element {}status...\n", status);
#endif
    status = xmlTextWriterWriteNs0StatusType(writer, (_getProfile->status));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}status for element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_getProfile->profile != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "profile", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}profile. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}profile for element {}profile...\n", status);
#endif
    status = xmlTextWriterWriteNs0ProfileType(writer, (_getProfile->profile));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}profile for element {}profile. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}profile. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a GetProfile.
 *
 * @param _getProfile The GetProfile to free.
 */
static void freeNs0GetProfileType(struct agentrank_ns0_getProfile *_getProfile) {
  int i;
  if (_getProfile->status != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor status of type agentrank_ns0_getProfile...\n");
#endif
    freeNs0StatusType(_getProfile->status);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor status of type agentrank_ns0_getProfile...\n");
#endif
    free(_getProfile->status);
  }
  if (_getProfile->profile != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor profile of type agentrank_ns0_getProfile...\n");
#endif
    freeNs0ProfileType(_getProfile->profile);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor profile of type agentrank_ns0_getProfile...\n");
#endif
    free(_getProfile->profile);
  }
}
#endif /* DEF_agentrank_ns0_getProfile_M */
#ifndef DEF_agentrank_ns0_getReviews_M
#define DEF_agentrank_ns0_getReviews_M

/**
 * Reads a GetReviews element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetReviews, or NULL in case of error.
 */
struct agentrank_ns0_getReviews *xml_read_agentrank_ns0_getReviews(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ResponseElement(reader);
}

/**
 * Writes a GetReviews to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getReviews The GetReviews to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_getReviews(xmlTextWriterPtr writer, struct agentrank_ns0_getReviews *_getReviews) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getReviews, 1);
}

/**
 * Frees a GetReviews.
 *
 * @param _getReviews The GetReviews to free.
 */
void free_agentrank_ns0_getReviews(struct agentrank_ns0_getReviews *_getReviews) {
  freeNs0GetReviewsType(_getReviews);
  free(_getReviews);
}

/**
 * Reads a GetReviews element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The GetReviews, or NULL in case of error.
 */
struct agentrank_ns0_getReviews *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_getReviews *_getReviews = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "response", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}response.\n");
#endif
    _getReviews = xmlTextReaderReadNs0GetReviewsType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_getReviews == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}response failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}response failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _getReviews;
}

/**
 * Writes a GetReviews to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getReviews The GetReviews to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getReviews *_getReviews) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getReviews, 0);
}

/**
 * Writes a GetReviews to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getReviews The GetReviews to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getReviews *_getReviews, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "response", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}getReviews for root element {}response...\n");
#endif
  status = xmlTextWriterWriteNs0GetReviewsType(writer, _getReviews);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a GetReviews.
 *
 * @param _getReviews The GetReviews whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getReviews *_getReviews) {
  freeNs0GetReviewsType(_getReviews);
}

/**
 * Reads a GetReviews from XML. The reader is assumed to be at the start element.
 *
 * @return the GetReviews, or NULL in case of error.
 */
static struct agentrank_ns0_getReviews *xmlTextReaderReadNs0GetReviewsType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_getReviews *_getReviews = calloc(1, sizeof(struct agentrank_ns0_getReviews));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0GetReviewsType(_getReviews);
        free(_getReviews);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "status", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}status of type {}status.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0StatusType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}status of type {}status.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetReviewsType(_getReviews);
          free(_getReviews);
          return NULL;
        }

        _getReviews->status = ((struct agentrank_ns0_status*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "reviews", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}reviews of type {}reviews.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ReviewsType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}reviews of type {}reviews.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetReviewsType(_getReviews);
          free(_getReviews);
          return NULL;
        }

        _getReviews->reviews = ((struct agentrank_ns0_reviews*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}getReviews.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}getReviews. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _getReviews;
}

/**
 * Writes a GetReviews to XML.
 *
 * @param writer The XML writer.
 * @param _getReviews The GetReviews to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0GetReviewsType(xmlTextWriterPtr writer, struct agentrank_ns0_getReviews *_getReviews) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_getReviews->status != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "status", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}status for element {}status...\n", status);
#endif
    status = xmlTextWriterWriteNs0StatusType(writer, (_getReviews->status));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}status for element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_getReviews->reviews != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "reviews", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}reviews. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}reviews for element {}reviews...\n", status);
#endif
    status = xmlTextWriterWriteNs0ReviewsType(writer, (_getReviews->reviews));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}reviews for element {}reviews. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}reviews. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a GetReviews.
 *
 * @param _getReviews The GetReviews to free.
 */
static void freeNs0GetReviewsType(struct agentrank_ns0_getReviews *_getReviews) {
  int i;
  if (_getReviews->status != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor status of type agentrank_ns0_getReviews...\n");
#endif
    freeNs0StatusType(_getReviews->status);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor status of type agentrank_ns0_getReviews...\n");
#endif
    free(_getReviews->status);
  }
  if (_getReviews->reviews != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor reviews of type agentrank_ns0_getReviews...\n");
#endif
    freeNs0ReviewsType(_getReviews->reviews);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor reviews of type agentrank_ns0_getReviews...\n");
#endif
    free(_getReviews->reviews);
  }
}
#endif /* DEF_agentrank_ns0_getReviews_M */
#ifndef DEF_agentrank_ns0_getSales_M
#define DEF_agentrank_ns0_getSales_M

/**
 * Reads a GetSales element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The GetSales, or NULL in case of error.
 */
struct agentrank_ns0_getSales *xml_read_agentrank_ns0_getSales(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ResponseElement(reader);
}

/**
 * Writes a GetSales to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getSales The GetSales to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_getSales(xmlTextWriterPtr writer, struct agentrank_ns0_getSales *_getSales) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getSales, 1);
}

/**
 * Frees a GetSales.
 *
 * @param _getSales The GetSales to free.
 */
void free_agentrank_ns0_getSales(struct agentrank_ns0_getSales *_getSales) {
  freeNs0GetSalesType(_getSales);
  free(_getSales);
}

/**
 * Reads a GetSales element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The GetSales, or NULL in case of error.
 */
struct agentrank_ns0_getSales *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_getSales *_getSales = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "response", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}response.\n");
#endif
    _getSales = xmlTextReaderReadNs0GetSalesType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_getSales == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}response failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}response failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _getSales;
}

/**
 * Writes a GetSales to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _getSales The GetSales to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_getSales *_getSales) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _getSales, 0);
}

/**
 * Writes a GetSales to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _getSales The GetSales to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_getSales *_getSales, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "response", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}getSales for root element {}response...\n");
#endif
  status = xmlTextWriterWriteNs0GetSalesType(writer, _getSales);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a GetSales.
 *
 * @param _getSales The GetSales whose children are to be free.
 */
static void freeNs0ResponseElement(struct agentrank_ns0_getSales *_getSales) {
  freeNs0GetSalesType(_getSales);
}

/**
 * Reads a GetSales from XML. The reader is assumed to be at the start element.
 *
 * @return the GetSales, or NULL in case of error.
 */
static struct agentrank_ns0_getSales *xmlTextReaderReadNs0GetSalesType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_getSales *_getSales = calloc(1, sizeof(struct agentrank_ns0_getSales));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0GetSalesType(_getSales);
        free(_getSales);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "sales", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}sales of type {}sales.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0SalesType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}sales of type {}sales.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetSalesType(_getSales);
          free(_getSales);
          return NULL;
        }

        _getSales->sales = ((struct agentrank_ns0_sales*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "status", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}status of type {}status.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0StatusType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}status of type {}status.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0GetSalesType(_getSales);
          free(_getSales);
          return NULL;
        }

        _getSales->status = ((struct agentrank_ns0_status*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}getSales.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}getSales. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _getSales;
}

/**
 * Writes a GetSales to XML.
 *
 * @param writer The XML writer.
 * @param _getSales The GetSales to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0GetSalesType(xmlTextWriterPtr writer, struct agentrank_ns0_getSales *_getSales) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_getSales->sales != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "sales", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}sales. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}sales for element {}sales...\n", status);
#endif
    status = xmlTextWriterWriteNs0SalesType(writer, (_getSales->sales));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}sales for element {}sales. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}sales. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_getSales->status != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "status", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}status for element {}status...\n", status);
#endif
    status = xmlTextWriterWriteNs0StatusType(writer, (_getSales->status));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}status for element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}status. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a GetSales.
 *
 * @param _getSales The GetSales to free.
 */
static void freeNs0GetSalesType(struct agentrank_ns0_getSales *_getSales) {
  int i;
  if (_getSales->sales != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor sales of type agentrank_ns0_getSales...\n");
#endif
    freeNs0SalesType(_getSales->sales);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor sales of type agentrank_ns0_getSales...\n");
#endif
    free(_getSales->sales);
  }
  if (_getSales->status != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor status of type agentrank_ns0_getSales...\n");
#endif
    freeNs0StatusType(_getSales->status);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor status of type agentrank_ns0_getSales...\n");
#endif
    free(_getSales->status);
  }
}
#endif /* DEF_agentrank_ns0_getSales_M */
#ifndef DEF_agentrank_ns0_histories_M
#define DEF_agentrank_ns0_histories_M

/**
 * Reads a Histories from XML. The reader is assumed to be at the start element.
 *
 * @return the Histories, or NULL in case of error.
 */
static struct agentrank_ns0_histories *xmlTextReaderReadNs0HistoriesType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_histories *_histories = calloc(1, sizeof(struct agentrank_ns0_histories));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0HistoriesType(_histories);
        free(_histories);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "history", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}history of type {}history.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0HistoryType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}history of type {}history.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0HistoriesType(_histories);
          free(_histories);
          return NULL;
        }

        _histories->history = realloc(_histories->history, (_histories->_sizeof_history + 1) * sizeof(struct agentrank_ns0_history));
        memcpy(&(_histories->history[_histories->_sizeof_history++]), _child_accessor, sizeof(struct agentrank_ns0_history));
        free(_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}histories.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}histories. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _histories;
}

/**
 * Writes a Histories to XML.
 *
 * @param writer The XML writer.
 * @param _histories The Histories to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0HistoriesType(xmlTextWriterPtr writer, struct agentrank_ns0_histories *_histories) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  for (i = 0; i < _histories->_sizeof_history; i++) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "history", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}history. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}history for element {}history...\n", status);
#endif
    status = xmlTextWriterWriteNs0HistoryType(writer, &(_histories->history[i]));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}history for element {}history. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}history. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Histories.
 *
 * @param _histories The Histories to free.
 */
static void freeNs0HistoriesType(struct agentrank_ns0_histories *_histories) {
  int i;
  if (_histories->history != NULL) {
    for (i = 0; i < _histories->_sizeof_history; i++) {
#if DEBUG_ENUNCIATE > 1
      printf("Freeing accessor history[%i] of type agentrank_ns0_histories...\n", i);
#endif
      freeNs0HistoryType(&(_histories->history[i]));
    }
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor history of type agentrank_ns0_histories...\n");
#endif
    free(_histories->history);
  }
}
#endif /* DEF_agentrank_ns0_histories_M */
#ifndef DEF_agentrank_ns0_history_M
#define DEF_agentrank_ns0_history_M

/**
 * Reads a History from XML. The reader is assumed to be at the start element.
 *
 * @return the History, or NULL in case of error.
 */
static struct agentrank_ns0_history *xmlTextReaderReadNs0HistoryType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_history *_history = calloc(1, sizeof(struct agentrank_ns0_history));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0HistoryType(_history);
        free(_history);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "date", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}date of type {http://www.w3.org/2001/XMLSchema}dateTime.\n");
#endif
        _child_accessor = xmlTextReaderReadXsDateTimeType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}date of type {http://www.w3.org/2001/XMLSchema}dateTime.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0HistoryType(_history);
          free(_history);
          return NULL;
        }

        _history->date = ((struct tm*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "market", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}market of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}market of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0HistoryType(_history);
          free(_history);
          return NULL;
        }

        _history->market = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "metric", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}metric of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}metric of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0HistoryType(_history);
          free(_history);
          return NULL;
        }

        _history->metric = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "value", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}value of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
        _child_accessor = xmlTextReaderReadXsDecimalType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}value of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0HistoryType(_history);
          free(_history);
          return NULL;
        }

        _history->value = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}history.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}history. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _history;
}

/**
 * Writes a History to XML.
 *
 * @param writer The XML writer.
 * @param _history The History to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0HistoryType(xmlTextWriterPtr writer, struct agentrank_ns0_history *_history) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_history->date != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "date", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}date. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}dateTime for element {}date...\n", status);
#endif
    status = xmlTextWriterWriteXsDateTimeType(writer, (_history->date));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}dateTime for element {}date. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}date. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_history->market != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "market", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}market. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}market...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_history->market));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}market. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}market. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_history->metric != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "metric", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}metric. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}metric...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_history->metric));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}metric. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}metric. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_history->value != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "value", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}value. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}decimal for element {}value...\n", status);
#endif
    status = xmlTextWriterWriteXsDecimalType(writer, (_history->value));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}decimal for element {}value. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}value. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a History.
 *
 * @param _history The History to free.
 */
static void freeNs0HistoryType(struct agentrank_ns0_history *_history) {
  int i;
  if (_history->date != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor date of type agentrank_ns0_history...\n");
#endif
    freeXsDateTimeType(_history->date);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor date of type agentrank_ns0_history...\n");
#endif
    free(_history->date);
  }
  if (_history->market != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor market of type agentrank_ns0_history...\n");
#endif
    freeXsStringType(_history->market);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor market of type agentrank_ns0_history...\n");
#endif
    free(_history->market);
  }
  if (_history->metric != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor metric of type agentrank_ns0_history...\n");
#endif
    freeXsStringType(_history->metric);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor metric of type agentrank_ns0_history...\n");
#endif
    free(_history->metric);
  }
  if (_history->value != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor value of type agentrank_ns0_history...\n");
#endif
    freeXsDecimalType(_history->value);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor value of type agentrank_ns0_history...\n");
#endif
    free(_history->value);
  }
}
#endif /* DEF_agentrank_ns0_history_M */
#ifndef DEF_agentrank_ns0_location_M
#define DEF_agentrank_ns0_location_M

/**
 * Reads a Location from XML. The reader is assumed to be at the start element.
 *
 * @return the Location, or NULL in case of error.
 */
static struct agentrank_ns0_location *xmlTextReaderReadNs0LocationType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_location *_location = calloc(1, sizeof(struct agentrank_ns0_location));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0LocationType(_location);
        free(_location);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "id", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}id of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
        _child_accessor = xmlTextReaderReadXsIntType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}id of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0LocationType(_location);
          free(_location);
          return NULL;
        }

        _location->id = *((int*)_child_accessor);
        free(_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "type", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}type of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}type of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0LocationType(_location);
          free(_location);
          return NULL;
        }

        _location->type = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "name", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}name of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}name of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0LocationType(_location);
          free(_location);
          return NULL;
        }

        _location->name = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}location.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}location. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _location;
}

/**
 * Writes a Location to XML.
 *
 * @param writer The XML writer.
 * @param _location The Location to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0LocationType(xmlTextWriterPtr writer, struct agentrank_ns0_location *_location) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (1) { //always write the primitive element.
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "id", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}id. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}int for element {}id...\n", status);
#endif
    status = xmlTextWriterWriteXsIntType(writer, &(_location->id));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}int for element {}id. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}id. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_location->type != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "type", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}type. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}type...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_location->type));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}type. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}type. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_location->name != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "name", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}name. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}name...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_location->name));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}name. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}name. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Location.
 *
 * @param _location The Location to free.
 */
static void freeNs0LocationType(struct agentrank_ns0_location *_location) {
  int i;
  if (_location->type != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor type of type agentrank_ns0_location...\n");
#endif
    freeXsStringType(_location->type);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor type of type agentrank_ns0_location...\n");
#endif
    free(_location->type);
  }
  if (_location->name != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor name of type agentrank_ns0_location...\n");
#endif
    freeXsStringType(_location->name);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor name of type agentrank_ns0_location...\n");
#endif
    free(_location->name);
  }
}
#endif /* DEF_agentrank_ns0_location_M */
#ifndef DEF_agentrank_ns0_locations_M
#define DEF_agentrank_ns0_locations_M

/**
 * Reads a Locations element from XML. The element to be read is "locations", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Locations, or NULL in case of error.
 */
struct agentrank_ns0_locations *xml_read_agentrank_ns0_locations(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0LocationsElement(reader);
}

/**
 * Writes a Locations to XML under element name "locations".
 *
 * @param writer The XML writer.
 * @param _locations The Locations to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_locations(xmlTextWriterPtr writer, struct agentrank_ns0_locations *_locations) {
  return xmlTextWriterWriteNs0LocationsElementNS(writer, _locations, 1);
}

/**
 * Frees a Locations.
 *
 * @param _locations The Locations to free.
 */
void free_agentrank_ns0_locations(struct agentrank_ns0_locations *_locations) {
  freeNs0LocationsType(_locations);
  free(_locations);
}

/**
 * Reads a Locations element from XML. The element to be read is "locations", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Locations, or NULL in case of error.
 */
struct agentrank_ns0_locations *xmlTextReaderReadNs0LocationsElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_locations *_locations = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "locations", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}locations.\n");
#endif
    _locations = xmlTextReaderReadNs0LocationsType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_locations == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}locations failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}locations failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _locations;
}

/**
 * Writes a Locations to XML under element name "locations".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _locations The Locations to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0LocationsElement(xmlTextWriterPtr writer, struct agentrank_ns0_locations *_locations) {
  return xmlTextWriterWriteNs0LocationsElementNS(writer, _locations, 0);
}

/**
 * Writes a Locations to XML under element name "locations".
 *
 * @param writer The XML writer.
 * @param _locations The Locations to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0LocationsElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_locations *_locations, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "locations", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}locations. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}locations for root element {}locations...\n");
#endif
  status = xmlTextWriterWriteNs0LocationsType(writer, _locations);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}locations. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}locations. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Locations.
 *
 * @param _locations The Locations whose children are to be free.
 */
static void freeNs0LocationsElement(struct agentrank_ns0_locations *_locations) {
  freeNs0LocationsType(_locations);
}

/**
 * Reads a Locations from XML. The reader is assumed to be at the start element.
 *
 * @return the Locations, or NULL in case of error.
 */
static struct agentrank_ns0_locations *xmlTextReaderReadNs0LocationsType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_locations *_locations = calloc(1, sizeof(struct agentrank_ns0_locations));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0LocationsType(_locations);
        free(_locations);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "location", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}location of type {}location.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0LocationType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}location of type {}location.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0LocationsType(_locations);
          free(_locations);
          return NULL;
        }

        _locations->location = realloc(_locations->location, (_locations->_sizeof_location + 1) * sizeof(struct agentrank_ns0_location));
        memcpy(&(_locations->location[_locations->_sizeof_location++]), _child_accessor, sizeof(struct agentrank_ns0_location));
        free(_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}locations.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}locations. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _locations;
}

/**
 * Writes a Locations to XML.
 *
 * @param writer The XML writer.
 * @param _locations The Locations to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0LocationsType(xmlTextWriterPtr writer, struct agentrank_ns0_locations *_locations) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  for (i = 0; i < _locations->_sizeof_location; i++) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "location", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}location. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}location for element {}location...\n", status);
#endif
    status = xmlTextWriterWriteNs0LocationType(writer, &(_locations->location[i]));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}location for element {}location. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}location. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Locations.
 *
 * @param _locations The Locations to free.
 */
static void freeNs0LocationsType(struct agentrank_ns0_locations *_locations) {
  int i;
  if (_locations->location != NULL) {
    for (i = 0; i < _locations->_sizeof_location; i++) {
#if DEBUG_ENUNCIATE > 1
      printf("Freeing accessor location[%i] of type agentrank_ns0_locations...\n", i);
#endif
      freeNs0LocationType(&(_locations->location[i]));
    }
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor location of type agentrank_ns0_locations...\n");
#endif
    free(_locations->location);
  }
}
#endif /* DEF_agentrank_ns0_locations_M */
#ifndef DEF_agentrank_ns0_market_M
#define DEF_agentrank_ns0_market_M

/**
 * Reads a Market element from XML. The element to be read is "market", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Market, or NULL in case of error.
 */
struct agentrank_ns0_market *xml_read_agentrank_ns0_market(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0MarketElement(reader);
}

/**
 * Writes a Market to XML under element name "market".
 *
 * @param writer The XML writer.
 * @param _market The Market to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_market(xmlTextWriterPtr writer, struct agentrank_ns0_market *_market) {
  return xmlTextWriterWriteNs0MarketElementNS(writer, _market, 1);
}

/**
 * Frees a Market.
 *
 * @param _market The Market to free.
 */
void free_agentrank_ns0_market(struct agentrank_ns0_market *_market) {
  freeNs0MarketType(_market);
  free(_market);
}

/**
 * Reads a Market element from XML. The element to be read is "market", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Market, or NULL in case of error.
 */
struct agentrank_ns0_market *xmlTextReaderReadNs0MarketElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_market *_market = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "market", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}market.\n");
#endif
    _market = xmlTextReaderReadNs0MarketType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_market == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}market failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}market failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _market;
}

/**
 * Writes a Market to XML under element name "market".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _market The Market to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0MarketElement(xmlTextWriterPtr writer, struct agentrank_ns0_market *_market) {
  return xmlTextWriterWriteNs0MarketElementNS(writer, _market, 0);
}

/**
 * Writes a Market to XML under element name "market".
 *
 * @param writer The XML writer.
 * @param _market The Market to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0MarketElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_market *_market, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "market", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}market. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}market for root element {}market...\n");
#endif
  status = xmlTextWriterWriteNs0MarketType(writer, _market);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}market. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}market. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Market.
 *
 * @param _market The Market whose children are to be free.
 */
static void freeNs0MarketElement(struct agentrank_ns0_market *_market) {
  freeNs0MarketType(_market);
}

/**
 * Reads a Market from XML. The reader is assumed to be at the start element.
 *
 * @return the Market, or NULL in case of error.
 */
static struct agentrank_ns0_market *xmlTextReaderReadNs0MarketType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_market *_market = calloc(1, sizeof(struct agentrank_ns0_market));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0MarketType(_market);
        free(_market);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "name", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}name of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}name of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0MarketType(_market);
          free(_market);
          return NULL;
        }

        _market->name = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "histories", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}histories of type {}histories.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0HistoriesType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}histories of type {}histories.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0MarketType(_market);
          free(_market);
          return NULL;
        }

        _market->histories = ((struct agentrank_ns0_histories*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "forecasts", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}forecasts of type {}forecasts.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ForecastsType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}forecasts of type {}forecasts.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0MarketType(_market);
          free(_market);
          return NULL;
        }

        _market->forecasts = ((struct agentrank_ns0_forecasts*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}market.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}market. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _market;
}

/**
 * Writes a Market to XML.
 *
 * @param writer The XML writer.
 * @param _market The Market to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0MarketType(xmlTextWriterPtr writer, struct agentrank_ns0_market *_market) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_market->name != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "name", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}name. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}name...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_market->name));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}name. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}name. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_market->histories != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "histories", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}histories. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}histories for element {}histories...\n", status);
#endif
    status = xmlTextWriterWriteNs0HistoriesType(writer, (_market->histories));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}histories for element {}histories. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}histories. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_market->forecasts != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "forecasts", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}forecasts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}forecasts for element {}forecasts...\n", status);
#endif
    status = xmlTextWriterWriteNs0ForecastsType(writer, (_market->forecasts));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}forecasts for element {}forecasts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}forecasts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Market.
 *
 * @param _market The Market to free.
 */
static void freeNs0MarketType(struct agentrank_ns0_market *_market) {
  int i;
  if (_market->name != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor name of type agentrank_ns0_market...\n");
#endif
    freeXsStringType(_market->name);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor name of type agentrank_ns0_market...\n");
#endif
    free(_market->name);
  }
  if (_market->histories != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor histories of type agentrank_ns0_market...\n");
#endif
    freeNs0HistoriesType(_market->histories);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor histories of type agentrank_ns0_market...\n");
#endif
    free(_market->histories);
  }
  if (_market->forecasts != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor forecasts of type agentrank_ns0_market...\n");
#endif
    freeNs0ForecastsType(_market->forecasts);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor forecasts of type agentrank_ns0_market...\n");
#endif
    free(_market->forecasts);
  }
}
#endif /* DEF_agentrank_ns0_market_M */
#ifndef DEF_agentrank_ns0_photoSize_M
#define DEF_agentrank_ns0_photoSize_M

/**
 * Reads a PhotoSize element from XML. The element to be read is "photoSize", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The PhotoSize, or NULL in case of error.
 */
struct agentrank_ns0_photoSize *xml_read_agentrank_ns0_photoSize(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0PhotoSizeElement(reader);
}

/**
 * Writes a PhotoSize to XML under element name "photoSize".
 *
 * @param writer The XML writer.
 * @param _photoSize The PhotoSize to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_photoSize(xmlTextWriterPtr writer, struct agentrank_ns0_photoSize *_photoSize) {
  return xmlTextWriterWriteNs0PhotoSizeElementNS(writer, _photoSize, 1);
}

/**
 * Frees a PhotoSize.
 *
 * @param _photoSize The PhotoSize to free.
 */
void free_agentrank_ns0_photoSize(struct agentrank_ns0_photoSize *_photoSize) {
  freeNs0PhotoSizeType(_photoSize);
  free(_photoSize);
}

/**
 * Reads a PhotoSize element from XML. The element to be read is "photoSize", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The PhotoSize, or NULL in case of error.
 */
struct agentrank_ns0_photoSize *xmlTextReaderReadNs0PhotoSizeElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_photoSize *_photoSize = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "photoSize", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}photoSize.\n");
#endif
    _photoSize = xmlTextReaderReadNs0PhotoSizeType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_photoSize == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}photoSize failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}photoSize failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _photoSize;
}

/**
 * Writes a PhotoSize to XML under element name "photoSize".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _photoSize The PhotoSize to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0PhotoSizeElement(xmlTextWriterPtr writer, struct agentrank_ns0_photoSize *_photoSize) {
  return xmlTextWriterWriteNs0PhotoSizeElementNS(writer, _photoSize, 0);
}

/**
 * Writes a PhotoSize to XML under element name "photoSize".
 *
 * @param writer The XML writer.
 * @param _photoSize The PhotoSize to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0PhotoSizeElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_photoSize *_photoSize, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "photoSize", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}photoSize. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}photoSize for root element {}photoSize...\n");
#endif
  status = xmlTextWriterWriteNs0PhotoSizeType(writer, _photoSize);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}photoSize. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}photoSize. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a PhotoSize.
 *
 * @param _photoSize The PhotoSize whose children are to be free.
 */
static void freeNs0PhotoSizeElement(struct agentrank_ns0_photoSize *_photoSize) {
  freeNs0PhotoSizeType(_photoSize);
}

/**
 * Reads a PhotoSize from XML. The reader is assumed to be at the start element.
 *
 * @return the PhotoSize, or NULL in case of error.
 */
static struct agentrank_ns0_photoSize *xmlTextReaderReadNs0PhotoSizeType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_photoSize *_photoSize = calloc(1, sizeof(struct agentrank_ns0_photoSize));

  if (xmlTextReaderHasAttributes(reader)) {
    while (xmlTextReaderMoveToNextAttribute(reader)) {
      if ((xmlStrcmp(BAD_CAST "height", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}int from attribute {}height...\n");
#endif
        _child_accessor = xmlTextReaderReadXsIntType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}height of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
          freeNs0PhotoSizeType(_photoSize);
          free(_photoSize);
          return NULL;
        }
        _photoSize->height = *((int*)_child_accessor);
        freeXsIntType((int*) _child_accessor);
        free(_child_accessor);
        continue;
      }
      if ((xmlStrcmp(BAD_CAST "width", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}int from attribute {}width...\n");
#endif
        _child_accessor = xmlTextReaderReadXsIntType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}width of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
          freeNs0PhotoSizeType(_photoSize);
          free(_photoSize);
          return NULL;
        }
        _photoSize->width = *((int*)_child_accessor);
        freeXsIntType((int*) _child_accessor);
        free(_child_accessor);
        continue;
      }
      if ((xmlStrcmp(BAD_CAST "type", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}type...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}type of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0PhotoSizeType(_photoSize);
          free(_photoSize);
          return NULL;
        }
        _photoSize->type = ((xmlChar*)_child_accessor);
        continue;
      }
    }

    status = xmlTextReaderMoveToElement(reader);
    if (status < 1) {
      //panic: unable to return to the element node.
#if DEBUG_ENUNCIATE
      printf("Unable to return to element node from attributes.\n");
#endif
      freeNs0PhotoSizeType(_photoSize);
      free(_photoSize);
      return NULL;
    }
  }



  return _photoSize;
}

/**
 * Writes a PhotoSize to XML.
 *
 * @param writer The XML writer.
 * @param _photoSize The PhotoSize to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0PhotoSizeType(xmlTextWriterPtr writer, struct agentrank_ns0_photoSize *_photoSize) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;

  if (1) { //always write the primitive attribute
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "height", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}height. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}int for attribute {}height...\n");
#endif
    status = xmlTextWriterWriteXsIntType(writer, &(_photoSize->height));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}int for attribute {}height. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}height. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (1) { //always write the primitive attribute
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "width", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}width. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}int for attribute {}width...\n");
#endif
    status = xmlTextWriterWriteXsIntType(writer, &(_photoSize->width));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}int for attribute {}width. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}width. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (_photoSize->type != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "type", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}type. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}type...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_photoSize->type));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}type. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}type. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a PhotoSize.
 *
 * @param _photoSize The PhotoSize to free.
 */
static void freeNs0PhotoSizeType(struct agentrank_ns0_photoSize *_photoSize) {
  int i;
  if (_photoSize->type != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor type of type agentrank_ns0_photoSize...\n");
#endif
    freeXsStringType(_photoSize->type);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor type of type agentrank_ns0_photoSize...\n");
#endif
    free(_photoSize->type);
  }
}
#endif /* DEF_agentrank_ns0_photoSize_M */
#ifndef DEF_agentrank_ns0_photoSizes_M
#define DEF_agentrank_ns0_photoSizes_M

/**
 * Reads a PhotoSizes element from XML. The element to be read is "photoSizes", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The PhotoSizes, or NULL in case of error.
 */
struct agentrank_ns0_photoSizes *xml_read_agentrank_ns0_photoSizes(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0PhotoSizesElement(reader);
}

/**
 * Writes a PhotoSizes to XML under element name "photoSizes".
 *
 * @param writer The XML writer.
 * @param _photoSizes The PhotoSizes to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_photoSizes(xmlTextWriterPtr writer, struct agentrank_ns0_photoSizes *_photoSizes) {
  return xmlTextWriterWriteNs0PhotoSizesElementNS(writer, _photoSizes, 1);
}

/**
 * Frees a PhotoSizes.
 *
 * @param _photoSizes The PhotoSizes to free.
 */
void free_agentrank_ns0_photoSizes(struct agentrank_ns0_photoSizes *_photoSizes) {
  freeNs0PhotoSizesType(_photoSizes);
  free(_photoSizes);
}

/**
 * Reads a PhotoSizes element from XML. The element to be read is "photoSizes", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The PhotoSizes, or NULL in case of error.
 */
struct agentrank_ns0_photoSizes *xmlTextReaderReadNs0PhotoSizesElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_photoSizes *_photoSizes = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "photoSizes", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}photoSizes.\n");
#endif
    _photoSizes = xmlTextReaderReadNs0PhotoSizesType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_photoSizes == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}photoSizes failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}photoSizes failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _photoSizes;
}

/**
 * Writes a PhotoSizes to XML under element name "photoSizes".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _photoSizes The PhotoSizes to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0PhotoSizesElement(xmlTextWriterPtr writer, struct agentrank_ns0_photoSizes *_photoSizes) {
  return xmlTextWriterWriteNs0PhotoSizesElementNS(writer, _photoSizes, 0);
}

/**
 * Writes a PhotoSizes to XML under element name "photoSizes".
 *
 * @param writer The XML writer.
 * @param _photoSizes The PhotoSizes to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0PhotoSizesElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_photoSizes *_photoSizes, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "photoSizes", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}photoSizes. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}photoSizes for root element {}photoSizes...\n");
#endif
  status = xmlTextWriterWriteNs0PhotoSizesType(writer, _photoSizes);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}photoSizes. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}photoSizes. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a PhotoSizes.
 *
 * @param _photoSizes The PhotoSizes whose children are to be free.
 */
static void freeNs0PhotoSizesElement(struct agentrank_ns0_photoSizes *_photoSizes) {
  freeNs0PhotoSizesType(_photoSizes);
}

/**
 * Reads a PhotoSizes from XML. The reader is assumed to be at the start element.
 *
 * @return the PhotoSizes, or NULL in case of error.
 */
static struct agentrank_ns0_photoSizes *xmlTextReaderReadNs0PhotoSizesType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_photoSizes *_photoSizes = calloc(1, sizeof(struct agentrank_ns0_photoSizes));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0PhotoSizesType(_photoSizes);
        free(_photoSizes);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "size", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}size of type {}photoSize.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0PhotoSizeType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}size of type {}photoSize.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0PhotoSizesType(_photoSizes);
          free(_photoSizes);
          return NULL;
        }

        _photoSizes->size = realloc(_photoSizes->size, (_photoSizes->_sizeof_size + 1) * sizeof(struct agentrank_ns0_photoSize));
        memcpy(&(_photoSizes->size[_photoSizes->_sizeof_size++]), _child_accessor, sizeof(struct agentrank_ns0_photoSize));
        free(_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}photoSizes.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}photoSizes. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _photoSizes;
}

/**
 * Writes a PhotoSizes to XML.
 *
 * @param writer The XML writer.
 * @param _photoSizes The PhotoSizes to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0PhotoSizesType(xmlTextWriterPtr writer, struct agentrank_ns0_photoSizes *_photoSizes) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  for (i = 0; i < _photoSizes->_sizeof_size; i++) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "size", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}size. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}photoSize for element {}size...\n", status);
#endif
    status = xmlTextWriterWriteNs0PhotoSizeType(writer, &(_photoSizes->size[i]));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}photoSize for element {}size. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}size. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a PhotoSizes.
 *
 * @param _photoSizes The PhotoSizes to free.
 */
static void freeNs0PhotoSizesType(struct agentrank_ns0_photoSizes *_photoSizes) {
  int i;
  if (_photoSizes->size != NULL) {
    for (i = 0; i < _photoSizes->_sizeof_size; i++) {
#if DEBUG_ENUNCIATE > 1
      printf("Freeing accessor size[%i] of type agentrank_ns0_photoSizes...\n", i);
#endif
      freeNs0PhotoSizeType(&(_photoSizes->size[i]));
    }
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor size of type agentrank_ns0_photoSizes...\n");
#endif
    free(_photoSizes->size);
  }
}
#endif /* DEF_agentrank_ns0_photoSizes_M */
#ifndef DEF_agentrank_ns0_agent_M
#define DEF_agentrank_ns0_agent_M

/**
 * Reads a Agent element from XML. The element to be read is "agent", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Agent, or NULL in case of error.
 */
struct agentrank_ns0_agent *xml_read_agentrank_ns0_agent(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0AgentElement(reader);
}

/**
 * Writes a Agent to XML under element name "agent".
 *
 * @param writer The XML writer.
 * @param _agent The Agent to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_agent(xmlTextWriterPtr writer, struct agentrank_ns0_agent *_agent) {
  return xmlTextWriterWriteNs0AgentElementNS(writer, _agent, 1);
}

/**
 * Frees a Agent.
 *
 * @param _agent The Agent to free.
 */
void free_agentrank_ns0_agent(struct agentrank_ns0_agent *_agent) {
  freeNs0AgentType(_agent);
  free(_agent);
}

/**
 * Reads a Agent element from XML. The element to be read is "agent", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Agent, or NULL in case of error.
 */
struct agentrank_ns0_agent *xmlTextReaderReadNs0AgentElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_agent *_agent = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "agent", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}agent.\n");
#endif
    _agent = xmlTextReaderReadNs0AgentType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_agent == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}agent failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}agent failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _agent;
}

/**
 * Writes a Agent to XML under element name "agent".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _agent The Agent to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0AgentElement(xmlTextWriterPtr writer, struct agentrank_ns0_agent *_agent) {
  return xmlTextWriterWriteNs0AgentElementNS(writer, _agent, 0);
}

/**
 * Writes a Agent to XML under element name "agent".
 *
 * @param writer The XML writer.
 * @param _agent The Agent to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0AgentElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_agent *_agent, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "agent", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}agent. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}agent for root element {}agent...\n");
#endif
  status = xmlTextWriterWriteNs0AgentType(writer, _agent);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}agent. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}agent. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Agent.
 *
 * @param _agent The Agent whose children are to be free.
 */
static void freeNs0AgentElement(struct agentrank_ns0_agent *_agent) {
  freeNs0AgentType(_agent);
}

/**
 * Reads a Agent from XML. The reader is assumed to be at the start element.
 *
 * @return the Agent, or NULL in case of error.
 */
static struct agentrank_ns0_agent *xmlTextReaderReadNs0AgentType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_agent *_agent = calloc(1, sizeof(struct agentrank_ns0_agent));

  if (xmlTextReaderHasAttributes(reader)) {
    while (xmlTextReaderMoveToNextAttribute(reader)) {
      if ((xmlStrcmp(BAD_CAST "id", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}id...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}id of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0AgentType(_agent);
          free(_agent);
          return NULL;
        }
        _agent->id = ((xmlChar*)_child_accessor);
        continue;
      }
    }

    status = xmlTextReaderMoveToElement(reader);
    if (status < 1) {
      //panic: unable to return to the element node.
#if DEBUG_ENUNCIATE
      printf("Unable to return to element node from attributes.\n");
#endif
      freeNs0AgentType(_agent);
      free(_agent);
      return NULL;
    }
  }


  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0AgentType(_agent);
        free(_agent);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "sales", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}sales of type {}sales.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0SalesType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}sales of type {}sales.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0AgentType(_agent);
          free(_agent);
          return NULL;
        }

        _agent->sales = ((struct agentrank_ns0_sales*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "profile", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}profile of type {}profile.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ProfileType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}profile of type {}profile.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0AgentType(_agent);
          free(_agent);
          return NULL;
        }

        _agent->profile = ((struct agentrank_ns0_profile*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "reviews", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}reviews of type {}reviews.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ReviewsType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}reviews of type {}reviews.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0AgentType(_agent);
          free(_agent);
          return NULL;
        }

        _agent->reviews = ((struct agentrank_ns0_reviews*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "forecasts", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}forecasts of type {}forecasts.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ForecastsType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}forecasts of type {}forecasts.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0AgentType(_agent);
          free(_agent);
          return NULL;
        }

        _agent->forecasts = ((struct agentrank_ns0_forecasts*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}agent.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}agent. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _agent;
}

/**
 * Writes a Agent to XML.
 *
 * @param writer The XML writer.
 * @param _agent The Agent to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0AgentType(xmlTextWriterPtr writer, struct agentrank_ns0_agent *_agent) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;

  if (_agent->id != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "id", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}id. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}id...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_agent->id));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}id. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}id. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_agent->sales != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "sales", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}sales. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}sales for element {}sales...\n", status);
#endif
    status = xmlTextWriterWriteNs0SalesType(writer, (_agent->sales));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}sales for element {}sales. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}sales. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_agent->profile != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "profile", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}profile. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}profile for element {}profile...\n", status);
#endif
    status = xmlTextWriterWriteNs0ProfileType(writer, (_agent->profile));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}profile for element {}profile. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}profile. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_agent->reviews != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "reviews", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}reviews. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}reviews for element {}reviews...\n", status);
#endif
    status = xmlTextWriterWriteNs0ReviewsType(writer, (_agent->reviews));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}reviews for element {}reviews. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}reviews. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_agent->forecasts != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "forecasts", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}forecasts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}forecasts for element {}forecasts...\n", status);
#endif
    status = xmlTextWriterWriteNs0ForecastsType(writer, (_agent->forecasts));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}forecasts for element {}forecasts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}forecasts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Agent.
 *
 * @param _agent The Agent to free.
 */
static void freeNs0AgentType(struct agentrank_ns0_agent *_agent) {
  int i;
  if (_agent->id != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor id of type agentrank_ns0_agent...\n");
#endif
    freeXsStringType(_agent->id);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor id of type agentrank_ns0_agent...\n");
#endif
    free(_agent->id);
  }
  if (_agent->sales != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor sales of type agentrank_ns0_agent...\n");
#endif
    freeNs0SalesType(_agent->sales);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor sales of type agentrank_ns0_agent...\n");
#endif
    free(_agent->sales);
  }
  if (_agent->profile != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor profile of type agentrank_ns0_agent...\n");
#endif
    freeNs0ProfileType(_agent->profile);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor profile of type agentrank_ns0_agent...\n");
#endif
    free(_agent->profile);
  }
  if (_agent->reviews != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor reviews of type agentrank_ns0_agent...\n");
#endif
    freeNs0ReviewsType(_agent->reviews);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor reviews of type agentrank_ns0_agent...\n");
#endif
    free(_agent->reviews);
  }
  if (_agent->forecasts != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor forecasts of type agentrank_ns0_agent...\n");
#endif
    freeNs0ForecastsType(_agent->forecasts);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor forecasts of type agentrank_ns0_agent...\n");
#endif
    free(_agent->forecasts);
  }
}
#endif /* DEF_agentrank_ns0_agent_M */
#ifndef DEF_agentrank_ns0_forecast_M
#define DEF_agentrank_ns0_forecast_M

/**
 * Reads a Forecast element from XML. The element to be read is "forecast", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Forecast, or NULL in case of error.
 */
struct agentrank_ns0_forecast *xml_read_agentrank_ns0_forecast(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ForecastElement(reader);
}

/**
 * Writes a Forecast to XML under element name "forecast".
 *
 * @param writer The XML writer.
 * @param _forecast The Forecast to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_forecast(xmlTextWriterPtr writer, struct agentrank_ns0_forecast *_forecast) {
  return xmlTextWriterWriteNs0ForecastElementNS(writer, _forecast, 1);
}

/**
 * Frees a Forecast.
 *
 * @param _forecast The Forecast to free.
 */
void free_agentrank_ns0_forecast(struct agentrank_ns0_forecast *_forecast) {
  freeNs0ForecastType(_forecast);
  free(_forecast);
}

/**
 * Reads a Forecast element from XML. The element to be read is "forecast", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Forecast, or NULL in case of error.
 */
struct agentrank_ns0_forecast *xmlTextReaderReadNs0ForecastElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_forecast *_forecast = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "forecast", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}forecast.\n");
#endif
    _forecast = xmlTextReaderReadNs0ForecastType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_forecast == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}forecast failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}forecast failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _forecast;
}

/**
 * Writes a Forecast to XML under element name "forecast".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _forecast The Forecast to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ForecastElement(xmlTextWriterPtr writer, struct agentrank_ns0_forecast *_forecast) {
  return xmlTextWriterWriteNs0ForecastElementNS(writer, _forecast, 0);
}

/**
 * Writes a Forecast to XML under element name "forecast".
 *
 * @param writer The XML writer.
 * @param _forecast The Forecast to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ForecastElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_forecast *_forecast, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "forecast", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}forecast. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}forecast for root element {}forecast...\n");
#endif
  status = xmlTextWriterWriteNs0ForecastType(writer, _forecast);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}forecast. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}forecast. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Forecast.
 *
 * @param _forecast The Forecast whose children are to be free.
 */
static void freeNs0ForecastElement(struct agentrank_ns0_forecast *_forecast) {
  freeNs0ForecastType(_forecast);
}

/**
 * Reads a Forecast from XML. The reader is assumed to be at the start element.
 *
 * @return the Forecast, or NULL in case of error.
 */
static struct agentrank_ns0_forecast *xmlTextReaderReadNs0ForecastType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_forecast *_forecast = calloc(1, sizeof(struct agentrank_ns0_forecast));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0ForecastType(_forecast);
        free(_forecast);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "link", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}link of type {}link.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0LinkType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}link of type {}link.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ForecastType(_forecast);
          free(_forecast);
          return NULL;
        }

        _forecast->link = ((struct agentrank_ns0_link*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "date", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}date of type {http://www.w3.org/2001/XMLSchema}dateTime.\n");
#endif
        _child_accessor = xmlTextReaderReadXsDateTimeType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}date of type {http://www.w3.org/2001/XMLSchema}dateTime.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ForecastType(_forecast);
          free(_forecast);
          return NULL;
        }

        _forecast->date = ((struct tm*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "market", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}market of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}market of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ForecastType(_forecast);
          free(_forecast);
          return NULL;
        }

        _forecast->market = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "metric", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}metric of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}metric of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ForecastType(_forecast);
          free(_forecast);
          return NULL;
        }

        _forecast->metric = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "spot", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}spot of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
        _child_accessor = xmlTextReaderReadXsDecimalType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}spot of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ForecastType(_forecast);
          free(_forecast);
          return NULL;
        }

        _forecast->spot = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "future", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}future of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
        _child_accessor = xmlTextReaderReadXsDecimalType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}future of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ForecastType(_forecast);
          free(_forecast);
          return NULL;
        }

        _forecast->future = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}forecast.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}forecast. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _forecast;
}

/**
 * Writes a Forecast to XML.
 *
 * @param writer The XML writer.
 * @param _forecast The Forecast to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0ForecastType(xmlTextWriterPtr writer, struct agentrank_ns0_forecast *_forecast) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_forecast->link != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "link", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}link for element {}link...\n", status);
#endif
    status = xmlTextWriterWriteNs0LinkType(writer, (_forecast->link));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}link for element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_forecast->date != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "date", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}date. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}dateTime for element {}date...\n", status);
#endif
    status = xmlTextWriterWriteXsDateTimeType(writer, (_forecast->date));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}dateTime for element {}date. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}date. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_forecast->market != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "market", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}market. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}market...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_forecast->market));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}market. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}market. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_forecast->metric != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "metric", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}metric. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}metric...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_forecast->metric));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}metric. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}metric. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_forecast->spot != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "spot", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}spot. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}decimal for element {}spot...\n", status);
#endif
    status = xmlTextWriterWriteXsDecimalType(writer, (_forecast->spot));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}decimal for element {}spot. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}spot. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_forecast->future != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "future", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}future. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}decimal for element {}future...\n", status);
#endif
    status = xmlTextWriterWriteXsDecimalType(writer, (_forecast->future));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}decimal for element {}future. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}future. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Forecast.
 *
 * @param _forecast The Forecast to free.
 */
static void freeNs0ForecastType(struct agentrank_ns0_forecast *_forecast) {
  int i;
  if (_forecast->link != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor link of type agentrank_ns0_forecast...\n");
#endif
    freeNs0LinkType(_forecast->link);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor link of type agentrank_ns0_forecast...\n");
#endif
    free(_forecast->link);
  }
  if (_forecast->date != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor date of type agentrank_ns0_forecast...\n");
#endif
    freeXsDateTimeType(_forecast->date);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor date of type agentrank_ns0_forecast...\n");
#endif
    free(_forecast->date);
  }
  if (_forecast->market != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor market of type agentrank_ns0_forecast...\n");
#endif
    freeXsStringType(_forecast->market);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor market of type agentrank_ns0_forecast...\n");
#endif
    free(_forecast->market);
  }
  if (_forecast->metric != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor metric of type agentrank_ns0_forecast...\n");
#endif
    freeXsStringType(_forecast->metric);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor metric of type agentrank_ns0_forecast...\n");
#endif
    free(_forecast->metric);
  }
  if (_forecast->spot != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor spot of type agentrank_ns0_forecast...\n");
#endif
    freeXsDecimalType(_forecast->spot);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor spot of type agentrank_ns0_forecast...\n");
#endif
    free(_forecast->spot);
  }
  if (_forecast->future != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor future of type agentrank_ns0_forecast...\n");
#endif
    freeXsDecimalType(_forecast->future);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor future of type agentrank_ns0_forecast...\n");
#endif
    free(_forecast->future);
  }
}
#endif /* DEF_agentrank_ns0_forecast_M */
#ifndef DEF_agentrank_ns0_forecasts_M
#define DEF_agentrank_ns0_forecasts_M

/**
 * Reads a Forecasts element from XML. The element to be read is "forecasts", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Forecasts, or NULL in case of error.
 */
struct agentrank_ns0_forecasts *xml_read_agentrank_ns0_forecasts(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ForecastsElement(reader);
}

/**
 * Writes a Forecasts to XML under element name "forecasts".
 *
 * @param writer The XML writer.
 * @param _forecasts The Forecasts to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_forecasts(xmlTextWriterPtr writer, struct agentrank_ns0_forecasts *_forecasts) {
  return xmlTextWriterWriteNs0ForecastsElementNS(writer, _forecasts, 1);
}

/**
 * Frees a Forecasts.
 *
 * @param _forecasts The Forecasts to free.
 */
void free_agentrank_ns0_forecasts(struct agentrank_ns0_forecasts *_forecasts) {
  freeNs0ForecastsType(_forecasts);
  free(_forecasts);
}

/**
 * Reads a Forecasts element from XML. The element to be read is "forecasts", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Forecasts, or NULL in case of error.
 */
struct agentrank_ns0_forecasts *xmlTextReaderReadNs0ForecastsElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_forecasts *_forecasts = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "forecasts", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}forecasts.\n");
#endif
    _forecasts = xmlTextReaderReadNs0ForecastsType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_forecasts == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}forecasts failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}forecasts failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _forecasts;
}

/**
 * Writes a Forecasts to XML under element name "forecasts".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _forecasts The Forecasts to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ForecastsElement(xmlTextWriterPtr writer, struct agentrank_ns0_forecasts *_forecasts) {
  return xmlTextWriterWriteNs0ForecastsElementNS(writer, _forecasts, 0);
}

/**
 * Writes a Forecasts to XML under element name "forecasts".
 *
 * @param writer The XML writer.
 * @param _forecasts The Forecasts to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ForecastsElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_forecasts *_forecasts, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "forecasts", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}forecasts. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}forecasts for root element {}forecasts...\n");
#endif
  status = xmlTextWriterWriteNs0ForecastsType(writer, _forecasts);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}forecasts. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}forecasts. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Forecasts.
 *
 * @param _forecasts The Forecasts whose children are to be free.
 */
static void freeNs0ForecastsElement(struct agentrank_ns0_forecasts *_forecasts) {
  freeNs0ForecastsType(_forecasts);
}

/**
 * Reads a Forecasts from XML. The reader is assumed to be at the start element.
 *
 * @return the Forecasts, or NULL in case of error.
 */
static struct agentrank_ns0_forecasts *xmlTextReaderReadNs0ForecastsType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_forecasts *_forecasts = calloc(1, sizeof(struct agentrank_ns0_forecasts));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0ForecastsType(_forecasts);
        free(_forecasts);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "total", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}total of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
        _child_accessor = xmlTextReaderReadXsIntType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}total of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ForecastsType(_forecasts);
          free(_forecasts);
          return NULL;
        }

        _forecasts->total = ((int*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "forecast", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}forecast of type {}forecast.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ForecastType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}forecast of type {}forecast.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ForecastsType(_forecasts);
          free(_forecasts);
          return NULL;
        }

        _forecasts->forecast = realloc(_forecasts->forecast, (_forecasts->_sizeof_forecast + 1) * sizeof(struct agentrank_ns0_forecast));
        memcpy(&(_forecasts->forecast[_forecasts->_sizeof_forecast++]), _child_accessor, sizeof(struct agentrank_ns0_forecast));
        free(_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}forecasts.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}forecasts. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _forecasts;
}

/**
 * Writes a Forecasts to XML.
 *
 * @param writer The XML writer.
 * @param _forecasts The Forecasts to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0ForecastsType(xmlTextWriterPtr writer, struct agentrank_ns0_forecasts *_forecasts) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_forecasts->total != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "total", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}total. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}int for element {}total...\n", status);
#endif
    status = xmlTextWriterWriteXsIntType(writer, (_forecasts->total));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}int for element {}total. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}total. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  for (i = 0; i < _forecasts->_sizeof_forecast; i++) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "forecast", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}forecast. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}forecast for element {}forecast...\n", status);
#endif
    status = xmlTextWriterWriteNs0ForecastType(writer, &(_forecasts->forecast[i]));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}forecast for element {}forecast. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}forecast. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Forecasts.
 *
 * @param _forecasts The Forecasts to free.
 */
static void freeNs0ForecastsType(struct agentrank_ns0_forecasts *_forecasts) {
  int i;
  if (_forecasts->total != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor total of type agentrank_ns0_forecasts...\n");
#endif
    freeXsIntType(_forecasts->total);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor total of type agentrank_ns0_forecasts...\n");
#endif
    free(_forecasts->total);
  }
  if (_forecasts->forecast != NULL) {
    for (i = 0; i < _forecasts->_sizeof_forecast; i++) {
#if DEBUG_ENUNCIATE > 1
      printf("Freeing accessor forecast[%i] of type agentrank_ns0_forecasts...\n", i);
#endif
      freeNs0ForecastType(&(_forecasts->forecast[i]));
    }
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor forecast of type agentrank_ns0_forecasts...\n");
#endif
    free(_forecasts->forecast);
  }
}
#endif /* DEF_agentrank_ns0_forecasts_M */
#ifndef DEF_agentrank_ns0_profile_M
#define DEF_agentrank_ns0_profile_M

/**
 * Reads a Profile element from XML. The element to be read is "profile", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Profile, or NULL in case of error.
 */
struct agentrank_ns0_profile *xml_read_agentrank_ns0_profile(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ProfileElement(reader);
}

/**
 * Writes a Profile to XML under element name "profile".
 *
 * @param writer The XML writer.
 * @param _profile The Profile to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_profile(xmlTextWriterPtr writer, struct agentrank_ns0_profile *_profile) {
  return xmlTextWriterWriteNs0ProfileElementNS(writer, _profile, 1);
}

/**
 * Frees a Profile.
 *
 * @param _profile The Profile to free.
 */
void free_agentrank_ns0_profile(struct agentrank_ns0_profile *_profile) {
  freeNs0ProfileType(_profile);
  free(_profile);
}

/**
 * Reads a Profile element from XML. The element to be read is "profile", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Profile, or NULL in case of error.
 */
struct agentrank_ns0_profile *xmlTextReaderReadNs0ProfileElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_profile *_profile = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "profile", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}profile.\n");
#endif
    _profile = xmlTextReaderReadNs0ProfileType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_profile == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}profile failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}profile failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _profile;
}

/**
 * Writes a Profile to XML under element name "profile".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _profile The Profile to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ProfileElement(xmlTextWriterPtr writer, struct agentrank_ns0_profile *_profile) {
  return xmlTextWriterWriteNs0ProfileElementNS(writer, _profile, 0);
}

/**
 * Writes a Profile to XML under element name "profile".
 *
 * @param writer The XML writer.
 * @param _profile The Profile to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ProfileElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_profile *_profile, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "profile", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}profile. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}profile for root element {}profile...\n");
#endif
  status = xmlTextWriterWriteNs0ProfileType(writer, _profile);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}profile. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}profile. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Profile.
 *
 * @param _profile The Profile whose children are to be free.
 */
static void freeNs0ProfileElement(struct agentrank_ns0_profile *_profile) {
  freeNs0ProfileType(_profile);
}

/**
 * Reads a Profile from XML. The reader is assumed to be at the start element.
 *
 * @return the Profile, or NULL in case of error.
 */
static struct agentrank_ns0_profile *xmlTextReaderReadNs0ProfileType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_profile *_profile = calloc(1, sizeof(struct agentrank_ns0_profile));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0ProfileType(_profile);
        free(_profile);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "link", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}link of type {}link.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0LinkType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}link of type {}link.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ProfileType(_profile);
          free(_profile);
          return NULL;
        }

        _profile->link = ((struct agentrank_ns0_link*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "photo", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}photo of type {}image.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ImageType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}photo of type {}image.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ProfileType(_profile);
          free(_profile);
          return NULL;
        }

        _profile->photo = ((struct agentrank_ns0_image*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "experience", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}experience of type {http://www.w3.org/2001/XMLSchema}float.\n");
#endif
        _child_accessor = xmlTextReaderReadXsFloatType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}experience of type {http://www.w3.org/2001/XMLSchema}float.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ProfileType(_profile);
          free(_profile);
          return NULL;
        }

        _profile->experience = *((float*)_child_accessor);
        free(_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "full_name", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}full_name of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}full_name of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ProfileType(_profile);
          free(_profile);
          return NULL;
        }

        _profile->full_name = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "agentrank", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}agentrank of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
        _child_accessor = xmlTextReaderReadXsIntType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}agentrank of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ProfileType(_profile);
          free(_profile);
          return NULL;
        }

        _profile->agentrank = ((int*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "description", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}description of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}description of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ProfileType(_profile);
          free(_profile);
          return NULL;
        }

        _profile->description = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}profile.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}profile. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _profile;
}

/**
 * Writes a Profile to XML.
 *
 * @param writer The XML writer.
 * @param _profile The Profile to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0ProfileType(xmlTextWriterPtr writer, struct agentrank_ns0_profile *_profile) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_profile->link != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "link", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}link for element {}link...\n", status);
#endif
    status = xmlTextWriterWriteNs0LinkType(writer, (_profile->link));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}link for element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_profile->photo != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "photo", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}photo. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}image for element {}photo...\n", status);
#endif
    status = xmlTextWriterWriteNs0ImageType(writer, (_profile->photo));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}image for element {}photo. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}photo. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (1) { //always write the primitive element.
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "experience", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}experience. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}float for element {}experience...\n", status);
#endif
    status = xmlTextWriterWriteXsFloatType(writer, &(_profile->experience));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}float for element {}experience. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}experience. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_profile->full_name != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "full_name", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}full_name. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}full_name...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_profile->full_name));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}full_name. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}full_name. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_profile->agentrank != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "agentrank", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}agentrank. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}int for element {}agentrank...\n", status);
#endif
    status = xmlTextWriterWriteXsIntType(writer, (_profile->agentrank));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}int for element {}agentrank. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}agentrank. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_profile->description != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "description", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}description. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}description...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_profile->description));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}description. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}description. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Profile.
 *
 * @param _profile The Profile to free.
 */
static void freeNs0ProfileType(struct agentrank_ns0_profile *_profile) {
  int i;
  if (_profile->link != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor link of type agentrank_ns0_profile...\n");
#endif
    freeNs0LinkType(_profile->link);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor link of type agentrank_ns0_profile...\n");
#endif
    free(_profile->link);
  }
  if (_profile->photo != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor photo of type agentrank_ns0_profile...\n");
#endif
    freeNs0ImageType(_profile->photo);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor photo of type agentrank_ns0_profile...\n");
#endif
    free(_profile->photo);
  }
  if (_profile->full_name != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor full_name of type agentrank_ns0_profile...\n");
#endif
    freeXsStringType(_profile->full_name);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor full_name of type agentrank_ns0_profile...\n");
#endif
    free(_profile->full_name);
  }
  if (_profile->agentrank != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor agentrank of type agentrank_ns0_profile...\n");
#endif
    freeXsIntType(_profile->agentrank);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor agentrank of type agentrank_ns0_profile...\n");
#endif
    free(_profile->agentrank);
  }
  if (_profile->description != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor description of type agentrank_ns0_profile...\n");
#endif
    freeXsStringType(_profile->description);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor description of type agentrank_ns0_profile...\n");
#endif
    free(_profile->description);
  }
}
#endif /* DEF_agentrank_ns0_profile_M */
#ifndef DEF_agentrank_ns0_profiles_M
#define DEF_agentrank_ns0_profiles_M

/**
 * Reads a Profiles element from XML. The element to be read is "profiles", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Profiles, or NULL in case of error.
 */
struct agentrank_ns0_profiles *xml_read_agentrank_ns0_profiles(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ProfilesElement(reader);
}

/**
 * Writes a Profiles to XML under element name "profiles".
 *
 * @param writer The XML writer.
 * @param _profiles The Profiles to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_profiles(xmlTextWriterPtr writer, struct agentrank_ns0_profiles *_profiles) {
  return xmlTextWriterWriteNs0ProfilesElementNS(writer, _profiles, 1);
}

/**
 * Frees a Profiles.
 *
 * @param _profiles The Profiles to free.
 */
void free_agentrank_ns0_profiles(struct agentrank_ns0_profiles *_profiles) {
  freeNs0ProfilesType(_profiles);
  free(_profiles);
}

/**
 * Reads a Profiles element from XML. The element to be read is "profiles", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Profiles, or NULL in case of error.
 */
struct agentrank_ns0_profiles *xmlTextReaderReadNs0ProfilesElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_profiles *_profiles = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "profiles", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}profiles.\n");
#endif
    _profiles = xmlTextReaderReadNs0ProfilesType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_profiles == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}profiles failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}profiles failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _profiles;
}

/**
 * Writes a Profiles to XML under element name "profiles".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _profiles The Profiles to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ProfilesElement(xmlTextWriterPtr writer, struct agentrank_ns0_profiles *_profiles) {
  return xmlTextWriterWriteNs0ProfilesElementNS(writer, _profiles, 0);
}

/**
 * Writes a Profiles to XML under element name "profiles".
 *
 * @param writer The XML writer.
 * @param _profiles The Profiles to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ProfilesElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_profiles *_profiles, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "profiles", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}profiles. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}profiles for root element {}profiles...\n");
#endif
  status = xmlTextWriterWriteNs0ProfilesType(writer, _profiles);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}profiles. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}profiles. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Profiles.
 *
 * @param _profiles The Profiles whose children are to be free.
 */
static void freeNs0ProfilesElement(struct agentrank_ns0_profiles *_profiles) {
  freeNs0ProfilesType(_profiles);
}

/**
 * Reads a Profiles from XML. The reader is assumed to be at the start element.
 *
 * @return the Profiles, or NULL in case of error.
 */
static struct agentrank_ns0_profiles *xmlTextReaderReadNs0ProfilesType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_profiles *_profiles = calloc(1, sizeof(struct agentrank_ns0_profiles));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0ProfilesType(_profiles);
        free(_profiles);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "profile", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}profile of type {}profile.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0ProfileType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}profile of type {}profile.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0ProfilesType(_profiles);
          free(_profiles);
          return NULL;
        }

        _profiles->profile = realloc(_profiles->profile, (_profiles->_sizeof_profile + 1) * sizeof(struct agentrank_ns0_profile));
        memcpy(&(_profiles->profile[_profiles->_sizeof_profile++]), _child_accessor, sizeof(struct agentrank_ns0_profile));
        free(_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}profiles.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}profiles. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _profiles;
}

/**
 * Writes a Profiles to XML.
 *
 * @param writer The XML writer.
 * @param _profiles The Profiles to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0ProfilesType(xmlTextWriterPtr writer, struct agentrank_ns0_profiles *_profiles) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  for (i = 0; i < _profiles->_sizeof_profile; i++) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "profile", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}profile. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}profile for element {}profile...\n", status);
#endif
    status = xmlTextWriterWriteNs0ProfileType(writer, &(_profiles->profile[i]));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}profile for element {}profile. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}profile. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Profiles.
 *
 * @param _profiles The Profiles to free.
 */
static void freeNs0ProfilesType(struct agentrank_ns0_profiles *_profiles) {
  int i;
  if (_profiles->profile != NULL) {
    for (i = 0; i < _profiles->_sizeof_profile; i++) {
#if DEBUG_ENUNCIATE > 1
      printf("Freeing accessor profile[%i] of type agentrank_ns0_profiles...\n", i);
#endif
      freeNs0ProfileType(&(_profiles->profile[i]));
    }
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor profile of type agentrank_ns0_profiles...\n");
#endif
    free(_profiles->profile);
  }
}
#endif /* DEF_agentrank_ns0_profiles_M */
#ifndef DEF_agentrank_ns0_sale_M
#define DEF_agentrank_ns0_sale_M

/**
 * Reads a Sale element from XML. The element to be read is "sale", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Sale, or NULL in case of error.
 */
struct agentrank_ns0_sale *xml_read_agentrank_ns0_sale(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0SaleElement(reader);
}

/**
 * Writes a Sale to XML under element name "sale".
 *
 * @param writer The XML writer.
 * @param _sale The Sale to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_sale(xmlTextWriterPtr writer, struct agentrank_ns0_sale *_sale) {
  return xmlTextWriterWriteNs0SaleElementNS(writer, _sale, 1);
}

/**
 * Frees a Sale.
 *
 * @param _sale The Sale to free.
 */
void free_agentrank_ns0_sale(struct agentrank_ns0_sale *_sale) {
  freeNs0SaleType(_sale);
  free(_sale);
}

/**
 * Reads a Sale element from XML. The element to be read is "sale", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Sale, or NULL in case of error.
 */
struct agentrank_ns0_sale *xmlTextReaderReadNs0SaleElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_sale *_sale = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "sale", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}sale.\n");
#endif
    _sale = xmlTextReaderReadNs0SaleType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_sale == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}sale failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}sale failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _sale;
}

/**
 * Writes a Sale to XML under element name "sale".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _sale The Sale to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0SaleElement(xmlTextWriterPtr writer, struct agentrank_ns0_sale *_sale) {
  return xmlTextWriterWriteNs0SaleElementNS(writer, _sale, 0);
}

/**
 * Writes a Sale to XML under element name "sale".
 *
 * @param writer The XML writer.
 * @param _sale The Sale to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0SaleElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_sale *_sale, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "sale", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}sale. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}sale for root element {}sale...\n");
#endif
  status = xmlTextWriterWriteNs0SaleType(writer, _sale);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}sale. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}sale. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Sale.
 *
 * @param _sale The Sale whose children are to be free.
 */
static void freeNs0SaleElement(struct agentrank_ns0_sale *_sale) {
  freeNs0SaleType(_sale);
}

/**
 * Reads a Sale from XML. The reader is assumed to be at the start element.
 *
 * @return the Sale, or NULL in case of error.
 */
static struct agentrank_ns0_sale *xmlTextReaderReadNs0SaleType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_sale *_sale = calloc(1, sizeof(struct agentrank_ns0_sale));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0SaleType(_sale);
        free(_sale);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "link", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}link of type {}link.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0LinkType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}link of type {}link.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->link = ((struct agentrank_ns0_link*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "zip", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}zip of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}zip of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->zip = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "city", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}city of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}city of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->city = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "state", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}state of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}state of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->state = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "address", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}address of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}address of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->address = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "precision", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}precision of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}precision of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->precision = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "property_type", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}property_type of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}property_type of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->property_type = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "transaction_side", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}transaction_side of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}transaction_side of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->transaction_side = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "market_days", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}market_days of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
        _child_accessor = xmlTextReaderReadXsIntType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}market_days of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->market_days = ((int*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "latitude", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}latitude of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
        _child_accessor = xmlTextReaderReadXsDecimalType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}latitude of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->latitude = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "longitude", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}longitude of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
        _child_accessor = xmlTextReaderReadXsDecimalType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}longitude of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->longitude = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "list_price_final", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}list_price_final of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
        _child_accessor = xmlTextReaderReadXsDecimalType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}list_price_final of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->list_price_final = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "sale_price_final", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}sale_price_final of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
        _child_accessor = xmlTextReaderReadXsDecimalType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}sale_price_final of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->sale_price_final = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "list_price_original", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}list_price_original of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
        _child_accessor = xmlTextReaderReadXsDecimalType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}list_price_original of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->list_price_original = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "price_per_size_unit", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}price_per_size_unit of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
        _child_accessor = xmlTextReaderReadXsDecimalType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}price_per_size_unit of type {http://www.w3.org/2001/XMLSchema}decimal.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SaleType(_sale);
          free(_sale);
          return NULL;
        }

        _sale->price_per_size_unit = ((xmlChar*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}sale.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}sale. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _sale;
}

/**
 * Writes a Sale to XML.
 *
 * @param writer The XML writer.
 * @param _sale The Sale to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0SaleType(xmlTextWriterPtr writer, struct agentrank_ns0_sale *_sale) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_sale->link != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "link", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}link for element {}link...\n", status);
#endif
    status = xmlTextWriterWriteNs0LinkType(writer, (_sale->link));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}link for element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->zip != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "zip", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}zip. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}zip...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_sale->zip));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}zip. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}zip. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->city != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "city", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}city. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}city...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_sale->city));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}city. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}city. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->state != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "state", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}state. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}state...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_sale->state));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}state. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}state. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->address != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "address", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}address. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}address...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_sale->address));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}address. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}address. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->precision != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "precision", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}precision. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}precision...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_sale->precision));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}precision. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}precision. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->property_type != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "property_type", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}property_type. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}property_type...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_sale->property_type));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}property_type. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}property_type. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->transaction_side != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "transaction_side", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}transaction_side. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}transaction_side...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_sale->transaction_side));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}transaction_side. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}transaction_side. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->market_days != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "market_days", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}market_days. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}int for element {}market_days...\n", status);
#endif
    status = xmlTextWriterWriteXsIntType(writer, (_sale->market_days));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}int for element {}market_days. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}market_days. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->latitude != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "latitude", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}latitude. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}decimal for element {}latitude...\n", status);
#endif
    status = xmlTextWriterWriteXsDecimalType(writer, (_sale->latitude));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}decimal for element {}latitude. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}latitude. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->longitude != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "longitude", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}longitude. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}decimal for element {}longitude...\n", status);
#endif
    status = xmlTextWriterWriteXsDecimalType(writer, (_sale->longitude));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}decimal for element {}longitude. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}longitude. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->list_price_final != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "list_price_final", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}list_price_final. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}decimal for element {}list_price_final...\n", status);
#endif
    status = xmlTextWriterWriteXsDecimalType(writer, (_sale->list_price_final));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}decimal for element {}list_price_final. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}list_price_final. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->sale_price_final != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "sale_price_final", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}sale_price_final. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}decimal for element {}sale_price_final...\n", status);
#endif
    status = xmlTextWriterWriteXsDecimalType(writer, (_sale->sale_price_final));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}decimal for element {}sale_price_final. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}sale_price_final. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->list_price_original != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "list_price_original", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}list_price_original. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}decimal for element {}list_price_original...\n", status);
#endif
    status = xmlTextWriterWriteXsDecimalType(writer, (_sale->list_price_original));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}decimal for element {}list_price_original. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}list_price_original. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sale->price_per_size_unit != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "price_per_size_unit", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}price_per_size_unit. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}decimal for element {}price_per_size_unit...\n", status);
#endif
    status = xmlTextWriterWriteXsDecimalType(writer, (_sale->price_per_size_unit));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}decimal for element {}price_per_size_unit. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}price_per_size_unit. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Sale.
 *
 * @param _sale The Sale to free.
 */
static void freeNs0SaleType(struct agentrank_ns0_sale *_sale) {
  int i;
  if (_sale->link != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor link of type agentrank_ns0_sale...\n");
#endif
    freeNs0LinkType(_sale->link);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor link of type agentrank_ns0_sale...\n");
#endif
    free(_sale->link);
  }
  if (_sale->zip != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor zip of type agentrank_ns0_sale...\n");
#endif
    freeXsStringType(_sale->zip);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor zip of type agentrank_ns0_sale...\n");
#endif
    free(_sale->zip);
  }
  if (_sale->city != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor city of type agentrank_ns0_sale...\n");
#endif
    freeXsStringType(_sale->city);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor city of type agentrank_ns0_sale...\n");
#endif
    free(_sale->city);
  }
  if (_sale->state != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor state of type agentrank_ns0_sale...\n");
#endif
    freeXsStringType(_sale->state);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor state of type agentrank_ns0_sale...\n");
#endif
    free(_sale->state);
  }
  if (_sale->address != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor address of type agentrank_ns0_sale...\n");
#endif
    freeXsStringType(_sale->address);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor address of type agentrank_ns0_sale...\n");
#endif
    free(_sale->address);
  }
  if (_sale->precision != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor precision of type agentrank_ns0_sale...\n");
#endif
    freeXsStringType(_sale->precision);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor precision of type agentrank_ns0_sale...\n");
#endif
    free(_sale->precision);
  }
  if (_sale->property_type != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor property_type of type agentrank_ns0_sale...\n");
#endif
    freeXsStringType(_sale->property_type);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor property_type of type agentrank_ns0_sale...\n");
#endif
    free(_sale->property_type);
  }
  if (_sale->transaction_side != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor transaction_side of type agentrank_ns0_sale...\n");
#endif
    freeXsStringType(_sale->transaction_side);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor transaction_side of type agentrank_ns0_sale...\n");
#endif
    free(_sale->transaction_side);
  }
  if (_sale->market_days != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor market_days of type agentrank_ns0_sale...\n");
#endif
    freeXsIntType(_sale->market_days);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor market_days of type agentrank_ns0_sale...\n");
#endif
    free(_sale->market_days);
  }
  if (_sale->latitude != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor latitude of type agentrank_ns0_sale...\n");
#endif
    freeXsDecimalType(_sale->latitude);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor latitude of type agentrank_ns0_sale...\n");
#endif
    free(_sale->latitude);
  }
  if (_sale->longitude != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor longitude of type agentrank_ns0_sale...\n");
#endif
    freeXsDecimalType(_sale->longitude);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor longitude of type agentrank_ns0_sale...\n");
#endif
    free(_sale->longitude);
  }
  if (_sale->list_price_final != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor list_price_final of type agentrank_ns0_sale...\n");
#endif
    freeXsDecimalType(_sale->list_price_final);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor list_price_final of type agentrank_ns0_sale...\n");
#endif
    free(_sale->list_price_final);
  }
  if (_sale->sale_price_final != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor sale_price_final of type agentrank_ns0_sale...\n");
#endif
    freeXsDecimalType(_sale->sale_price_final);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor sale_price_final of type agentrank_ns0_sale...\n");
#endif
    free(_sale->sale_price_final);
  }
  if (_sale->list_price_original != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor list_price_original of type agentrank_ns0_sale...\n");
#endif
    freeXsDecimalType(_sale->list_price_original);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor list_price_original of type agentrank_ns0_sale...\n");
#endif
    free(_sale->list_price_original);
  }
  if (_sale->price_per_size_unit != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor price_per_size_unit of type agentrank_ns0_sale...\n");
#endif
    freeXsDecimalType(_sale->price_per_size_unit);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor price_per_size_unit of type agentrank_ns0_sale...\n");
#endif
    free(_sale->price_per_size_unit);
  }
}
#endif /* DEF_agentrank_ns0_sale_M */
#ifndef DEF_agentrank_ns0_sales_M
#define DEF_agentrank_ns0_sales_M

/**
 * Reads a Sales element from XML. The element to be read is "sales", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Sales, or NULL in case of error.
 */
struct agentrank_ns0_sales *xml_read_agentrank_ns0_sales(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0SalesElement(reader);
}

/**
 * Writes a Sales to XML under element name "sales".
 *
 * @param writer The XML writer.
 * @param _sales The Sales to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_sales(xmlTextWriterPtr writer, struct agentrank_ns0_sales *_sales) {
  return xmlTextWriterWriteNs0SalesElementNS(writer, _sales, 1);
}

/**
 * Frees a Sales.
 *
 * @param _sales The Sales to free.
 */
void free_agentrank_ns0_sales(struct agentrank_ns0_sales *_sales) {
  freeNs0SalesType(_sales);
  free(_sales);
}

/**
 * Reads a Sales element from XML. The element to be read is "sales", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Sales, or NULL in case of error.
 */
struct agentrank_ns0_sales *xmlTextReaderReadNs0SalesElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_sales *_sales = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "sales", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}sales.\n");
#endif
    _sales = xmlTextReaderReadNs0SalesType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_sales == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}sales failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}sales failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _sales;
}

/**
 * Writes a Sales to XML under element name "sales".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _sales The Sales to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0SalesElement(xmlTextWriterPtr writer, struct agentrank_ns0_sales *_sales) {
  return xmlTextWriterWriteNs0SalesElementNS(writer, _sales, 0);
}

/**
 * Writes a Sales to XML under element name "sales".
 *
 * @param writer The XML writer.
 * @param _sales The Sales to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0SalesElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_sales *_sales, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "sales", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}sales. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}sales for root element {}sales...\n");
#endif
  status = xmlTextWriterWriteNs0SalesType(writer, _sales);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}sales. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}sales. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Sales.
 *
 * @param _sales The Sales whose children are to be free.
 */
static void freeNs0SalesElement(struct agentrank_ns0_sales *_sales) {
  freeNs0SalesType(_sales);
}

/**
 * Reads a Sales from XML. The reader is assumed to be at the start element.
 *
 * @return the Sales, or NULL in case of error.
 */
static struct agentrank_ns0_sales *xmlTextReaderReadNs0SalesType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_sales *_sales = calloc(1, sizeof(struct agentrank_ns0_sales));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0SalesType(_sales);
        free(_sales);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "charts", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}charts of type {}links.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0LinksType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}charts of type {}links.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SalesType(_sales);
          free(_sales);
          return NULL;
        }

        _sales->charts = ((struct agentrank_ns0_links*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "total", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}total of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
        _child_accessor = xmlTextReaderReadXsIntType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}total of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SalesType(_sales);
          free(_sales);
          return NULL;
        }

        _sales->total = ((int*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "sale", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}sale of type {}sale.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0SaleType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}sale of type {}sale.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0SalesType(_sales);
          free(_sales);
          return NULL;
        }

        _sales->sale = realloc(_sales->sale, (_sales->_sizeof_sale + 1) * sizeof(struct agentrank_ns0_sale));
        memcpy(&(_sales->sale[_sales->_sizeof_sale++]), _child_accessor, sizeof(struct agentrank_ns0_sale));
        free(_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}sales.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}sales. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _sales;
}

/**
 * Writes a Sales to XML.
 *
 * @param writer The XML writer.
 * @param _sales The Sales to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0SalesType(xmlTextWriterPtr writer, struct agentrank_ns0_sales *_sales) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  if (_sales->charts != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "charts", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}charts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}links for element {}charts...\n", status);
#endif
    status = xmlTextWriterWriteNs0LinksType(writer, (_sales->charts));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}links for element {}charts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}charts. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_sales->total != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "total", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}total. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}int for element {}total...\n", status);
#endif
    status = xmlTextWriterWriteXsIntType(writer, (_sales->total));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}int for element {}total. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}total. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  for (i = 0; i < _sales->_sizeof_sale; i++) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "sale", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}sale. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}sale for element {}sale...\n", status);
#endif
    status = xmlTextWriterWriteNs0SaleType(writer, &(_sales->sale[i]));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}sale for element {}sale. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}sale. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Sales.
 *
 * @param _sales The Sales to free.
 */
static void freeNs0SalesType(struct agentrank_ns0_sales *_sales) {
  int i;
  if (_sales->charts != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor charts of type agentrank_ns0_sales...\n");
#endif
    freeNs0LinksType(_sales->charts);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor charts of type agentrank_ns0_sales...\n");
#endif
    free(_sales->charts);
  }
  if (_sales->total != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor total of type agentrank_ns0_sales...\n");
#endif
    freeXsIntType(_sales->total);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor total of type agentrank_ns0_sales...\n");
#endif
    free(_sales->total);
  }
  if (_sales->sale != NULL) {
    for (i = 0; i < _sales->_sizeof_sale; i++) {
#if DEBUG_ENUNCIATE > 1
      printf("Freeing accessor sale[%i] of type agentrank_ns0_sales...\n", i);
#endif
      freeNs0SaleType(&(_sales->sale[i]));
    }
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor sale of type agentrank_ns0_sales...\n");
#endif
    free(_sales->sale);
  }
}
#endif /* DEF_agentrank_ns0_sales_M */
#ifndef DEF_agentrank_ns0_content_M
#define DEF_agentrank_ns0_content_M

/**
 * Reads a Content element from XML. The element to be read is "content", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Content, or NULL in case of error.
 */
struct agentrank_ns0_content *xml_read_agentrank_ns0_content(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ContentElement(reader);
}

/**
 * Writes a Content to XML under element name "content".
 *
 * @param writer The XML writer.
 * @param _content The Content to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_content(xmlTextWriterPtr writer, struct agentrank_ns0_content *_content) {
  return xmlTextWriterWriteNs0ContentElementNS(writer, _content, 1);
}

/**
 * Frees a Content.
 *
 * @param _content The Content to free.
 */
void free_agentrank_ns0_content(struct agentrank_ns0_content *_content) {
  freeNs0ContentType(_content);
  free(_content);
}

/**
 * Reads a Content element from XML. The element to be read is "content", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Content, or NULL in case of error.
 */
struct agentrank_ns0_content *xmlTextReaderReadNs0ContentElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_content *_content = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "content", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}content.\n");
#endif
    _content = xmlTextReaderReadNs0ContentType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_content == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}content failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}content failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _content;
}

/**
 * Writes a Content to XML under element name "content".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _content The Content to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ContentElement(xmlTextWriterPtr writer, struct agentrank_ns0_content *_content) {
  return xmlTextWriterWriteNs0ContentElementNS(writer, _content, 0);
}

/**
 * Writes a Content to XML under element name "content".
 *
 * @param writer The XML writer.
 * @param _content The Content to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ContentElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_content *_content, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "content", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}content. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}content for root element {}content...\n");
#endif
  status = xmlTextWriterWriteNs0ContentType(writer, _content);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}content. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}content. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Content.
 *
 * @param _content The Content whose children are to be free.
 */
static void freeNs0ContentElement(struct agentrank_ns0_content *_content) {
  freeNs0ContentType(_content);
}

/**
 * Reads a Content from XML. The reader is assumed to be at the start element.
 *
 * @return the Content, or NULL in case of error.
 */
static struct agentrank_ns0_content *xmlTextReaderReadNs0ContentType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_content *_content = calloc(1, sizeof(struct agentrank_ns0_content));

  if (xmlTextReaderHasAttributes(reader)) {
    while (xmlTextReaderMoveToNextAttribute(reader)) {
      if ((xmlStrcmp(BAD_CAST "type", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}type...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}type of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0ContentType(_content);
          free(_content);
          return NULL;
        }
        _content->type = ((xmlChar*)_child_accessor);
        continue;
      }
    }

    status = xmlTextReaderMoveToElement(reader);
    if (status < 1) {
      //panic: unable to return to the element node.
#if DEBUG_ENUNCIATE
      printf("Unable to return to element node from attributes.\n");
#endif
      freeNs0ContentType(_content);
      free(_content);
      return NULL;
    }
  }

  if (xmlTextReaderIsEmptyElement(reader) == 0) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from element value...\n");
#endif
    _child_accessor = xmlTextReaderReadXsStringType(reader);
    if (_child_accessor == NULL) {
      //panic: unable to return the value for some reason.
#if DEBUG_ENUNCIATE
      printf("Failed to read value of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
      freeNs0ContentType(_content);
      free(_content);
      return NULL;
    }
    _content->value = ((xmlChar*)_child_accessor);
  }
  else {
    _content->value = BAD_CAST "";
  }


  return _content;
}

/**
 * Writes a Content to XML.
 *
 * @param writer The XML writer.
 * @param _content The Content to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0ContentType(xmlTextWriterPtr writer, struct agentrank_ns0_content *_content) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;

  if (_content->type != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "type", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}type. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}type...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_content->type));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}type. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}type. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (_content->value != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element value...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_content->value));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element value. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Content.
 *
 * @param _content The Content to free.
 */
static void freeNs0ContentType(struct agentrank_ns0_content *_content) {
  int i;
  if (_content->type != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor type of type agentrank_ns0_content...\n");
#endif
    freeXsStringType(_content->type);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor type of type agentrank_ns0_content...\n");
#endif
    free(_content->type);
  }
  if (_content->value != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor value of type agentrank_ns0_content...\n");
#endif
    freeXsStringType(_content->value);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor value of type agentrank_ns0_content...\n");
#endif
    free(_content->value);
  }
}
#endif /* DEF_agentrank_ns0_content_M */
#ifndef DEF_agentrank_ns0_image_M
#define DEF_agentrank_ns0_image_M

/**
 * Reads a Image element from XML. The element to be read is "image", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Image, or NULL in case of error.
 */
struct agentrank_ns0_image *xml_read_agentrank_ns0_image(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ImageElement(reader);
}

/**
 * Writes a Image to XML under element name "image".
 *
 * @param writer The XML writer.
 * @param _image The Image to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_image(xmlTextWriterPtr writer, struct agentrank_ns0_image *_image) {
  return xmlTextWriterWriteNs0ImageElementNS(writer, _image, 1);
}

/**
 * Frees a Image.
 *
 * @param _image The Image to free.
 */
void free_agentrank_ns0_image(struct agentrank_ns0_image *_image) {
  freeNs0ImageType(_image);
  free(_image);
}

/**
 * Reads a Image element from XML. The element to be read is "image", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Image, or NULL in case of error.
 */
struct agentrank_ns0_image *xmlTextReaderReadNs0ImageElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_image *_image = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "image", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}image.\n");
#endif
    _image = xmlTextReaderReadNs0ImageType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_image == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}image failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}image failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _image;
}

/**
 * Writes a Image to XML under element name "image".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _image The Image to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ImageElement(xmlTextWriterPtr writer, struct agentrank_ns0_image *_image) {
  return xmlTextWriterWriteNs0ImageElementNS(writer, _image, 0);
}

/**
 * Writes a Image to XML under element name "image".
 *
 * @param writer The XML writer.
 * @param _image The Image to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ImageElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_image *_image, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "image", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}image. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}image for root element {}image...\n");
#endif
  status = xmlTextWriterWriteNs0ImageType(writer, _image);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}image. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}image. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Image.
 *
 * @param _image The Image whose children are to be free.
 */
static void freeNs0ImageElement(struct agentrank_ns0_image *_image) {
  freeNs0ImageType(_image);
}

/**
 * Reads a Image from XML. The reader is assumed to be at the start element.
 *
 * @return the Image, or NULL in case of error.
 */
static struct agentrank_ns0_image *xmlTextReaderReadNs0ImageType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_image *_image = calloc(1, sizeof(struct agentrank_ns0_image));

  if (xmlTextReaderHasAttributes(reader)) {
    while (xmlTextReaderMoveToNextAttribute(reader)) {
      if ((xmlStrcmp(BAD_CAST "height", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}int from attribute {}height...\n");
#endif
        _child_accessor = xmlTextReaderReadXsIntType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}height of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
          freeNs0ImageType(_image);
          free(_image);
          return NULL;
        }
        _image->height = *((int*)_child_accessor);
        freeXsIntType((int*) _child_accessor);
        free(_child_accessor);
        continue;
      }
      if ((xmlStrcmp(BAD_CAST "alt", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}alt...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}alt of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0ImageType(_image);
          free(_image);
          return NULL;
        }
        _image->alt = ((xmlChar*)_child_accessor);
        continue;
      }
      if ((xmlStrcmp(BAD_CAST "width", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}int from attribute {}width...\n");
#endif
        _child_accessor = xmlTextReaderReadXsIntType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}width of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
          freeNs0ImageType(_image);
          free(_image);
          return NULL;
        }
        _image->width = *((int*)_child_accessor);
        freeXsIntType((int*) _child_accessor);
        free(_child_accessor);
        continue;
      }
      if ((xmlStrcmp(BAD_CAST "url", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}url...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}url of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0ImageType(_image);
          free(_image);
          return NULL;
        }
        _image->url = ((xmlChar*)_child_accessor);
        continue;
      }
    }

    status = xmlTextReaderMoveToElement(reader);
    if (status < 1) {
      //panic: unable to return to the element node.
#if DEBUG_ENUNCIATE
      printf("Unable to return to element node from attributes.\n");
#endif
      freeNs0ImageType(_image);
      free(_image);
      return NULL;
    }
  }



  return _image;
}

/**
 * Writes a Image to XML.
 *
 * @param writer The XML writer.
 * @param _image The Image to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0ImageType(xmlTextWriterPtr writer, struct agentrank_ns0_image *_image) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;

  if (1) { //always write the primitive attribute
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "height", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}height. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}int for attribute {}height...\n");
#endif
    status = xmlTextWriterWriteXsIntType(writer, &(_image->height));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}int for attribute {}height. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}height. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (_image->alt != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "alt", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}alt. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}alt...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_image->alt));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}alt. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}alt. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (1) { //always write the primitive attribute
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "width", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}width. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}int for attribute {}width...\n");
#endif
    status = xmlTextWriterWriteXsIntType(writer, &(_image->width));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}int for attribute {}width. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}width. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (_image->url != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "url", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}url. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}url...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_image->url));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}url. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}url. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Image.
 *
 * @param _image The Image to free.
 */
static void freeNs0ImageType(struct agentrank_ns0_image *_image) {
  int i;
  if (_image->alt != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor alt of type agentrank_ns0_image...\n");
#endif
    freeXsStringType(_image->alt);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor alt of type agentrank_ns0_image...\n");
#endif
    free(_image->alt);
  }
  if (_image->url != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor url of type agentrank_ns0_image...\n");
#endif
    freeXsStringType(_image->url);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor url of type agentrank_ns0_image...\n");
#endif
    free(_image->url);
  }
}
#endif /* DEF_agentrank_ns0_image_M */
#ifndef DEF_agentrank_ns0_link_M
#define DEF_agentrank_ns0_link_M

/**
 * Reads a Link element from XML. The element to be read is "link", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Link, or NULL in case of error.
 */
struct agentrank_ns0_link *xml_read_agentrank_ns0_link(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0LinkElement(reader);
}

/**
 * Writes a Link to XML under element name "link".
 *
 * @param writer The XML writer.
 * @param _link The Link to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_link(xmlTextWriterPtr writer, struct agentrank_ns0_link *_link) {
  return xmlTextWriterWriteNs0LinkElementNS(writer, _link, 1);
}

/**
 * Frees a Link.
 *
 * @param _link The Link to free.
 */
void free_agentrank_ns0_link(struct agentrank_ns0_link *_link) {
  freeNs0LinkType(_link);
  free(_link);
}

/**
 * Reads a Link element from XML. The element to be read is "link", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Link, or NULL in case of error.
 */
struct agentrank_ns0_link *xmlTextReaderReadNs0LinkElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_link *_link = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "link", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}link.\n");
#endif
    _link = xmlTextReaderReadNs0LinkType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_link == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}link failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}link failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _link;
}

/**
 * Writes a Link to XML under element name "link".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _link The Link to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0LinkElement(xmlTextWriterPtr writer, struct agentrank_ns0_link *_link) {
  return xmlTextWriterWriteNs0LinkElementNS(writer, _link, 0);
}

/**
 * Writes a Link to XML under element name "link".
 *
 * @param writer The XML writer.
 * @param _link The Link to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0LinkElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_link *_link, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "link", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}link. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}link for root element {}link...\n");
#endif
  status = xmlTextWriterWriteNs0LinkType(writer, _link);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}link. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}link. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Link.
 *
 * @param _link The Link whose children are to be free.
 */
static void freeNs0LinkElement(struct agentrank_ns0_link *_link) {
  freeNs0LinkType(_link);
}

/**
 * Reads a Link from XML. The reader is assumed to be at the start element.
 *
 * @return the Link, or NULL in case of error.
 */
static struct agentrank_ns0_link *xmlTextReaderReadNs0LinkType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_link *_link = calloc(1, sizeof(struct agentrank_ns0_link));

  if (xmlTextReaderHasAttributes(reader)) {
    while (xmlTextReaderMoveToNextAttribute(reader)) {
      if ((xmlStrcmp(BAD_CAST "id", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}id...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}id of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0LinkType(_link);
          free(_link);
          return NULL;
        }
        _link->id = ((xmlChar*)_child_accessor);
        continue;
      }
      if ((xmlStrcmp(BAD_CAST "title", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}title...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}title of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0LinkType(_link);
          free(_link);
          return NULL;
        }
        _link->title = ((xmlChar*)_child_accessor);
        continue;
      }
      if ((xmlStrcmp(BAD_CAST "text", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}text...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}text of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0LinkType(_link);
          free(_link);
          return NULL;
        }
        _link->text = ((xmlChar*)_child_accessor);
        continue;
      }
      if ((xmlStrcmp(BAD_CAST "mouseover", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}mouseover...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}mouseover of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0LinkType(_link);
          free(_link);
          return NULL;
        }
        _link->mouseover = ((xmlChar*)_child_accessor);
        continue;
      }
      if ((xmlStrcmp(BAD_CAST "rel", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}rel...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}rel of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0LinkType(_link);
          free(_link);
          return NULL;
        }
        _link->rel = ((xmlChar*)_child_accessor);
        continue;
      }
      if ((xmlStrcmp(BAD_CAST "type", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}type...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}type of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0LinkType(_link);
          free(_link);
          return NULL;
        }
        _link->type = ((xmlChar*)_child_accessor);
        continue;
      }
      if ((xmlStrcmp(BAD_CAST "href", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}string from attribute {}href...\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}href of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          freeNs0LinkType(_link);
          free(_link);
          return NULL;
        }
        _link->href = ((xmlChar*)_child_accessor);
        continue;
      }
    }

    status = xmlTextReaderMoveToElement(reader);
    if (status < 1) {
      //panic: unable to return to the element node.
#if DEBUG_ENUNCIATE
      printf("Unable to return to element node from attributes.\n");
#endif
      freeNs0LinkType(_link);
      free(_link);
      return NULL;
    }
  }



  return _link;
}

/**
 * Writes a Link to XML.
 *
 * @param writer The XML writer.
 * @param _link The Link to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0LinkType(xmlTextWriterPtr writer, struct agentrank_ns0_link *_link) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;

  if (_link->id != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "id", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}id. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}id...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_link->id));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}id. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}id. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (_link->title != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "title", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}title. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}title...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_link->title));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}title. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}title. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (_link->text != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "text", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}text. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}text...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_link->text));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}text. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}text. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (_link->mouseover != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "mouseover", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}mouseover. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}mouseover...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_link->mouseover));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}mouseover. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}mouseover. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (_link->rel != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "rel", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}rel. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}rel...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_link->rel));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}rel. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}rel. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (_link->type != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "type", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}type. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}type...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_link->type));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}type. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}type. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  if (_link->href != NULL) {
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "href", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}href. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for attribute {}href...\n");
#endif
    status = xmlTextWriterWriteXsStringType(writer, (_link->href));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for attribute {}href. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}href. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Link.
 *
 * @param _link The Link to free.
 */
static void freeNs0LinkType(struct agentrank_ns0_link *_link) {
  int i;
  if (_link->id != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor id of type agentrank_ns0_link...\n");
#endif
    freeXsStringType(_link->id);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor id of type agentrank_ns0_link...\n");
#endif
    free(_link->id);
  }
  if (_link->title != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor title of type agentrank_ns0_link...\n");
#endif
    freeXsStringType(_link->title);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor title of type agentrank_ns0_link...\n");
#endif
    free(_link->title);
  }
  if (_link->text != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor text of type agentrank_ns0_link...\n");
#endif
    freeXsStringType(_link->text);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor text of type agentrank_ns0_link...\n");
#endif
    free(_link->text);
  }
  if (_link->mouseover != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor mouseover of type agentrank_ns0_link...\n");
#endif
    freeXsStringType(_link->mouseover);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor mouseover of type agentrank_ns0_link...\n");
#endif
    free(_link->mouseover);
  }
  if (_link->rel != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor rel of type agentrank_ns0_link...\n");
#endif
    freeXsStringType(_link->rel);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor rel of type agentrank_ns0_link...\n");
#endif
    free(_link->rel);
  }
  if (_link->type != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor type of type agentrank_ns0_link...\n");
#endif
    freeXsStringType(_link->type);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor type of type agentrank_ns0_link...\n");
#endif
    free(_link->type);
  }
  if (_link->href != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor href of type agentrank_ns0_link...\n");
#endif
    freeXsStringType(_link->href);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor href of type agentrank_ns0_link...\n");
#endif
    free(_link->href);
  }
}
#endif /* DEF_agentrank_ns0_link_M */
#ifndef DEF_agentrank_ns0_links_M
#define DEF_agentrank_ns0_links_M

/**
 * Reads a Links element from XML. The element to be read is "links", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Links, or NULL in case of error.
 */
struct agentrank_ns0_links *xml_read_agentrank_ns0_links(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0LinksElement(reader);
}

/**
 * Writes a Links to XML under element name "links".
 *
 * @param writer The XML writer.
 * @param _links The Links to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_links(xmlTextWriterPtr writer, struct agentrank_ns0_links *_links) {
  return xmlTextWriterWriteNs0LinksElementNS(writer, _links, 1);
}

/**
 * Frees a Links.
 *
 * @param _links The Links to free.
 */
void free_agentrank_ns0_links(struct agentrank_ns0_links *_links) {
  freeNs0LinksType(_links);
  free(_links);
}

/**
 * Reads a Links element from XML. The element to be read is "links", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Links, or NULL in case of error.
 */
struct agentrank_ns0_links *xmlTextReaderReadNs0LinksElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_links *_links = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "links", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}links.\n");
#endif
    _links = xmlTextReaderReadNs0LinksType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_links == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}links failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}links failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _links;
}

/**
 * Writes a Links to XML under element name "links".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _links The Links to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0LinksElement(xmlTextWriterPtr writer, struct agentrank_ns0_links *_links) {
  return xmlTextWriterWriteNs0LinksElementNS(writer, _links, 0);
}

/**
 * Writes a Links to XML under element name "links".
 *
 * @param writer The XML writer.
 * @param _links The Links to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0LinksElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_links *_links, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "links", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}links. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}links for root element {}links...\n");
#endif
  status = xmlTextWriterWriteNs0LinksType(writer, _links);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}links. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}links. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Links.
 *
 * @param _links The Links whose children are to be free.
 */
static void freeNs0LinksElement(struct agentrank_ns0_links *_links) {
  freeNs0LinksType(_links);
}

/**
 * Reads a Links from XML. The reader is assumed to be at the start element.
 *
 * @return the Links, or NULL in case of error.
 */
static struct agentrank_ns0_links *xmlTextReaderReadNs0LinksType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_links *_links = calloc(1, sizeof(struct agentrank_ns0_links));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0LinksType(_links);
        free(_links);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "link", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}link of type {}link.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0LinkType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}link of type {}link.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0LinksType(_links);
          free(_links);
          return NULL;
        }

        _links->link = realloc(_links->link, (_links->_sizeof_link + 1) * sizeof(struct agentrank_ns0_link));
        memcpy(&(_links->link[_links->_sizeof_link++]), _child_accessor, sizeof(struct agentrank_ns0_link));
        free(_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}links.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}links. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _links;
}

/**
 * Writes a Links to XML.
 *
 * @param writer The XML writer.
 * @param _links The Links to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0LinksType(xmlTextWriterPtr writer, struct agentrank_ns0_links *_links) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  for (i = 0; i < _links->_sizeof_link; i++) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "link", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}link for element {}link...\n", status);
#endif
    status = xmlTextWriterWriteNs0LinkType(writer, &(_links->link[i]));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}link for element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}link. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Links.
 *
 * @param _links The Links to free.
 */
static void freeNs0LinksType(struct agentrank_ns0_links *_links) {
  int i;
  if (_links->link != NULL) {
    for (i = 0; i < _links->_sizeof_link; i++) {
#if DEBUG_ENUNCIATE > 1
      printf("Freeing accessor link[%i] of type agentrank_ns0_links...\n", i);
#endif
      freeNs0LinkType(&(_links->link[i]));
    }
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor link of type agentrank_ns0_links...\n");
#endif
    free(_links->link);
  }
}
#endif /* DEF_agentrank_ns0_links_M */
#ifndef DEF_agentrank_ns0_messages_M
#define DEF_agentrank_ns0_messages_M

/**
 * Reads a Messages element from XML. The element to be read is "messages", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Messages, or NULL in case of error.
 */
struct agentrank_ns0_messages *xml_read_agentrank_ns0_messages(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0MessagesElement(reader);
}

/**
 * Writes a Messages to XML under element name "messages".
 *
 * @param writer The XML writer.
 * @param _messages The Messages to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_messages(xmlTextWriterPtr writer, struct agentrank_ns0_messages *_messages) {
  return xmlTextWriterWriteNs0MessagesElementNS(writer, _messages, 1);
}

/**
 * Frees a Messages.
 *
 * @param _messages The Messages to free.
 */
void free_agentrank_ns0_messages(struct agentrank_ns0_messages *_messages) {
  freeNs0MessagesType(_messages);
  free(_messages);
}

/**
 * Reads a Messages element from XML. The element to be read is "messages", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Messages, or NULL in case of error.
 */
struct agentrank_ns0_messages *xmlTextReaderReadNs0MessagesElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_messages *_messages = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "messages", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}messages.\n");
#endif
    _messages = xmlTextReaderReadNs0MessagesType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_messages == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}messages failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}messages failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _messages;
}

/**
 * Writes a Messages to XML under element name "messages".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _messages The Messages to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0MessagesElement(xmlTextWriterPtr writer, struct agentrank_ns0_messages *_messages) {
  return xmlTextWriterWriteNs0MessagesElementNS(writer, _messages, 0);
}

/**
 * Writes a Messages to XML under element name "messages".
 *
 * @param writer The XML writer.
 * @param _messages The Messages to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0MessagesElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_messages *_messages, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "messages", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}messages. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}messages for root element {}messages...\n");
#endif
  status = xmlTextWriterWriteNs0MessagesType(writer, _messages);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}messages. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}messages. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Messages.
 *
 * @param _messages The Messages whose children are to be free.
 */
static void freeNs0MessagesElement(struct agentrank_ns0_messages *_messages) {
  freeNs0MessagesType(_messages);
}

/**
 * Reads a Messages from XML. The reader is assumed to be at the start element.
 *
 * @return the Messages, or NULL in case of error.
 */
static struct agentrank_ns0_messages *xmlTextReaderReadNs0MessagesType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_messages *_messages = calloc(1, sizeof(struct agentrank_ns0_messages));



  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0MessagesType(_messages);
        free(_messages);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "message", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}message of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
        _child_accessor = xmlTextReaderReadXsStringType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}message of type {http://www.w3.org/2001/XMLSchema}string.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0MessagesType(_messages);
          free(_messages);
          return NULL;
        }

        _messages->message = realloc(_messages->message, (_messages->_sizeof_message + 1) * sizeof(xmlChar));
        memcpy(&(_messages->message[_messages->_sizeof_message++]), _child_accessor, sizeof(xmlChar));
        free(_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}messages.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}messages. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _messages;
}

/**
 * Writes a Messages to XML.
 *
 * @param writer The XML writer.
 * @param _messages The Messages to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0MessagesType(xmlTextWriterPtr writer, struct agentrank_ns0_messages *_messages) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;
  for (i = 0; i < _messages->_sizeof_message; i++) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "message", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}message. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}string for element {}message...\n", status);
#endif
    status = xmlTextWriterWriteXsStringType(writer, &(_messages->message[i]));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}string for element {}message. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}message. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Messages.
 *
 * @param _messages The Messages to free.
 */
static void freeNs0MessagesType(struct agentrank_ns0_messages *_messages) {
  int i;
  if (_messages->message != NULL) {
    for (i = 0; i < _messages->_sizeof_message; i++) {
#if DEBUG_ENUNCIATE > 1
      printf("Freeing accessor message[%i] of type agentrank_ns0_messages...\n", i);
#endif
      freeXsStringType(&(_messages->message[i]));
    }
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor message of type agentrank_ns0_messages...\n");
#endif
    free(_messages->message);
  }
}
#endif /* DEF_agentrank_ns0_messages_M */
#ifndef DEF_agentrank_ns0_status_M
#define DEF_agentrank_ns0_status_M

/**
 * Reads a Status element from XML. The element to be read is "status", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The Status, or NULL in case of error.
 */
struct agentrank_ns0_status *xml_read_agentrank_ns0_status(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0StatusElement(reader);
}

/**
 * Writes a Status to XML under element name "status".
 *
 * @param writer The XML writer.
 * @param _status The Status to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_status(xmlTextWriterPtr writer, struct agentrank_ns0_status *_status) {
  return xmlTextWriterWriteNs0StatusElementNS(writer, _status, 1);
}

/**
 * Frees a Status.
 *
 * @param _status The Status to free.
 */
void free_agentrank_ns0_status(struct agentrank_ns0_status *_status) {
  freeNs0StatusType(_status);
  free(_status);
}

/**
 * Reads a Status element from XML. The element to be read is "status", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The Status, or NULL in case of error.
 */
struct agentrank_ns0_status *xmlTextReaderReadNs0StatusElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_status *_status = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "status", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}status.\n");
#endif
    _status = xmlTextReaderReadNs0StatusType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_status == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}status failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}status failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _status;
}

/**
 * Writes a Status to XML under element name "status".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _status The Status to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0StatusElement(xmlTextWriterPtr writer, struct agentrank_ns0_status *_status) {
  return xmlTextWriterWriteNs0StatusElementNS(writer, _status, 0);
}

/**
 * Writes a Status to XML under element name "status".
 *
 * @param writer The XML writer.
 * @param _status The Status to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0StatusElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_status *_status, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "status", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}status. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}status for root element {}status...\n");
#endif
  status = xmlTextWriterWriteNs0StatusType(writer, _status);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}status. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}status. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children of a Status.
 *
 * @param _status The Status whose children are to be free.
 */
static void freeNs0StatusElement(struct agentrank_ns0_status *_status) {
  freeNs0StatusType(_status);
}

/**
 * Reads a Status from XML. The reader is assumed to be at the start element.
 *
 * @return the Status, or NULL in case of error.
 */
static struct agentrank_ns0_status *xmlTextReaderReadNs0StatusType(xmlTextReaderPtr reader) {
  int status, depth;
  void *_child_accessor;
  struct agentrank_ns0_status *_status = calloc(1, sizeof(struct agentrank_ns0_status));

  if (xmlTextReaderHasAttributes(reader)) {
    while (xmlTextReaderMoveToNextAttribute(reader)) {
      if ((xmlStrcmp(BAD_CAST "code", xmlTextReaderConstLocalName(reader)) == 0) && (xmlTextReaderConstNamespaceUri(reader) == NULL)) {
#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read type {http://www.w3.org/2001/XMLSchema}int from attribute {}code...\n");
#endif
        _child_accessor = xmlTextReaderReadXsIntType(reader);
        if (_child_accessor == NULL) {
          //panic: unable to return the attribute value for some reason.
#if DEBUG_ENUNCIATE
          printf("Failed to read attribute {}code of type {http://www.w3.org/2001/XMLSchema}int.\n");
#endif
          freeNs0StatusType(_status);
          free(_status);
          return NULL;
        }
        _status->code = *((int*)_child_accessor);
        freeXsIntType((int*) _child_accessor);
        free(_child_accessor);
        continue;
      }
    }

    status = xmlTextReaderMoveToElement(reader);
    if (status < 1) {
      //panic: unable to return to the element node.
#if DEBUG_ENUNCIATE
      printf("Unable to return to element node from attributes.\n");
#endif
      freeNs0StatusType(_status);
      free(_status);
      return NULL;
    }
  }


  if (xmlTextReaderIsEmptyElement(reader) == 0) {
    depth = xmlTextReaderDepth(reader);//track the depth.
    status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);

    while (xmlTextReaderDepth(reader) > depth) {
      if (status < 1) {
        //panic: XML read error.
#if DEBUG_ENUNCIATE
        printf("Failure to advance to next child element.\n");
#endif
        freeNs0StatusType(_status);
        free(_status);
        return NULL;
      }
      else if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
        && xmlStrcmp(BAD_CAST "messages", xmlTextReaderConstLocalName(reader)) == 0
        && xmlTextReaderConstNamespaceUri(reader) == NULL) {

#if DEBUG_ENUNCIATE > 1
        printf("Attempting to read choice {}messages of type {}messages.\n");
#endif
        _child_accessor = xmlTextReaderReadNs0MessagesType(reader);
        if (_child_accessor == NULL) {
#if DEBUG_ENUNCIATE
          printf("Failed to read choice {}messages of type {}messages.\n");
#endif
          //panic: unable to read the child element for some reason.
          freeNs0StatusType(_status);
          free(_status);
          return NULL;
        }

        _status->messages = ((struct agentrank_ns0_messages*)_child_accessor);
        status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
      }
      else {
#if DEBUG_ENUNCIATE > 1
        if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
          printf("unknown child element {}%s for type {}status.  Skipping...\n",  xmlTextReaderConstLocalName(reader));
        }
        else {
          printf("unknown child element {%s}%s for type {}status. Skipping...\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
        }
#endif
        status = xmlTextReaderSkipElement(reader);
      }
    }
  }

  return _status;
}

/**
 * Writes a Status to XML.
 *
 * @param writer The XML writer.
 * @param _status The Status to write.
 * @return The total bytes written, or -1 on error;
 */
static int xmlTextWriterWriteNs0StatusType(xmlTextWriterPtr writer, struct agentrank_ns0_status *_status) {
  int status, totalBytes = 0, i;
  xmlChar *binaryData;

  if (1) { //always write the primitive attribute
    status = xmlTextWriterStartAttributeNS(writer, NULL, BAD_CAST "code", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start attribute {}code. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {http://www.w3.org/2001/XMLSchema}int for attribute {}code...\n");
#endif
    status = xmlTextWriterWriteXsIntType(writer, &(_status->code));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {http://www.w3.org/2001/XMLSchema}int for attribute {}code. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndAttribute(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end attribute {}code. status: %i", status);
#endif
      return status;
    }
    totalBytes += status;
  }
  if (_status->messages != NULL) {
    status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "messages", NULL);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write start element {}messages. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

#if DEBUG_ENUNCIATE > 1
    printf("writing type {}messages for element {}messages...\n", status);
#endif
    status = xmlTextWriterWriteNs0MessagesType(writer, (_status->messages));
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write type {}messages for element {}messages. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;

    status = xmlTextWriterEndElement(writer);
    if (status < 0) {
#if DEBUG_ENUNCIATE
      printf("Failed to write end element {}messages. status: %i\n", status);
#endif
      return status;
    }
    totalBytes += status;
  }

  return totalBytes;
}

/**
 * Frees the elements of a Status.
 *
 * @param _status The Status to free.
 */
static void freeNs0StatusType(struct agentrank_ns0_status *_status) {
  int i;
  if (_status->messages != NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Freeing type of accessor messages of type agentrank_ns0_status...\n");
#endif
    freeNs0MessagesType(_status->messages);
#if DEBUG_ENUNCIATE > 1
    printf("Freeing accessor messages of type agentrank_ns0_status...\n");
#endif
    free(_status->messages);
  }
}
#endif /* DEF_agentrank_ns0_status_M */
#ifndef DEF_agentrank_ns0_editUser_M
#define DEF_agentrank_ns0_editUser_M

/**
 * Reads a EditUser element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to the XML document (not the element).
 *
 * @param reader The XML reader.
 * @return The EditUser, or NULL in case of error.
 */
struct agentrank_ns0_editUser *xml_read_agentrank_ns0_editUser(xmlTextReaderPtr reader) {
  int status = xmlTextReaderAdvanceToNextStartOrEndElement(reader);
  return xmlTextReaderReadNs0ResponseElement(reader);
}

/**
 * Writes a EditUser to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _editUser The EditUser to write.
 * @return 1 if successful, 0 otherwise.
 */
int xml_write_agentrank_ns0_editUser(xmlTextWriterPtr writer, struct agentrank_ns0_editUser *_editUser) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _editUser, 1);
}

/**
 * Frees a EditUser.
 *
 * @param _editUser The EditUser to free.
 */
void free_agentrank_ns0_editUser(struct agentrank_ns0_editUser *_editUser) {
  freeNs0EditUserType(_editUser);
  free(_editUser);
}

/**
 * Reads a EditUser element from XML. The element to be read is "response", and
 * it is assumed that the reader is pointing to that element.
 *
 * @param reader The XML reader.
 * @return The EditUser, or NULL in case of error.
 */
struct agentrank_ns0_editUser *xmlTextReaderReadNs0ResponseElement(xmlTextReaderPtr reader) {
  struct agentrank_ns0_editUser *_editUser = NULL;

  if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT
    && xmlStrcmp(BAD_CAST "response", xmlTextReaderConstLocalName(reader)) == 0
    && xmlTextReaderConstNamespaceUri(reader) == NULL) {
#if DEBUG_ENUNCIATE > 1
    printf("Attempting to read root element {}response.\n");
#endif
    _editUser = xmlTextReaderReadNs0EditUserType(reader);
  }
#if DEBUG_ENUNCIATE
  if (_editUser == NULL) {
    if (xmlTextReaderConstNamespaceUri(reader) == NULL) {
      printf("attempt to read {}response failed. current element: {}%s\n",  xmlTextReaderConstLocalName(reader));
    }
    else {
      printf("attempt to read {}response failed. current element: {%s}%s\n", xmlTextReaderConstNamespaceUri(reader), xmlTextReaderConstLocalName(reader));
    }
  }
#endif

  return _editUser;
}

/**
 * Writes a EditUser to XML under element name "response".
 * Does NOT write the namespace prefixes.
 *
 * @param writer The XML writer.
 * @param _editUser The EditUser to write.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElement(xmlTextWriterPtr writer, struct agentrank_ns0_editUser *_editUser) {
  return xmlTextWriterWriteNs0ResponseElementNS(writer, _editUser, 0);
}

/**
 * Writes a EditUser to XML under element name "response".
 *
 * @param writer The XML writer.
 * @param _editUser The EditUser to write.
 * @param writeNamespaces Whether to write the namespace prefixes.
 * @return 1 if successful, 0 otherwise.
 */
static int xmlTextWriterWriteNs0ResponseElementNS(xmlTextWriterPtr writer, struct agentrank_ns0_editUser *_editUser, int writeNamespaces) {
  int totalBytes = 0;
  int status;

  status = xmlTextWriterStartElementNS(writer, NULL, BAD_CAST "response", NULL);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

#if DEBUG_ENUNCIATE > 1
  printf("writing type {}editUser for root element {}response...\n");
#endif
  status = xmlTextWriterWriteNs0EditUserType(writer, _editUser);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to write type for start element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  status = xmlTextWriterEndElement(writer);
  if (status < 0) {
#if DEBUG_ENUNCIATE
    printf("unable to end element {}response. status: %i\n", status);
#endif
    return status;
  }
  totalBytes += status;

  return totalBytes;
}

/**
 * Frees the children