/// <summary>
/// Creates XML elements from the data of the system.
/// </summary>
/// <param name="xmlWriter">Object with the XML message to add new information and return to client side</param>
/// <param name="val">Value to be puted inside the XML message</param>
/// <param name="dtdVersion">Version of the DTD that follows the XML message</param>
/// <param name="xmlElement">Element of the XML that is checked</param>
public static void ON2XML(XmlWriter xmlWriter, ONBool val, double dtdVersion, string xmlElement)
{
if (val == null)
{
if (xmlElement == ONXml.XMLTAG_V)
xmlWriter.WriteElementString(xmlElement, "");
else
xmlWriter.WriteElementString(ONXml.XMLTAG_NULL, null);
}
else
{
if (dtdVersion < 2.0) // Apply the locale format
{
if (val.TypedValue)
xmlWriter.WriteElementString(xmlElement, "Verdadero");
else
xmlWriter.WriteElementString(xmlElement, "Falso");
}
else
{
xmlWriter.WriteStartElement(xmlElement);
if (xmlElement == ONXml.XMLTAG_OIDFIELD && dtdVersion > 2.0)
xmlWriter.WriteAttributeString("Type", "bool");
if (val.TypedValue)
xmlWriter.WriteString("true");
else
xmlWriter.WriteString("false");
xmlWriter.WriteEndElement();
}
}
}