Ejemplo n.º 1
0
            public virtual string ToXml()
            {
                StringBuilder builder = new StringBuilder();

                if (!this.warnings.IsEmpty())
                {
                    foreach (string warning in this.warnings)
                    {
                        builder.Append(this.xmlWarningRenderer.CreateWarning(this.indent, warning));
                    }
                }
                if (!this.infos.IsEmpty())
                {
                    foreach (string warning in this.infos)
                    {
                        builder.Append(this.xmlWarningRenderer.CreateLog("INFO", this.indent, warning));
                    }
                }
                Indenter.IndentBuilder(builder, this.indent);
                builder.Append("<").Append(this.name);
                if (this.structuralBuilder.Length > 0)
                {
                    builder.Append(" ").Append(this.structuralBuilder.ToString().Trim());
                }
                if (StringUtils.IsNotBlank(this.childBuilder.ToString()))
                {
                    builder.Append(">").Append(SystemUtils.LINE_SEPARATOR).Append(this.childBuilder.ToString());
                    Indenter.IndentBuilder(builder, this.indent);
                    builder.Append("</").Append(this.name).Append(">");
                }
                else
                {
                    builder.Append("/>");
                }
                if (this.indent > 0)
                {
                    builder.Append(SystemUtils.LINE_SEPARATOR);
                }
                return(builder.ToString());
            }