/*! 
 * Initializes the object from an XML element. Unsafe. 
 *
 * \throws	ExceptionInvalidArgument	not a FeatureExtractorProjection
 * \throws	ExceptionNotFound	attribute not found
 * \throws	ExceptionDomain	wrong attribute
 */
void FeatureExtractorProjection::deserialize(xml::Element &el)
{
	if (el.GetName() != GetClassName())
	{
		throw ExceptionInvalidArgument(StringUTF8("bool FeatureExtractorProjection::deserialize("
					"xml::Element &el): ") + _("Wrong XML element."));
	}
	int d = el.GetAttribute<int>("direction", false); // may throw
	int s = el.GetAttribute<int>("size", false); // may throw
	int m = el.GetAttribute<int>("maxval", false); // may throw
	dirs = Orientation(d);
	size = s;
	maxval = m;
}
Exemple #2
0
/*!
 * Initializes the object from an XML element. Unsafe.
 *
 * \throws	ExceptionInvalidArgument	not a String
 * \throws	ExceptionDomain	no CDATA found
 *
 * \param[in]	el	the XML element to read
 */
void String::Deserialize(xml::Element &el)
{
	if (el.GetName() != "String")
	{
		throw ExceptionInvalidArgument(StringUTF8("void String::Deserialize(xml::Element &el): ") +
				_("Wrong XML element."));
	}
	xml::Node c(el.GetFirstChild());
	if (!c)
		return; // no content
	xml::Text t(c.AsText()); // may throw
	*this = t.GetValue();
	ShrinkToFit();
}