Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        public bool IstDerNodeAnDieserStelleErlaubt(XmlNode node)
        {
            if (node.ParentNode is XmlDocument)
            {
                return(true);
            }
            XMLCursorPos cursorPos = new XMLCursorPos();

            cursorPos.CursorSetzen(node, XMLCursorPositionen.CursorAufNodeSelbstVorderesTag);
            DTDTestmuster testMuster = this.CreateTestMuster(DTD.GetElementNameFromNode(node), cursorPos);

            this.PruefeAlleTestmuster(new List <DTDTestmuster>()
            {
                testMuster
            }, cursorPos);
            return(testMuster.Erfolgreich);
        }
Ejemplo n.º 3
0
 private bool PruefeNodePos(XmlNode node)
 {
     if (node is XmlWhitespace)
     {
         return(true);
     }
     if (this._dtd.IstDTDElementBekannt(DTD.GetElementNameFromNode(node)))
     {
         try
         {
             if (this.NodeChecker.IstDerNodeAnDieserStelleErlaubt(node))
             {
                 return(true);
             }
             this._fehlermeldungen.AppendFormat(ResReader.Reader.GetString("TagHierNichtErlaubt"), (object)node.Name);
             XMLCursorPos zuTestendeCursorPos = new XMLCursorPos();
             zuTestendeCursorPos.CursorSetzen(node, XMLCursorPositionen.CursorAufNodeSelbstVorderesTag);
             string[] strArray = this.NodeChecker.AnDieserStelleErlaubteTags_(zuTestendeCursorPos, false, false);
             if ((uint)strArray.Length > 0U)
             {
                 this._fehlermeldungen.Append(ResReader.Reader.GetString("ErlaubteTags"));
                 foreach (object obj in strArray)
                 {
                     this._fehlermeldungen.AppendFormat("{0} ", obj);
                 }
             }
             else
             {
                 this._fehlermeldungen.Append(ResReader.Reader.GetString("AnDieserStelleKeineTagsErlaubt"));
             }
             return(false);
         }
         catch (DTD.XMLUnknownElementException ex)
         {
             this._fehlermeldungen.AppendFormat(ResReader.Reader.GetString("UnbekanntesElement"), (object)ex.ElementName);
             return(false);
         }
     }
     else
     {
         this._fehlermeldungen.AppendFormat(ResReader.Reader.GetString("UnbekanntesElement"), (object)DTD.GetElementNameFromNode(node));
         return(false);
     }
 }
Ejemplo n.º 4
0
        public bool IstDerNodeAnDieserStelleErlaubt(XmlNode node)
        {
            if (node.ParentNode is XmlDocument)
            {
                return(true);
            }
            XMLCursorPos xMLCursorPos = new XMLCursorPos();

            xMLCursorPos.CursorSetzen(node, XMLCursorPositionen.CursorAufNodeSelbstVorderesTag);
            string               elementNameFromNode = DTD.GetElementNameFromNode(node);
            DTDTestmuster        dTDTestmuster       = this.CreateTestMuster(elementNameFromNode, xMLCursorPos);
            List <DTDTestmuster> list = new List <DTDTestmuster>();

            list.Add(dTDTestmuster);
            this.PruefeAlleTestmuster(list, xMLCursorPos);
            if (dTDTestmuster.Erfolgreich)
            {
                return(true);
            }
            return(false);
        }