Catrobat.IDE.Core.Xml.XmlObjects.Formulas.XmlFormulaTree.CreateXML C# (CSharp) Method

CreateXML() private method

private CreateXML ( string childName ) : System.Xml.Linq.XElement
childName string
return System.Xml.Linq.XElement
        internal XElement CreateXML(string childName)
        {
            var xRoot = new XElement(childName);

            if (LeftChild != null)
                xRoot.Add(LeftChild.CreateXML(XmlConstants.LeftChild));
            if (RightChild != null)
                xRoot.Add(RightChild.CreateXML(XmlConstants.RightChild));
            if (VariableType != null)
                xRoot.Add(new XElement(XmlConstants.Type, VariableType));
            if (VariableValue != null)
                xRoot.Add(new XElement(XmlConstants.Value, VariableValue));

            return xRoot;
        }
    }