TimXmlRpc.cpp
// Set the value from xml. The chars at *offset into valueXml 
// should be the start of a <value> tag. Destroys any existing value.
Set the value from xml. The chars at *offset into valueXml
should be the start of a  tag. Destroys any existing value.
Set the value from xml . The chars at * offset into valueXml should be the start of a tag . Destroys any existing value .
void XmlRpcValue::fromXml(const char* &s)
{
	char tag[128];
	invalidate();
	GobbleTag(s, tag);
	if (strieq(tag, "<value>"))
		;	
	else if (strieq(tag, "<value/>")) {
		_type = TypeString;
		u.asString = _strdup("");
		return;
	}
	else
		throw XmlRpcException(std::string("Expecting tag: <value>"));
	GobbleTag(s, tag);
	if (*tag == '\0') {
		stringFromXml(s);
	}
	else if (strieq(tag, BOOLEAN_TAG)) {
		boolFromXml(s);
		GobbleExpectedTag(s, BOOLEAN_ETAG);
	}
	else if (strieq(tag, I4_TAG)) {
		intFromXml(s);
		GobbleExpectedTag(s, I4_ETAG);
	}
	else if (strieq(tag, INT_TAG)) {
		intFromXml(s);
		GobbleExpectedTag(s, INT_ETAG);
	}
	else if (strieq(tag, DOUBLE_TAG)) {
		doubleFromXml(s);
		GobbleExpectedTag(s, DOUBLE_ETAG);
	}
	else if (strieq(tag, STRING_TAG)) {
		stringFromXml(s);
		GobbleExpectedTag(s, STRING_ETAG);
	}
	else if (strieq(tag, DATETIME_TAG)) {
		timeFromXml(s);
		GobbleExpectedTag(s, DATETIME_ETAG);
	}
	else if (strieq(tag, BASE64_TAG)) {
		binaryFromXml(s);
		GobbleExpectedTag(s, BASE64_ETAG);
	}
	else if (strieq(tag, ARRAY_TAG)) {
		arrayFromXml(s);
		GobbleExpectedTag(s, ARRAY_ETAG);
	}
	else if (strieq(tag, STRUCT_TAG)) {
		structFromXml(s);
		GobbleExpectedTag(s, STRUCT_ETAG);
	}
	else if (strieq(tag, "<string/>")) {
		_type = TypeString;
		u.asString = _strdup("");
	}
	else if (strieq(tag, "<nil/>")) {
		_type = TypeNil;
	}
	else if (strieq(tag, "<struct/>")) {
		_type = TypeStruct;
		u.asStruct = new ValueStruct;
	}
	else if (strieq(tag, VALUE_ETAG)) {	
		_type = TypeString;
		u.asString = _strdup("");
		return;	
	}
	else {
		throw XmlRpcException(std::string("Unknown type tag: ") + tag);
	}
	GobbleExpectedTag(s, VALUE_ETAG);
}
void XmlRpcValue :: fromXml ( const char * & s ) { char tag [ 128 ] ; invalidate ( ) ; GobbleTag ( s , tag ) ; if ( strieq ( tag , " " ) ) ; else if ( strieq ( tag , " " ) ) { _type = TypeString ; u . asString = _strdup ( " " ) ; return ; } else throw XmlRpcException ( std :: string ( " " ) ) ; GobbleTag ( s , tag ) ; if ( * tag == ' \0 ' ) { stringFromXml ( s ) ; } else if ( strieq ( tag , BOOLEAN_TAG ) ) { boolFromXml ( s ) ; GobbleExpectedTag ( s , BOOLEAN_ETAG ) ; } else if ( strieq ( tag , I4_TAG ) ) { intFromXml ( s ) ; GobbleExpectedTag ( s , I4_ETAG ) ; } else if ( strieq ( tag , INT_TAG ) ) { intFromXml ( s ) ; GobbleExpectedTag ( s , INT_ETAG ) ; } else if ( strieq ( tag , DOUBLE_TAG ) ) { doubleFromXml ( s ) ; GobbleExpectedTag ( s , DOUBLE_ETAG ) ; } else if ( strieq ( tag , STRING_TAG ) ) { stringFromXml ( s ) ; GobbleExpectedTag ( s , STRING_ETAG ) ; } else if ( strieq ( tag , DATETIME_TAG ) ) { timeFromXml ( s ) ; GobbleExpectedTag ( s , DATETIME_ETAG ) ; } else if ( strieq ( tag , BASE64_TAG ) ) { binaryFromXml ( s ) ; GobbleExpectedTag ( s , BASE64_ETAG ) ; } else if ( strieq ( tag , ARRAY_TAG ) ) { arrayFromXml ( s ) ; GobbleExpectedTag ( s , ARRAY_ETAG ) ; } else if ( strieq ( tag , STRUCT_TAG ) ) { structFromXml ( s ) ; GobbleExpectedTag ( s , STRUCT_ETAG ) ; } else if ( strieq ( tag , " " ) ) { _type = TypeString ; u . asString = _strdup ( " " ) ; } else if ( strieq ( tag , " " ) ) { _type = TypeNil ; } else if ( strieq ( tag , " " ) ) { _type = TypeStruct ; u . asStruct = new ValueStruct ; } else if ( strieq ( tag , VALUE_ETAG ) ) { _type = TypeString ; u . asString = _strdup ( " " ) ; return ; } else { throw XmlRpcException ( std :: string ( " " ) + tag ) ; } GobbleExpectedTag ( s , VALUE_ETAG ) ; }
Set the value from xml.
Set the value from xml .
// Gobble the <value> tag: // good // Jeff Rasmussen claims that <value/> is valid XmlRpc. I think he's correct. // Gobble the type tag: // If no type is indicated, the type is string. // "If no type is indicated, the type is string." // don't gobble VALUE_ETAG because we already did