Beispiel #1
0
 private void FormatTextBuffer(TextBuffer textBuffer, XmlNode linkTextNode)
 {
     XmlNodeList childNodes = linkTextNode.ChildNodes;
        foreach(XmlNode childNode in childNodes)
        {
     if (childNode.Name.Equals("a"))
     {
      XmlAttribute href = childNode.Attributes["href"];
      if (href != null)
      {
       string textTagName = href.Value;
       TextTag textTag = textBuffer.TagTable.Lookup(textTagName);
       if (textTag != null)
       {
        TextMark startTagMark = textBuffer.CreateMark(textTagName, textBuffer.EndIter, true);
        textBuffer.InsertAtCursor(childNode.InnerText);
        TextIter startTagIter = textBuffer.GetIterAtMark(startTagMark);
        TextIter endTagIter = textBuffer.EndIter;
        textBuffer.ApplyTag(textTag, startTagIter, endTagIter);
       }
      }
      else
       textBuffer.InsertAtCursor(childNode.InnerText);
     }
     else
     {
      textBuffer.InsertAtCursor(childNode.InnerText);
     }
        }
        textBuffer.ApplyTag("small-font", textBuffer.StartIter, textBuffer.EndIter);
 }