private bool AktionRootNodeDurchClipboardInhaltErsetzen(UndoSnapshotSetzenOptionen undoSnapshotSetzen) { if (!this.AktionenMoeglich) { return(false); } string text = ""; try { text = Clipboard.GetText(TextDataFormat.Text); XmlTextReader xmlTextReader = new XmlTextReader(text, XmlNodeType.Element, null); xmlTextReader.MoveToContent(); XmlNode xmlNode = this._rootNode.OwnerDocument.ReadNode(xmlTextReader); if (xmlNode.Name != this._rootNode.Name) { return(false); } if (undoSnapshotSetzen == UndoSnapshotSetzenOptionen.ja) { this._undoHandler.SnapshotSetzen(ResReader.Reader.GetString("RootNodedurchZwischenablageersetzen"), this._cursor); } this._rootNode.RemoveAll(); while (xmlNode.Attributes.Count > 0) { XmlAttribute node = xmlNode.Attributes.Remove(xmlNode.Attributes[0]); this._rootNode.Attributes.Append(node); } XMLCursorPos xMLCursorPos = new XMLCursorPos(); xMLCursorPos.CursorSetzen(this._rootNode, XMLCursorPositionen.CursorInDemLeeremNode); XMLCursorPos xMLCursorPos2 = xMLCursorPos.Clone(); while (xmlNode.ChildNodes.Count > 0) { XmlNode newChild = xmlNode.RemoveChild(xmlNode.FirstChild); this._rootNode.AppendChild(newChild); } this.ContentChanged(); this._cursor.BeideCursorPosSetzen(this._rootNode, XMLCursorPositionen.CursorAufNodeSelbstVorderesTag); this._cursor.ErzwingeChanged(); return(true); } catch (Exception ex) { Debugger.GlobalDebugger.Protokolliere(string.Format("AktionRootNodeDurchClipboardInhaltErsetzen:Fehler für Einfügetext '{0}':{1}", text, ex.Message), Debugger.ProtokollTypen.Fehlermeldung); return(false); } }
public string[] AnDieserStelleErlaubteTags_( XMLCursorPos zuTestendeCursorPos, bool pcDATAMitAuflisten, bool kommentareMitAufListen) { List <DTDTestmuster> alleTestmuster = this.GetAlleTestmuster(zuTestendeCursorPos.Clone()); List <string> stringList = new List <string>(); foreach (DTDTestmuster dtdTestmuster in alleTestmuster) { if (dtdTestmuster.Erfolgreich) { if (dtdTestmuster.ElementName == null) { stringList.Add(""); } else { string lower = dtdTestmuster.ElementName.ToLower(); if (!(lower == "#pcdata")) { if (lower == "#comment") { if (kommentareMitAufListen) { stringList.Add(dtdTestmuster.ElementName); } } else { stringList.Add(dtdTestmuster.ElementName); } } else if (pcDATAMitAuflisten) { stringList.Add(dtdTestmuster.ElementName); } } } } return(stringList.ToArray()); }