private void WriteXMLSimpleData(XmlWriterImpl xmlWriter, string name, IValue value, XMLExpandedName type, XMLTypeAssignment typeAssigment, XMLForm form) { XmlNamespaceContext namespaceContext; string xmlValue = XMLString(value); switch (form) { case XMLForm.Attribute: namespaceContext = xmlWriter.NamespaceContext; AddNamespaceMapping(namespaceContext, xmlWriter, "", XmlSchema.Namespace); xmlWriter.WriteStartAttribute(name); xmlWriter.WriteText(xmlValue); xmlWriter.WriteEndAttribute(); break; case XMLForm.Text: xmlWriter.WriteText(xmlValue); break; default: xmlWriter.WriteStartElement(name); namespaceContext = xmlWriter.NamespaceContext; AddNamespaceMapping(namespaceContext, xmlWriter, "", XmlSchema.Namespace); AddNamespaceMapping(namespaceContext, xmlWriter, "xsi", XmlSchema.InstanceNamespace); if (typeAssigment == XMLTypeAssignment.Explicit) { xmlWriter.WriteStartAttribute("type", XmlSchema.InstanceNamespace); xmlWriter.WriteText(type.LocalName); xmlWriter.WriteEndAttribute(); } xmlWriter.WriteText(xmlValue); xmlWriter.WriteEndElement(); break; } }
private void WriteXMLUndefined(XmlWriterImpl xmlWriter, string name, XMLForm form) { if (form == XMLForm.Element) { XmlNamespaceContext namespaceContext = xmlWriter.NamespaceContext; AddNamespaceMapping(namespaceContext, xmlWriter, "", XmlSchema.Namespace); AddNamespaceMapping(namespaceContext, xmlWriter, "xsi", XmlSchema.InstanceNamespace); xmlWriter.WriteStartElement(name); xmlWriter.WriteStartAttribute("nil", XmlSchema.InstanceNamespace); xmlWriter.WriteText("true"); xmlWriter.WriteEndAttribute(); xmlWriter.WriteEndElement(); } }