src/Misc/EFTools/XmlCore/Base/Util/Utils.cs
/// <summary>
///     this method will format a block of XML based on the specified initial indent level.    It assumes that there is no
///     existing whitespace between elements.
/// </summary>
this method will format a block of XML based on the specified initial indent level.    It assumes that there is no
existing whitespace between elements.
this method will format a block of XML based on the specified initial indent level . It assumes that there is no existing whitespace between elements .
internal static void FormatXML(XElement xe, int currentIndentLevel)
        {
            XElement last = null;
            foreach (var c in xe.Elements())
            {
                var nl = new XText(Environment.NewLine + new string(' ', (currentIndentLevel + 1) * 2));
                c.AddBeforeSelf(nl);
                FormatXML(c, currentIndentLevel + 1);
                last = c;
            }
            if (last != null)
            {
                var nl = new XText(Environment.NewLine + new string(' ', currentIndentLevel * 2));
                last.AddAfterSelf(nl);
            }
        }
internal static void FormatXML ( XElement xe , int currentIndentLevel ) { XElement last = null ; foreach ( var c in xe . Elements ( ) ) { var nl = new XText ( Environment . NewLine + new string ( ' ' , ( currentIndentLevel + 1 ) * 2 ) ) ; c . AddBeforeSelf ( nl ) ; FormatXML ( c , currentIndentLevel + 1 ) ; last = c ; } if ( last != null ) { var nl = new XText ( Environment . NewLine + new string ( ' ' , currentIndentLevel * 2 ) ) ; last . AddAfterSelf ( nl ) ; } }
this method will format a block of XML based on the specified initial indent level.
this method will format a block of XML based on the specified initial indent level .
// add whitespace before this child - this will place each child's start tag on a new line with proper indenting // recurse on the child // add whitespace after the last child.  This places the closing tag of xe on a new line with proper indenting. 
xe
XElement
currentIndentLevel
int