public override bool VisitEnter(TiXmlElement element, TiXmlAttribute firstAttribute) { DoIndent(); buffer.Append("<"); buffer.Append(element.Value()); for (TiXmlAttribute attrib = firstAttribute; attrib != null; attrib = attrib.Next()) { buffer.Append(" "); attrib.Print(buffer, 0); } if (element.FirstChild() == null) { buffer.Append(" />"); DoLineBreak(); } else { buffer.Append(">"); if (element.FirstChild().ToText() != null && element.LastChild() == element.FirstChild() && element.FirstChild().ToText().CDATA() == false) { simpleTextPrint = true; // no DoLineBreak()! } else { DoLineBreak(); } } ++depth; return(true); }
public override bool VisitExit(TiXmlElement element) { --depth; if (element.FirstChild() == null) { // nothing. } else { if (simpleTextPrint) { simpleTextPrint = false; } else { DoIndent(); } buffer.Append("</"); buffer.Append(element.Value()); buffer.Append(">"); DoLineBreak(); } return(true); }