예제 #1
0
        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);
        }
예제 #2
0
 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);
 }