private void ReadArrayElements(JsonReader reader, IXmlDocument document, string propertyName, IXmlNode currentNode, XmlNamespaceManager manager) { string prefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement xmlElement = this.CreateElement(propertyName, document, prefix, manager); currentNode.AppendChild(xmlElement); int num = 0; while (reader.Read() && reader.TokenType != JsonToken.EndArray) { this.DeserializeValue(reader, document, manager, propertyName, xmlElement); num++; } if (this.WriteArrayAttribute) { this.AddJsonArrayAttribute(xmlElement, document); } if (num == 1 && this.WriteArrayAttribute) { foreach (IXmlNode childNode in xmlElement.ChildNodes) { IXmlElement xmlElement1 = childNode as IXmlElement; if (xmlElement1 == null || !(xmlElement1.LocalName == propertyName)) { continue; } this.AddJsonArrayAttribute(xmlElement1, document); return; } } }
private void ReadElement(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName, XmlNamespaceManager manager) { if (string.IsNullOrEmpty(propertyName)) { throw JsonSerializationException.Create(reader, "XmlNodeConverter cannot convert JSON with an empty property name to XML."); } Dictionary <string, string> strs = this.ReadAttributeElements(reader, manager); string prefix = MiscellaneousUtils.GetPrefix(propertyName); if (propertyName.StartsWith('@')) { string str = propertyName.Substring(1); string prefix1 = MiscellaneousUtils.GetPrefix(str); XmlNodeConverter.AddAttribute(reader, document, currentNode, str, manager, prefix1); return; } if (propertyName.StartsWith('$')) { if (propertyName == "$values") { propertyName = propertyName.Substring(1); prefix = manager.LookupPrefix("http://james.newtonking.com/projects/json"); this.CreateElement(reader, document, currentNode, propertyName, manager, prefix, strs); return; } if (propertyName == "$id" || propertyName == "$ref" || propertyName == "$type" || propertyName == "$value") { string str1 = propertyName.Substring(1); string str2 = manager.LookupPrefix("http://james.newtonking.com/projects/json"); XmlNodeConverter.AddAttribute(reader, document, currentNode, str1, manager, str2); return; } } this.CreateElement(reader, document, currentNode, propertyName, manager, prefix, strs); }
private void CreateElement(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string elementName, XmlNamespaceManager manager, string elementPrefix, Dictionary <string, string> attributeNameValues) { IXmlElement xmlElement = this.CreateElement(elementName, document, elementPrefix, manager); currentNode.AppendChild(xmlElement); foreach (KeyValuePair <string, string> attributeNameValue in attributeNameValues) { string str = XmlConvert.EncodeName(attributeNameValue.Key); string prefix = MiscellaneousUtils.GetPrefix(attributeNameValue.Key); xmlElement.SetAttributeNode((!string.IsNullOrEmpty(prefix) ? document.CreateAttribute(str, manager.LookupNamespace(prefix) ?? string.Empty, attributeNameValue.Value) : document.CreateAttribute(str, attributeNameValue.Value))); } if (reader.TokenType == JsonToken.String || reader.TokenType == JsonToken.Integer || reader.TokenType == JsonToken.Float || reader.TokenType == JsonToken.Boolean || reader.TokenType == JsonToken.Date) { string xmlValue = this.ConvertTokenToXmlValue(reader); if (xmlValue != null) { xmlElement.AppendChild(document.CreateTextNode(xmlValue)); return; } } else if (reader.TokenType != JsonToken.Null) { if (reader.TokenType != JsonToken.EndObject) { manager.PushScope(); this.DeserializeNode(reader, document, manager, xmlElement); manager.PopScope(); } manager.RemoveNamespace(string.Empty, manager.DefaultNamespace); } }
private void CreateElement(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string elementName, XmlNamespaceManager manager, string elementPrefix, Dictionary <string, string> attributeNameValues) { IXmlElement newChild = this.CreateElement(elementName, document, elementPrefix, manager); currentNode.AppendChild(newChild); foreach (KeyValuePair <string, string> pair in attributeNameValues) { string qualifiedName = XmlConvert.EncodeName(pair.Key); string prefix = MiscellaneousUtils.GetPrefix(pair.Key); string text1 = manager.LookupNamespace(prefix); if (text1 == null) { } IXmlNode attribute = !string.IsNullOrEmpty(prefix) ? document.CreateAttribute(qualifiedName, string.Empty, pair.Value) : document.CreateAttribute(qualifiedName, pair.Value); newChild.SetAttributeNode(attribute); } if (((reader.TokenType == JsonToken.String) || (reader.TokenType == JsonToken.Integer)) || (((reader.TokenType == JsonToken.Float) || (reader.TokenType == JsonToken.Boolean)) || (reader.TokenType == JsonToken.Date))) { string text = this.ConvertTokenToXmlValue(reader); if (text != null) { newChild.AppendChild(document.CreateTextNode(text)); } } else if (reader.TokenType != JsonToken.Null) { if (reader.TokenType != JsonToken.EndObject) { manager.PushScope(); this.DeserializeNode(reader, document, manager, newChild); manager.PopScope(); } manager.RemoveNamespace(string.Empty, manager.DefaultNamespace); } }
private void ReadArrayElements(JsonReader reader, IXmlDocument document, string propertyName, IXmlNode currentNode, XmlNamespaceManager manager) { string elementPrefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement nestedArrayElement = CreateElement(propertyName, document, elementPrefix, manager); currentNode.AppendChild(nestedArrayElement); int count = 0; while (reader.Read() && reader.TokenType != JsonToken.EndArray) { DeserializeValue(reader, document, manager, propertyName, nestedArrayElement); count++; } if (WriteArrayAttribute) { AddJsonArrayAttribute(nestedArrayElement, document); } if (count == 1 && WriteArrayAttribute) { IXmlElement arrayElement = nestedArrayElement.ChildNodes.CastValid <IXmlElement>().Single(n => n.LocalName == propertyName); AddJsonArrayAttribute(arrayElement, document); } }
private void ReadArrayElements(JsonReader reader, IXmlDocument document, string propertyName, IXmlNode currentNode, XmlNamespaceManager manager) { string prefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement newChild = this.CreateElement(propertyName, document, prefix, manager); currentNode.AppendChild(newChild); int num = 0; while (reader.Read() && (reader.TokenType != JsonToken.EndArray)) { this.DeserializeValue(reader, document, manager, propertyName, newChild); num++; } if (this.WriteArrayAttribute) { this.AddJsonArrayAttribute(newChild, document); } if ((num == 1) && this.WriteArrayAttribute) { foreach (IXmlElement element2 in newChild.ChildNodes) { if ((element2 != null) && (element2.LocalName == propertyName)) { this.AddJsonArrayAttribute(element2, document); break; } } } }
private void ReadElement(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName, XmlNamespaceManager manager) { Dictionary <string, string> attributeNameValues = ReadAttributeElements(reader, manager); string elementPrefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement element = CreateElement(propertyName, document, elementPrefix, manager); currentNode.AppendChild(element); // add attributes to newly created element foreach (KeyValuePair <string, string> nameValue in attributeNameValues) { string attributePrefix = MiscellaneousUtils.GetPrefix(nameValue.Key); IXmlNode attribute = (!string.IsNullOrEmpty(attributePrefix)) ? document.CreateAttribute(nameValue.Key, manager.LookupNamespace(attributePrefix), nameValue.Value) : document.CreateAttribute(nameValue.Key, nameValue.Value); element.SetAttributeNode(attribute); } if (reader.TokenType == JsonToken.String) { element.AppendChild(document.CreateTextNode(reader.Value.ToString())); } else if (reader.TokenType == JsonToken.Integer) { element.AppendChild(document.CreateTextNode(XmlConvert.ToString((long)reader.Value))); } else if (reader.TokenType == JsonToken.Float) { element.AppendChild(document.CreateTextNode(XmlConvert.ToString((double)reader.Value))); } else if (reader.TokenType == JsonToken.Boolean) { element.AppendChild(document.CreateTextNode(XmlConvert.ToString((bool)reader.Value))); } else if (reader.TokenType == JsonToken.Date) { DateTime d = (DateTime)reader.Value; element.AppendChild(document.CreateTextNode(XmlConvert.ToString(d, DateTimeUtils.ToSerializationMode(d.Kind)))); } else if (reader.TokenType == JsonToken.Null) { // empty element. do nothing } else { // finished element will have no children to deserialize if (reader.TokenType != JsonToken.EndObject) { manager.PushScope(); DeserializeNode(reader, document, manager, element); manager.PopScope(); } } }
private void ReadArrayElements( JsonReader reader, IXmlDocument document, string propertyName, IXmlNode currentNode, XmlNamespaceManager manager) { string prefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement element1 = this.CreateElement(propertyName, document, prefix, manager); currentNode.AppendChild((IXmlNode)element1); int num = 0; while (reader.Read() && reader.TokenType != JsonToken.EndArray) { this.DeserializeValue(reader, document, manager, propertyName, (IXmlNode)element1); ++num; } if (this.WriteArrayAttribute) { this.AddJsonArrayAttribute(element1, document); } if (num != 1 || !this.WriteArrayAttribute) { return; } foreach (IXmlNode childNode in element1.ChildNodes) { if (childNode is IXmlElement element2 && element2.LocalName == propertyName) { this.AddJsonArrayAttribute(element2, document); break; } } }
private void ReadElement(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName, XmlNamespaceManager manager) { if (string.IsNullOrEmpty(propertyName)) { throw new JsonSerializationException("XmlNodeConverter cannot convert JSON with an empty property name to XML."); } Dictionary <string, string> dictionary = ReadAttributeElements(reader, manager); string prefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement xmlElement = CreateElement(propertyName, document, prefix, manager); currentNode.AppendChild(xmlElement); foreach (KeyValuePair <string, string> item in dictionary) { string prefix2 = MiscellaneousUtils.GetPrefix(item.Key); object xmlNode2; if (!string.IsNullOrEmpty(prefix2)) { IXmlNode xmlNode = document.CreateAttribute(item.Key, manager.LookupNamespace(prefix2), item.Value); xmlNode2 = xmlNode; } else { xmlNode2 = document.CreateAttribute(item.Key, item.Value); } IXmlNode attributeNode = (IXmlNode)xmlNode2; xmlElement.SetAttributeNode(attributeNode); } if (reader.TokenType == JsonToken.String) { xmlElement.AppendChild(document.CreateTextNode(reader.Value.ToString())); } else if (reader.TokenType == JsonToken.Integer) { xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString((long)reader.Value))); } else if (reader.TokenType == JsonToken.Float) { xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString((double)reader.Value))); } else if (reader.TokenType == JsonToken.Boolean) { xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString((bool)reader.Value))); } else if (reader.TokenType == JsonToken.Date) { DateTime value = (DateTime)reader.Value; xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString(value, DateTimeUtils.ToSerializationMode(value.Kind)))); } else if (reader.TokenType != JsonToken.Null && reader.TokenType != JsonToken.EndObject) { manager.PushScope(); DeserializeNode(reader, document, manager, xmlElement); manager.PopScope(); } }
private void CreateElement( JsonReader reader, IXmlDocument document, IXmlNode currentNode, string elementName, XmlNamespaceManager manager, string elementPrefix, Dictionary <string, string> attributeNameValues) { IXmlElement element = this.CreateElement(elementName, document, elementPrefix, manager); currentNode.AppendChild((IXmlNode)element); if (attributeNameValues != null) { foreach (KeyValuePair <string, string> attributeNameValue in attributeNameValues) { string str = XmlConvert.EncodeName(attributeNameValue.Key); string prefix = MiscellaneousUtils.GetPrefix(attributeNameValue.Key); IXmlNode attribute = !string.IsNullOrEmpty(prefix) ? document.CreateAttribute(str, manager.LookupNamespace(prefix) ?? string.Empty, attributeNameValue.Value) : document.CreateAttribute(str, attributeNameValue.Value); element.SetAttributeNode(attribute); } } switch (reader.TokenType) { case JsonToken.Integer: case JsonToken.Float: case JsonToken.String: case JsonToken.Boolean: case JsonToken.Date: string xmlValue = this.ConvertTokenToXmlValue(reader); if (xmlValue == null) { break; } element.AppendChild(document.CreateTextNode(xmlValue)); break; case JsonToken.Null: break; case JsonToken.EndObject: manager.RemoveNamespace(string.Empty, manager.DefaultNamespace); break; default: manager.PushScope(); this.DeserializeNode(reader, document, manager, (IXmlNode)element); manager.PopScope(); manager.RemoveNamespace(string.Empty, manager.DefaultNamespace); break; } }
private void ReadElement(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName, XmlNamespaceManager manager) { if (string.IsNullOrEmpty(propertyName)) { throw new JsonSerializationException("XmlNodeConverter cannot convert JSON with an empty property name to XML."); } Dictionary <string, string> attributeNameValues = this.ReadAttributeElements(reader, manager); string elementPrefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement element = this.CreateElement(propertyName, document, elementPrefix, manager); currentNode.AppendChild(element); // add attributes to newly created element foreach (KeyValuePair <string, string> nameValue in attributeNameValues) { string attributePrefix = MiscellaneousUtils.GetPrefix(nameValue.Key); IXmlNode attribute = (!string.IsNullOrEmpty(attributePrefix)) ? document.CreateAttribute(nameValue.Key, manager.LookupNamespace(attributePrefix), nameValue.Value) : document.CreateAttribute(nameValue.Key, nameValue.Value); element.SetAttributeNode(attribute); } if (reader.TokenType == JsonToken.String || reader.TokenType == JsonToken.Integer || reader.TokenType == JsonToken.Float || reader.TokenType == JsonToken.Boolean || reader.TokenType == JsonToken.Date) { element.AppendChild(document.CreateTextNode(this.ConvertTokenToXmlValue(reader))); } else if (reader.TokenType == JsonToken.Null) { // empty element. do nothing } else { // finished element will have no children to deserialize if (reader.TokenType != JsonToken.EndObject) { manager.PushScope(); this.DeserializeNode(reader, document, manager, element); manager.PopScope(); } } }
private void ReadArrayElements(JsonReader reader, IXmlDocument document, string propertyName, IXmlNode currentNode, XmlNamespaceManager manager) { string elementPrefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement nestedArrayElement = CreateElement(propertyName, document, elementPrefix, manager); currentNode.AppendChild(nestedArrayElement); while (reader.Read() && reader.TokenType != JsonToken.EndArray) { DeserializeValue(reader, document, manager, propertyName, nestedArrayElement); } }
private void ReadElement(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName, XmlNamespaceManager manager) { if (string.IsNullOrEmpty(propertyName)) { throw new JsonSerializationException("XmlNodeConverter cannot convert JSON with an empty property name to XML."); } Dictionary <string, string> strs = this.ReadAttributeElements(reader, manager); string prefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement xmlElement = this.CreateElement(propertyName, document, prefix, manager); currentNode.AppendChild(xmlElement); foreach (KeyValuePair <string, string> keyValuePair in strs) { string str = MiscellaneousUtils.GetPrefix(keyValuePair.Key); xmlElement.SetAttributeNode((string.IsNullOrEmpty(str) ? document.CreateAttribute(keyValuePair.Key, keyValuePair.Value) : document.CreateAttribute(keyValuePair.Key, manager.LookupNamespace(str), keyValuePair.Value))); } if (reader.TokenType == JsonToken.String) { xmlElement.AppendChild(document.CreateTextNode(reader.Value.ToString())); } else if (reader.TokenType == JsonToken.Integer) { xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString((long)reader.Value))); } else if (reader.TokenType == JsonToken.Float) { xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString((double)reader.Value))); } else if (reader.TokenType == JsonToken.Boolean) { xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString((bool)reader.Value))); } else if (reader.TokenType == JsonToken.Date) { DateTime value = (DateTime)reader.Value; xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString(value, Newtonsoft.Json.Utilities.DateTimeUtils.ToSerializationMode(value.Kind)))); } else if (reader.TokenType != JsonToken.Null) { if (reader.TokenType != JsonToken.EndObject) { manager.PushScope(); this.DeserializeNode(reader, document, manager, xmlElement); manager.PopScope(); } } }
private void ReadElement(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName, XmlNamespaceManager manager) { if (string.IsNullOrEmpty(propertyName)) { throw new JsonSerializationException("XmlNodeConverter cannot convert JSON with an empty property name to XML."); } Dictionary <string, string> dictionary = this.ReadAttributeElements(reader, manager); string prefix = MiscellaneousUtils.GetPrefix(propertyName); if (propertyName.StartsWith("@")) { string text = propertyName.Substring(1); string value = reader.Value.ToString(); string prefix2 = MiscellaneousUtils.GetPrefix(text); IXmlNode attributeNode = (!string.IsNullOrEmpty(prefix2)) ? document.CreateAttribute(text, manager.LookupNamespace(prefix2), value) : document.CreateAttribute(text, value); ((IXmlElement)currentNode).SetAttributeNode(attributeNode); return; } IXmlElement xmlElement = this.CreateElement(propertyName, document, prefix, manager); currentNode.AppendChild(xmlElement); foreach (KeyValuePair <string, string> current in dictionary) { string prefix3 = MiscellaneousUtils.GetPrefix(current.Key); IXmlNode attributeNode2 = (!string.IsNullOrEmpty(prefix3)) ? document.CreateAttribute(current.Key, manager.LookupNamespace(prefix3), current.Value) : document.CreateAttribute(current.Key, current.Value); xmlElement.SetAttributeNode(attributeNode2); } if (reader.TokenType == JsonToken.String || reader.TokenType == JsonToken.Integer || reader.TokenType == JsonToken.Float || reader.TokenType == JsonToken.Boolean || reader.TokenType == JsonToken.Date) { xmlElement.AppendChild(document.CreateTextNode(this.ConvertTokenToXmlValue(reader))); return; } if (reader.TokenType == JsonToken.Null) { return; } if (reader.TokenType != JsonToken.EndObject) { manager.PushScope(); this.DeserializeNode(reader, document, manager, xmlElement); manager.PopScope(); } }
private void ReadElement(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName, XmlNamespaceManager manager) { if (string.IsNullOrEmpty(propertyName)) { throw new JsonSerializationException("XmlNodeConverter cannot convert JSON with an empty property name to XML."); } Dictionary <string, string> dictionary = this.ReadAttributeElements(reader, manager); string prefix1 = MiscellaneousUtils.GetPrefix(propertyName); if (propertyName.StartsWith("@")) { string str1 = propertyName.Substring(1); string str2 = reader.Value.ToString(); string prefix2 = MiscellaneousUtils.GetPrefix(str1); IXmlNode attribute = !string.IsNullOrEmpty(prefix2) ? document.CreateAttribute(str1, manager.LookupNamespace(prefix2), str2) : document.CreateAttribute(str1, str2); ((IXmlElement)currentNode).SetAttributeNode(attribute); } else { IXmlElement element = this.CreateElement(propertyName, document, prefix1, manager); currentNode.AppendChild((IXmlNode)element); foreach (KeyValuePair <string, string> keyValuePair in dictionary) { string prefix2 = MiscellaneousUtils.GetPrefix(keyValuePair.Key); IXmlNode attribute = !string.IsNullOrEmpty(prefix2) ? document.CreateAttribute(keyValuePair.Key, manager.LookupNamespace(prefix2), keyValuePair.Value) : document.CreateAttribute(keyValuePair.Key, keyValuePair.Value); element.SetAttributeNode(attribute); } if (reader.TokenType == JsonToken.String || reader.TokenType == JsonToken.Integer || (reader.TokenType == JsonToken.Float || reader.TokenType == JsonToken.Boolean) || reader.TokenType == JsonToken.Date) { element.AppendChild(document.CreateTextNode(this.ConvertTokenToXmlValue(reader))); } else { if (reader.TokenType == JsonToken.Null || reader.TokenType == JsonToken.EndObject) { return; } manager.PushScope(); this.DeserializeNode(reader, document, manager, (IXmlNode)element); manager.PopScope(); } } }
private void ReadArrayElements(JsonReader reader, IXmlDocument document, string propertyName, IXmlNode currentNode, XmlNamespaceManager manager) { string prefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement xmlElement = this.CreateElement(propertyName, document, prefix, manager); currentNode.AppendChild(xmlElement); int num = 0; while (reader.Read() && reader.TokenType != JsonToken.EndArray) { this.DeserializeValue(reader, document, manager, propertyName, xmlElement); num++; } if (this.WriteArrayAttribute) { this.AddJsonArrayAttribute(xmlElement, document); } if (num == 1 && this.WriteArrayAttribute) { IXmlElement xmlElement1 = xmlElement.ChildNodes.CastValid <IXmlElement>().Single <IXmlElement>((IXmlElement n) => n.LocalName == propertyName); this.AddJsonArrayAttribute(xmlElement1, document); } }
private void ReadArrayElements(JsonReader reader, IXmlDocument document, string propertyName, IXmlNode currentNode, XmlNamespaceManager manager) { string prefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement element = this.CreateElement(propertyName, document, prefix, manager); currentNode.AppendChild((IXmlNode)element); int num = 0; while (reader.Read() && reader.TokenType != JsonToken.EndArray) { this.DeserializeValue(reader, document, manager, propertyName, (IXmlNode)element); ++num; } if (this.WriteArrayAttribute) { this.AddJsonArrayAttribute(element, document); } if (num != 1 || !this.WriteArrayAttribute) { return; } this.AddJsonArrayAttribute(Enumerable.Single <IXmlElement>(CollectionUtils.CastValid <IXmlElement>((IEnumerable)element.ChildNodes), (Func <IXmlElement, bool>)(n => n.LocalName == propertyName)), document); }
private void ReadElement(JsonReader reader, IXmlDocument document, IXmlNode currentNode, string propertyName, XmlNamespaceManager manager) { if (string.IsNullOrEmpty(propertyName)) { throw new JsonSerializationException("XmlNodeConverter cannot convert JSON with an empty property name to XML."); } Dictionary <string, string> dictionary = this.ReadAttributeElements(reader, manager); string prefix = MiscellaneousUtils.GetPrefix(propertyName); IXmlElement xmlElement = this.CreateElement(propertyName, document, prefix, manager); currentNode.AppendChild(xmlElement); using (Dictionary <string, string> .Enumerator enumerator = dictionary.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <string, string> current = enumerator.get_Current(); string prefix2 = MiscellaneousUtils.GetPrefix(current.get_Key()); IXmlNode arg_A7_0; if (!string.IsNullOrEmpty(prefix2)) { IXmlNode xmlNode = document.CreateAttribute(current.get_Key(), manager.LookupNamespace(prefix2), current.get_Value()); arg_A7_0 = xmlNode; } else { arg_A7_0 = document.CreateAttribute(current.get_Key(), current.get_Value()); } IXmlNode attributeNode = arg_A7_0; xmlElement.SetAttributeNode(attributeNode); } } if (reader.TokenType == JsonToken.String) { xmlElement.AppendChild(document.CreateTextNode(reader.Value.ToString())); } else if (reader.TokenType == JsonToken.Integer) { xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString((long)reader.Value))); } else if (reader.TokenType == JsonToken.Float) { xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString((double)reader.Value))); } else if (reader.TokenType == JsonToken.Boolean) { xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString((bool)reader.Value))); } else if (reader.TokenType == JsonToken.Date) { DateTime dateTime = (DateTime)reader.Value; xmlElement.AppendChild(document.CreateTextNode(XmlConvert.ToString(dateTime, DateTimeUtils.ToSerializationMode(dateTime.get_Kind())))); } else if (reader.TokenType != JsonToken.Null) { if (reader.TokenType != JsonToken.EndObject) { manager.PushScope(); this.DeserializeNode(reader, document, manager, xmlElement); manager.PopScope(); } } }