/// <summary> Converts the XElement into a SerializeNode </summary> public static SerializeNode Deserialize(XElement root) { // ReSharper disable PossibleNullReferenceException var typeId = root.Attribute(TypeIdAttributeName).Value; var node = new SerializeNode(typeId); // recreate each element foreach (var attributeElement in root.Elements(AttributeElementName)) { node.AddData(attributeElement.Attribute(KeyAttributeName).Value, attributeElement.Attribute(ValueAttributeName).Value); } // recreate each block foreach (var childElement in root.Elements(NodeElementName)) { node.Children.Add(Deserialize(childElement)); } return(node); // ReSharper restore PossibleNullReferenceException }
/// <summary /> public void SerializeInto(SerializeNode node) { node.AddData("Body", _buffer.GetText()); }