TreeNode MakeTree(BinaryXmlNode node) { TreeNode tn = new TreeNode(node.Name); foreach (var attr in node.Attributes) { tn.Nodes.Add(attr.Key + "=" + attr.Value); } if (node.Value != null) { tn.Nodes.Add(node.Value); } foreach (var child in node.Children) { tn.Nodes.Add(MakeTree(child)); } return tn; }
TreeNode MakeTree(BinaryXmlNode node) { TreeNode tn = new TreeNode(node.Name); foreach (var attr in node.Attributes) { tn.Nodes.Add(attr.Key + "=" + attr.Value); } if (node.Value != null) { tn.Nodes.Add(node.Value); } foreach (var child in node.Children) { tn.Nodes.Add(MakeTree(child)); } return(tn); }
static XElement FromBXMLNode(XDocument doc, BinaryXmlNode bxmlnode) { var node = new XElement(bxmlnode.Name); foreach (KeyValuePair <string, string> current in bxmlnode.Attributes) { node.Add(new XAttribute(current.Key, current.Value)); } foreach (BinaryXmlNode current2 in bxmlnode.Children) { node.Add(FromBXMLNode(doc, current2)); } if (bxmlnode.Value != null) { node.Value = bxmlnode.Value; } return(node); }
private static void WriteNode(XmlWriter writer, BinaryXmlNode node) { writer.WriteStartElement(node.Name); foreach (var attribute in node.Attributes) { writer.WriteAttributeString(attribute.Key, attribute.Value); } foreach (var child in node.Children) { WriteNode(writer, child); } if (node.Value != null) { writer.WriteValue(node.Value); } writer.WriteEndElement(); }
static XElement FromBXMLNode(XDocument doc, BinaryXmlNode bxmlnode) { var node = new XElement(bxmlnode.Name); foreach (KeyValuePair<string, string> current in bxmlnode.Attributes) { node.Add(new XAttribute(current.Key, current.Value)); } foreach (BinaryXmlNode current2 in bxmlnode.Children) { node.Add(FromBXMLNode(doc, current2)); } if (bxmlnode.Value != null) { node.Value = bxmlnode.Value; } return node; }