コード例 #1
0
        /// <summary>
        /// Generates output data in html form when the node has not changed
        /// </summary>
        /// <param name="writer">output data stream</param>
        /// <param name="indent">size of indentation</param>
        internal void DrawHtmlNoChange(XmlWriter writer, int indent)
        {
            Debug.Assert(this.NodeType != XmlNodeType.Element && this.NodeType != XmlNodeType.Attribute);
            Debug.Assert(this.Operation != XmlDiffViewOperation.Change);
            XmlDiffView.HtmlStartRow(writer);
            this.DrawLinkNode(writer);

            for (int i = 0; i < 2; i++)
            {
                XmlDiffView.HtmlStartCell(writer, indent);
                if (XmlDiffView.HtmlWriteToPane[(int)this.Operation, i])
                {
                    bool closeElement = this.OutputNavigationHtml(writer);
                    XmlDiffView.HtmlWriteString(
                        writer,
                        this.Operation,
                        this.OuterXml);
                    if (closeElement)
                    {
                        writer.WriteEndElement();
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                XmlDiffView.HtmlEndCell(writer);
            }
            XmlDiffView.HtmlEndRow(writer);
        }
コード例 #2
0
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            if (_op == XmlDiffViewOperation.Change)
            {
                Debug.Assert(_name != _changeInfo._localName);

                XmlDiffView.HtmlStartRow(writer);
                XmlDiffView.HtmlStartCell(writer, indent);

                XmlDiffView.HtmlWriteString(writer, "&");
                XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, _name);
                XmlDiffView.HtmlWriteString(writer, ";");

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlStartCell(writer, indent);

                XmlDiffView.HtmlWriteString(writer, "&");
                XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, _changeInfo._localName);
                XmlDiffView.HtmlWriteString(writer, ";");

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlEndRow(writer);
            }
            else
            {
                DrawHtmlNoChange(writer, indent);
            }
        }
コード例 #3
0
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            if (_op == XmlDiffViewOperation.Change)
            {
                XmlDiffViewOperation nameOp  = (_name == _changeInfo._localName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change;
                XmlDiffViewOperation valueOp = (_value == _changeInfo._value) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change;

                XmlDiffView.HtmlStartRow(writer);
                XmlDiffView.HtmlStartCell(writer, indent);

                XmlDiffView.HtmlWriteString(writer, "<?");
                XmlDiffView.HtmlWriteString(writer, nameOp, _name);
                XmlDiffView.HtmlWriteString(writer, " ");
                XmlDiffView.HtmlWriteString(writer, valueOp, _value);
                XmlDiffView.HtmlWriteString(writer, "?>");

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlStartCell(writer, indent);

                XmlDiffView.HtmlWriteString(writer, "<?");
                XmlDiffView.HtmlWriteString(writer, nameOp, _changeInfo._localName);
                XmlDiffView.HtmlWriteString(writer, " ");
                XmlDiffView.HtmlWriteString(writer, valueOp, _changeInfo._value);
                XmlDiffView.HtmlWriteString(writer, "?>");

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlEndRow(writer);
            }
            else
            {
                DrawHtmlNoChange(writer, indent);
            }
        }
コード例 #4
0
        /// <summary>
        /// Generates output data in html form.
        /// </summary>
        /// <param name="writer">output data stream</param>
        /// <param name="indent">size of indentation</param>
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            if (Operation == XmlDiffViewOperation.Change)
            {
                Debug.Assert(this.nameStore != ChangeInformation.LocalName);

                XmlDiffView.HtmlStartRow(writer);
                this.DrawLineNumber(writer);
                XmlDiffView.HtmlStartCell(writer, indent);

                XmlDiffView.HtmlWriteString(writer, "&");
                XmlDiffView.HtmlWriteString(
                    writer,
                    XmlDiffViewOperation.Change,
                    this.nameStore);
                XmlDiffView.HtmlWriteString(writer, ";");

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlStartCell(writer, indent);

                XmlDiffView.HtmlWriteString(writer, "&");
                XmlDiffView.HtmlWriteString(
                    writer,
                    XmlDiffViewOperation.Change,
                    ChangeInformation.LocalName);
                XmlDiffView.HtmlWriteString(writer, ";");

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlEndRow(writer);
            }
            else
            {
                DrawHtmlNoChange(writer, indent);
            }
        }
        /// <summary>
        /// Generates  output data in html form
        /// </summary>
        /// <param name="writer">output stream</param>
        /// <param name="indent">number of indentations</param>
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            if (Operation == XmlDiffViewOperation.Change)
            {
                XmlDiffView.HtmlStartRow(writer);
                this.DrawLineNumber(writer);
                XmlDiffView.HtmlStartCell(writer, indent);
                XmlDiffView.HtmlWriteString(writer, Tags.XmlDeclarationBegin);
                XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, this.declarationValue);
                XmlDiffView.HtmlWriteString(writer, Tags.XmlDeclarationEnd);

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlStartCell(writer, indent);

                XmlDiffView.HtmlWriteString(writer, Tags.XmlDeclarationBegin);
                XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, ChangeInformation.Subset);
                XmlDiffView.HtmlWriteString(writer, Tags.XmlDeclarationEnd);

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlEndRow(writer);
            }
            else
            {
                DrawHtmlNoChange(writer, indent);
            }
        }
コード例 #6
0
ファイル: XmlDiffViewPI.cs プロジェクト: ca0v/XmlDiffPatch
 internal override void DrawHtml(XmlWriter writer, int indent)
 {
     if (this._op == XmlDiffViewOperation.Change)
     {
         var op1 = this._name == this._changeInfo._localName ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change;
         var op2 = this._value == this._changeInfo._value ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change;
         XmlDiffView.HtmlStartRow(writer);
         XmlDiffView.HtmlStartCell(writer, indent);
         XmlDiffView.HtmlWriteString(writer, "<?");
         XmlDiffView.HtmlWriteString(writer, op1, this._name);
         XmlDiffView.HtmlWriteString(writer, " ");
         XmlDiffView.HtmlWriteString(writer, op2, this._value);
         XmlDiffView.HtmlWriteString(writer, "?>");
         XmlDiffView.HtmlEndCell(writer);
         XmlDiffView.HtmlStartCell(writer, indent);
         XmlDiffView.HtmlWriteString(writer, "<?");
         XmlDiffView.HtmlWriteString(writer, op1, this._changeInfo._localName);
         XmlDiffView.HtmlWriteString(writer, " ");
         XmlDiffView.HtmlWriteString(writer, op2, this._changeInfo._value);
         XmlDiffView.HtmlWriteString(writer, "?>");
         XmlDiffView.HtmlEndCell(writer);
         XmlDiffView.HtmlEndRow(writer);
     }
     else
     {
         this.DrawHtmlNoChange(writer, indent);
     }
 }
コード例 #7
0
 internal void DrawHtmlNoChange(XmlWriter writer, int indent)
 {
     Debug.Assert(_nodeType != XmlNodeType.Element && _nodeType != XmlNodeType.Attribute);
     Debug.Assert(_op != XmlDiffViewOperation.Change);
     XmlDiffView.HtmlStartRow(writer);
     for (int i = 0; i < 2; i++)
     {
         XmlDiffView.HtmlStartCell(writer, indent);
         if (XmlDiffView.HtmlWriteToPane[(int)_op, i])
         {
             bool bCloseElement = OutputNavigation(writer);
             XmlDiffView.HtmlWriteString(writer, _op, OuterXml);
             if (bCloseElement)
             {
                 writer.WriteEndElement();
             }
         }
         else
         {
             XmlDiffView.HtmlWriteEmptyString(writer);
         }
         XmlDiffView.HtmlEndCell(writer);
     }
     XmlDiffView.HtmlEndRow(writer);
 }
コード例 #8
0
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            if (_op == XmlDiffViewOperation.Change)
            {
                string openString  = string.Empty;
                string closeString = string.Empty;
                if (_nodeType == XmlNodeType.CDATA)
                {
                    openString  = "<!CDATA[";
                    closeString = "]]>";
                }
                else if (_nodeType == XmlNodeType.Comment)
                {
                    openString  = "<!--";
                    closeString = "-->";
                }

                XmlDiffView.HtmlStartRow(writer);
                XmlDiffView.HtmlStartCell(writer, indent);
                if (openString != string.Empty)
                {
                    XmlDiffView.HtmlWriteString(writer, openString);
                    XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, _value);
                    XmlDiffView.HtmlWriteString(writer, closeString);
                }
                else
                {
                    XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, _value);
                }

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlStartCell(writer, indent);

                if (openString != string.Empty)
                {
                    XmlDiffView.HtmlWriteString(writer, openString);
                    XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, _changeInfo._value);
                    XmlDiffView.HtmlWriteString(writer, closeString);
                }
                else
                {
                    XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, _changeInfo._value);
                }

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlEndRow(writer);
            }
            else
            {
                DrawHtmlNoChange(writer, indent);
            }
        }
コード例 #9
0
 internal override void DrawHtml(XmlWriter writer, int indent)
 {
     if (this._op == XmlDiffViewOperation.Change)
     {
         var str1 = string.Empty;
         var str2 = string.Empty;
         if (this._nodeType == XmlNodeType.CDATA)
         {
             str1 = "<!CDATA[";
             str2 = "]]>";
         }
         else if (this._nodeType == XmlNodeType.Comment)
         {
             str1 = "<!--";
             str2 = "-->";
         }
         XmlDiffView.HtmlStartRow(writer);
         XmlDiffView.HtmlStartCell(writer, indent);
         if (str1 != string.Empty)
         {
             XmlDiffView.HtmlWriteString(writer, str1);
             XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, this._value);
             XmlDiffView.HtmlWriteString(writer, str2);
         }
         else
         {
             XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, this._value);
         }
         XmlDiffView.HtmlEndCell(writer);
         XmlDiffView.HtmlStartCell(writer, indent);
         if (str1 != string.Empty)
         {
             XmlDiffView.HtmlWriteString(writer, str1);
             XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, this._changeInfo._value);
             XmlDiffView.HtmlWriteString(writer, str2);
         }
         else
         {
             XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, this._changeInfo._value);
         }
         XmlDiffView.HtmlEndCell(writer);
         XmlDiffView.HtmlEndRow(writer);
     }
     else
     {
         this.DrawHtmlNoChange(writer, indent);
     }
 }
コード例 #10
0
        /// <summary>
        /// Generates output data in html form.
        /// </summary>
        /// <param name="writer">output data stream</param>
        /// <param name="indent">size of indentation</param>
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            if (Operation == XmlDiffViewOperation.Change)
            {
                XmlDiffViewOperation nameOp  = (this.Name == ChangeInformation.LocalName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change;
                XmlDiffViewOperation valueOp = (this.InnerText == ChangeInformation.Subset) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change;

                XmlDiffView.HtmlStartRow(writer);
                this.DrawLineNumber(writer);

                XmlDiffView.HtmlStartCell(writer, indent);

                XmlDiffView.HtmlWriteString(writer, Tags.XmlErrorHandlingBegin);
                XmlDiffView.HtmlWriteString(writer, nameOp, this.Name);
                XmlDiffView.HtmlWriteString(writer, " ");
                XmlDiffView.HtmlWriteString(
                    writer,
                    valueOp,
                    RemoveTabsAndNewlines(InnerText));
                XmlDiffView.HtmlWriteString(writer, Tags.XmlErrorHandlingEnd);

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlStartCell(writer, indent);

                XmlDiffView.HtmlWriteString(writer, Tags.XmlErrorHandlingBegin);
                XmlDiffView.HtmlWriteString(
                    writer,
                    nameOp,
                    ChangeInformation.LocalName);
                XmlDiffView.HtmlWriteString(writer, " ");
                XmlDiffView.HtmlWriteString(
                    writer,
                    valueOp,
                    RemoveTabsAndNewlines(ChangeInformation.Subset));
                XmlDiffView.HtmlWriteString(writer, Tags.XmlErrorHandlingEnd);

                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlEndRow(writer);
            }
            else
            {
                DrawHtmlNoChange(writer, indent);
            }
        }
コード例 #11
0
ファイル: XmlDiffViewNode.cs プロジェクト: ca0v/XmlDiffPatch
 internal void DrawHtmlNoChange(XmlWriter writer, int indent)
 {
     XmlDiffView.HtmlStartRow(writer);
     for (var index = 0; index < 2; ++index)
     {
         XmlDiffView.HtmlStartCell(writer, indent);
         if (XmlDiffView.HtmlWriteToPane[(int)this._op, index])
         {
             var flag = this.OutputNavigation(writer);
             XmlDiffView.HtmlWriteString(writer, this._op, this.OuterXml);
             if (flag)
             {
                 writer.WriteEndElement();
             }
         }
         else
         {
             XmlDiffView.HtmlWriteEmptyString(writer);
         }
         XmlDiffView.HtmlEndCell(writer);
     }
     XmlDiffView.HtmlEndRow(writer);
 }
コード例 #12
0
 internal override void DrawHtml(XmlWriter writer, int indent)
 {
     if (this._op == XmlDiffViewOperation.Change)
     {
         Debug.Assert(this._value != this._changeInfo._value);
         XmlDiffView.HtmlStartRow(writer);
         XmlDiffView.HtmlStartCell(writer, indent);
         XmlDiffView.HtmlWriteString(writer, "<?xml ");
         XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, this._value);
         XmlDiffView.HtmlWriteString(writer, "?>");
         XmlDiffView.HtmlEndCell(writer);
         XmlDiffView.HtmlStartCell(writer, indent);
         XmlDiffView.HtmlWriteString(writer, "<?xml ");
         XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, this._changeInfo._value);
         XmlDiffView.HtmlWriteString(writer, "?>");
         XmlDiffView.HtmlEndCell(writer);
         XmlDiffView.HtmlEndRow(writer);
     }
     else
     {
         this.DrawHtmlNoChange(writer, indent);
     }
 }
コード例 #13
0
        /// <summary>
        /// Generates  output data in html form
        /// </summary>
        /// <param name="writer">output stream</param>
        /// <param name="indent">number of indentations</param>
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            if (Operation == XmlDiffViewOperation.Change)
            {
                XmlDiffView.HtmlStartRow(writer);
                this.DrawLinkNode(writer);

                for (int i = 0; i < 2; i++)
                {
                    XmlDiffView.HtmlStartCell(writer, indent);
                    // name
                    XmlDiffView.HtmlWriteString(
                        writer,
                        XmlDiffViewOperation.Match,
                        Tags.XmlDocumentTypeBegin);
                    if (i == 0)
                    {
                        XmlDiffView.HtmlWriteString(
                            writer,
                            (this.Name == ChangeInformation.LocalName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change,
                            this.Name);
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteString(
                            writer,
                            (this.Name == ChangeInformation.LocalName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change,
                            ChangeInformation.LocalName);
                    }
                    XmlDiffView.HtmlWriteString(
                        writer,
                        XmlDiffViewOperation.Match,
                        " ");

                    string systemString = "SYSTEM ";
                    // public id
                    if (this.PublicId == ChangeInformation.Prefix)
                    {
                        // match
                        if (this.PublicId != string.Empty)
                        {
                            XmlDiffView.HtmlWriteString(
                                writer,
                                XmlDiffViewOperation.Match,
                                Tags.DtdPublic + "\"" + this.PublicId + "\" ");
                            systemString = string.Empty;
                        }
                    }
                    else
                    {
                        // add
                        if (this.PublicId == string.Empty)
                        {
                            if (i == 1)
                            {
                                XmlDiffView.HtmlWriteString(
                                    writer,
                                    XmlDiffViewOperation.Add,
                                    Tags.DtdPublic + "\"" + ChangeInformation.Prefix + "\" ");
                                systemString = string.Empty;
                            }
                        }
                        // remove
                        else if (ChangeInformation.Prefix == string.Empty)
                        {
                            if (i == 0)
                            {
                                XmlDiffView.HtmlWriteString(
                                    writer,
                                    XmlDiffViewOperation.Remove,
                                    Tags.DtdPublic + "\"" + this.PublicId + "\" ");
                                systemString = string.Empty;
                            }
                        }
                        // change
                        else
                        {
                            XmlDiffView.HtmlWriteString(
                                writer,
                                XmlDiffViewOperation.Change,
                                Tags.DtdPublic + "\"" + ((i == 0) ? this.PublicId : ChangeInformation.Prefix) + "\"");
                            systemString = string.Empty;
                        }
                    }

                    // system id
                    if (this.SystemId == ChangeInformation.NamespaceUri)
                    {
                        if (this.SystemId != string.Empty)
                        {
                            XmlDiffView.HtmlWriteString(
                                writer,
                                XmlDiffViewOperation.Match,
                                systemString + "\"" + this.SystemId + "\" ");
                        }
                    }
                    else
                    {
                        // add
                        if (this.SystemId == string.Empty)
                        {
                            if (i == 1)
                            {
                                XmlDiffView.HtmlWriteString(
                                    writer,
                                    XmlDiffViewOperation.Add,
                                    systemString + "\"" + ChangeInformation.NamespaceUri + "\" ");
                            }
                        }
                        // remove
                        else if (ChangeInformation.Prefix == string.Empty)
                        {
                            if (i == 0)
                            {
                                XmlDiffView.HtmlWriteString(
                                    writer,
                                    XmlDiffViewOperation.Remove,
                                    systemString + "\"" + this.SystemId + "\"");
                            }
                        }
                        // change
                        else
                        {
                            XmlDiffView.HtmlWriteString(
                                writer,
                                XmlDiffViewOperation.Change,
                                systemString + "\"" + ((i == 0) ? this.SystemId : ChangeInformation.NamespaceUri) + "\" ");
                        }
                    }

                    // internal subset
                    if (this.Subset == ChangeInformation.Subset)
                    {
                        if (this.Subset != string.Empty)
                        {
                            XmlDiffView.HtmlWriteString(
                                writer,
                                XmlDiffViewOperation.Match,
                                "[" + this.Subset + "]");
                        }
                    }
                    else
                    {
                        // add
                        if (this.Subset == string.Empty)
                        {
                            if (i == 1)
                            {
                                XmlDiffView.HtmlWriteString(
                                    writer,
                                    XmlDiffViewOperation.Add,
                                    "[" + ChangeInformation.Subset + "]");
                            }
                        }
                        // remove
                        else if (ChangeInformation.Subset == string.Empty)
                        {
                            if (i == 0)
                            {
                                XmlDiffView.HtmlWriteString(
                                    writer,
                                    XmlDiffViewOperation.Remove,
                                    "[" + this.Subset + "]");
                            }
                        }
                        // change
                        else
                        {
                            XmlDiffView.HtmlWriteString(
                                writer,
                                XmlDiffViewOperation.Change,
                                "[" + ((i == 0) ? this.Subset : ChangeInformation.Subset) + "]");
                        }
                    }

                    // close start tag
                    XmlDiffView.HtmlWriteString(
                        writer,
                        XmlDiffViewOperation.Match,
                        Tags.XmlDocumentTypeEnd);
                    XmlDiffView.HtmlEndCell(writer);
                }
                XmlDiffView.HtmlEndRow(writer);
            }
            else
            {
                DrawHtmlNoChange(writer, indent);
            }
        }
コード例 #14
0
        /// <summary>
        /// Generates  output data in html form
        /// </summary>
        /// <param name="writer">output stream</param>
        /// <param name="indent">number of indentations</param>
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            XmlDiffViewOperation typeOfDifference = Operation;
            bool closeElement = false;

            XmlDiffView.HtmlStartRow(writer);
            this.DrawLinkNode(writer);

            for (int i = 0; i < 2; i++)
            {
                XmlDiffView.HtmlStartCell(writer, indent);
                if (XmlDiffView.HtmlWriteToPane[(int)Operation, i])
                {
                    closeElement = OutputNavigationHtml(writer);

                    if (Operation == XmlDiffViewOperation.Change)
                    {
                        typeOfDifference = XmlDiffViewOperation.Match;
                        XmlDiffView.HtmlWriteString(
                            writer,
                            typeOfDifference,
                            Tags.XmlOpenBegin);
                        if (i == 0)
                        {
                            this.DrawHtmlNameChange(
                                writer,
                                this.LocalName,
                                this.Prefix);
                        }
                        else
                        {
                            this.DrawHtmlNameChange(
                                writer,
                                ChangeInformation.LocalName,
                                ChangeInformation.Prefix);
                        }
                    }
                    else
                    {
                        this.DrawHtmlName(
                            writer,
                            typeOfDifference,
                            Tags.XmlOpenBegin,
                            string.Empty);
                    }

                    if (closeElement)
                    {
                        // write the closing '</A>' tag.
                        writer.WriteEndElement();
                        closeElement = false;
                    }

                    // attributes
                    this.DrawHtmlAttributes(writer, i);

                    // close start tag
                    if (ChildNodes != null)
                    {
                        XmlDiffView.HtmlWriteString(
                            writer,
                            typeOfDifference,
                            Tags.XmlOpenEnd);
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteString(
                            writer,
                            typeOfDifference,
                            Tags.XmlOpenEndTerse);
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                XmlDiffView.HtmlEndCell(writer);
            }
            XmlDiffView.HtmlEndRow(writer);

            // child nodes
            if (ChildNodes != null)
            {
                HtmlDrawChildNodes(writer, indent + XmlDiffView.DeltaIndent);

                // end element
                XmlDiffView.HtmlStartRow(writer);
                this.DrawLinkNode(writer);

                for (int i = 0; i < 2; i++)
                {
                    XmlDiffView.HtmlStartCell(writer, indent);
                    if (XmlDiffView.HtmlWriteToPane[(int)Operation, i])
                    {
                        if (Operation == XmlDiffViewOperation.Change)
                        {
                            Debug.Assert(typeOfDifference ==
                                         XmlDiffViewOperation.Match);
                            XmlDiffView.HtmlWriteString(
                                writer,
                                typeOfDifference,
                                Tags.XmlCloseBegin);
                            if (i == 0)
                            {
                                this.DrawHtmlNameChange(
                                    writer,
                                    this.LocalName,
                                    this.Prefix);
                            }
                            else
                            {
                                this.DrawHtmlNameChange(
                                    writer,
                                    ChangeInformation.LocalName,
                                    ChangeInformation.Prefix);
                            }
                            XmlDiffView.HtmlWriteString(
                                writer,
                                typeOfDifference,
                                Tags.XmlOpenEnd);
                        }
                        else
                        {
                            this.DrawHtmlName(
                                writer,
                                typeOfDifference,
                                Tags.XmlCloseBegin,
                                Tags.XmlCloseEnd);
                        }
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteEmptyString(writer);
                    }
                    XmlDiffView.HtmlEndCell(writer);
                }
                XmlDiffView.HtmlEndRow(writer);
            }
        }
コード例 #15
0
        /// <summary>
        /// Generates  output data in html form
        /// </summary>
        /// <param name="writer">output stream</param>
        /// <param name="indent">number of indentations</param>
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            if (Operation == XmlDiffViewOperation.Change)
            {
                string openString  = string.Empty;
                string closeString = string.Empty;
                //Note: OuterXml function is not used here
                //      in order that the tags
                //      can correctly wrap the data.
                if (NodeType == XmlNodeType.CDATA)
                {
                    openString  = Tags.XmlCharacterDataBegin;
                    closeString = Tags.XmlCharacterDataEnd;
                }
                else if (NodeType == XmlNodeType.Comment)
                {
                    openString  = Tags.XmlCommentOldStyleBegin;
                    closeString = Tags.XmlCommentOldStyleEnd;
                }

                XmlDiffView.HtmlStartRow(writer);
                this.DrawLinkNode(writer);
                XmlDiffView.HtmlStartCell(writer, indent);
                if (openString != string.Empty)
                {
                    XmlDiffView.HtmlWriteString(writer, openString);
                    XmlDiffView.HtmlWriteString(
                        writer,
                        XmlDiffViewOperation.Change,
                        this.InnerText);
                    XmlDiffView.HtmlWriteString(writer, closeString);
                }
                else
                {
                    XmlDiffView.HtmlWriteString(
                        writer,
                        XmlDiffViewOperation.Change,
                        this.InnerText);
                }
                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlStartCell(writer, indent);

                if (openString != string.Empty)
                {
                    XmlDiffView.HtmlWriteString(writer, openString);
                    XmlDiffView.HtmlWriteString(
                        writer,
                        XmlDiffViewOperation.Change,
                        ChangeInformation.Subset);
                    XmlDiffView.HtmlWriteString(writer, closeString);
                }
                else
                {
                    XmlDiffView.HtmlWriteString(
                        writer,
                        XmlDiffViewOperation.Change,
                        ChangeInformation.Subset);
                }
                XmlDiffView.HtmlEndCell(writer);
                XmlDiffView.HtmlEndRow(writer);
            }
            else
            {
                DrawHtmlNoChange(writer, indent);
            }
        }
コード例 #16
0
 internal override void DrawHtml(XmlWriter writer, int indent)
 {
     if (this._op == XmlDiffViewOperation.Change)
     {
         XmlDiffView.HtmlStartRow(writer);
         for (var index = 0; index < 2; ++index)
         {
             XmlDiffView.HtmlStartCell(writer, indent);
             XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, "<!DOCTYPE ");
             if (index == 0)
             {
                 XmlDiffView.HtmlWriteString(writer, this._name == this._changeInfo._localName ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change, this._name);
             }
             else
             {
                 XmlDiffView.HtmlWriteString(writer, this._name == this._changeInfo._localName ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change, this._changeInfo._localName);
             }
             XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, " ");
             var str = "SYSTEM ";
             if (this._publicId == this._changeInfo._prefix)
             {
                 if (this._publicId != string.Empty)
                 {
                     XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, "PUBLIC \"" + this._publicId + "\" ");
                     str = string.Empty;
                 }
             }
             else if (this._publicId == string.Empty)
             {
                 if (index == 1)
                 {
                     XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Add, "PUBLIC \"" + this._changeInfo._prefix + "\" ");
                     str = string.Empty;
                 }
             }
             else if (this._changeInfo._prefix == string.Empty)
             {
                 if (index == 0)
                 {
                     XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Remove, "PUBLIC \"" + this._publicId + "\" ");
                     str = string.Empty;
                 }
             }
             else
             {
                 XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, "PUBLIC \"" + (index == 0 ? this._publicId : this._changeInfo._prefix) + "\" ");
                 str = string.Empty;
             }
             if (this._systemId == this._changeInfo._ns)
             {
                 if (this._systemId != string.Empty)
                 {
                     XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, str + "\"" + this._systemId + "\" ");
                 }
             }
             else if (this._systemId == string.Empty)
             {
                 if (index == 1)
                 {
                     XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Add, str + "\"" + this._changeInfo._ns + "\" ");
                 }
             }
             else if (this._changeInfo._prefix == string.Empty)
             {
                 if (index == 0)
                 {
                     XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Remove, str + "\"" + this._systemId + "\" ");
                 }
             }
             else
             {
                 XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, str + "\"" + (index == 0 ? this._systemId : this._changeInfo._ns) + "\" ");
             }
             if (this._subset == this._changeInfo._value)
             {
                 if (this._subset != string.Empty)
                 {
                     XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, "[" + this._subset + "]");
                 }
             }
             else if (this._subset == string.Empty)
             {
                 if (index == 1)
                 {
                     XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Add, "[" + this._changeInfo._value + "]");
                 }
             }
             else if (this._changeInfo._value == string.Empty)
             {
                 if (index == 0)
                 {
                     XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Remove, "[" + this._subset + "]");
                 }
             }
             else
             {
                 XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, "[" + (index == 0 ? this._subset : this._changeInfo._value) + "]");
             }
             XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, ">");
             XmlDiffView.HtmlEndCell(writer);
         }
         XmlDiffView.HtmlEndRow(writer);
     }
     else
     {
         this.DrawHtmlNoChange(writer, indent);
     }
 }
コード例 #17
0
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            if (_op == XmlDiffViewOperation.Change)
            {
                XmlDiffView.HtmlStartRow(writer);
                for (int i = 0; i < 2; i++)
                {
                    XmlDiffView.HtmlStartCell(writer, indent);
                    // name
                    XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, "<!DOCTYPE ");
                    if (i == 0)
                    {
                        XmlDiffView.HtmlWriteString(writer, (_name == _changeInfo._localName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change, _name);
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteString(writer, (_name == _changeInfo._localName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change, _changeInfo._localName);
                    }

                    XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, " ");

                    string systemString = "SYSTEM ";
                    // public id
                    if (_publicId == _changeInfo._prefix)
                    {
                        // match
                        if (_publicId != string.Empty)
                        {
                            XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, "PUBLIC \"" + _publicId + "\" ");
                            systemString = string.Empty;
                        }
                    }
                    else
                    {
                        // add
                        if (_publicId == string.Empty)
                        {
                            if (i == 1)
                            {
                                XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Add, "PUBLIC \"" + _changeInfo._prefix + "\" ");
                                systemString = string.Empty;
                            }
                        }
                        // remove
                        else if (_changeInfo._prefix == string.Empty)
                        {
                            if (i == 0)
                            {
                                XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Remove, "PUBLIC \"" + _publicId + "\" ");
                                systemString = string.Empty;
                            }
                        }
                        // change
                        else
                        {
                            XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, "PUBLIC \"" + ((i == 0) ? _publicId : _changeInfo._prefix) + "\" ");
                            systemString = string.Empty;
                        }
                    }

                    // system id
                    if (_systemId == _changeInfo._ns)
                    {
                        if (_systemId != string.Empty)
                        {
                            XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, systemString + "\"" + _systemId + "\" ");
                        }
                    }
                    else
                    {
                        // add
                        if (_systemId == string.Empty)
                        {
                            if (i == 1)
                            {
                                XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Add, systemString + "\"" + _changeInfo._ns + "\" ");
                            }
                        }
                        // remove
                        else if (_changeInfo._prefix == string.Empty)
                        {
                            if (i == 0)
                            {
                                XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Remove, systemString + "\"" + _systemId + "\" ");
                            }
                        }
                        // change
                        else
                        {
                            XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, systemString + "\"" + ((i == 0) ? _systemId : _changeInfo._ns) + "\" ");
                        }
                    }

                    // internal subset
                    if (_subset == _changeInfo._value)
                    {
                        if (_subset != string.Empty)
                        {
                            XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, "[" + _subset + "]");
                        }
                    }
                    else
                    {
                        // add
                        if (_subset == string.Empty)
                        {
                            if (i == 1)
                            {
                                XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Add, "[" + _changeInfo._value + "]");
                            }
                        }
                        // remove
                        else if (_changeInfo._value == string.Empty)
                        {
                            if (i == 0)
                            {
                                XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Remove, "[" + _subset + "]");
                            }
                        }
                        // change
                        else
                        {
                            XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, "[" + ((i == 0) ? _subset : _changeInfo._value) + "]");
                        }
                    }

                    // close start tag
                    XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Match, ">");
                    XmlDiffView.HtmlEndCell(writer);
                }
                XmlDiffView.HtmlEndRow(writer);
            }
            else
            {
                DrawHtmlNoChange(writer, indent);
            }
        }
コード例 #18
0
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            var diffViewOperation = this._op;
            var flag1             = false;

            XmlDiffView.HtmlStartRow(writer);
            for (var paneNo = 0; paneNo < 2; ++paneNo)
            {
                XmlDiffView.HtmlStartCell(writer, indent);
                if (XmlDiffView.HtmlWriteToPane[(int)this._op, paneNo])
                {
                    var flag2 = this.OutputNavigation(writer);
                    if (this._op == XmlDiffViewOperation.Change)
                    {
                        diffViewOperation = XmlDiffViewOperation.Match;
                        XmlDiffView.HtmlWriteString(writer, diffViewOperation, "<");
                        if (paneNo == 0)
                        {
                            this.DrawHtmlNameChange(writer, this._localName, this._prefix);
                        }
                        else
                        {
                            this.DrawHtmlNameChange(writer, this._changeInfo._localName, this._changeInfo._prefix);
                        }
                    }
                    else
                    {
                        this.DrawHtmlName(writer, diffViewOperation, "<", string.Empty);
                    }
                    if (flag2)
                    {
                        writer.WriteEndElement();
                        flag1 = false;
                    }
                    this.DrawHtmlAttributes(writer, paneNo);
                    if (this._childNodes != null)
                    {
                        XmlDiffView.HtmlWriteString(writer, diffViewOperation, ">");
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteString(writer, diffViewOperation, "/>");
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                XmlDiffView.HtmlEndCell(writer);
            }
            XmlDiffView.HtmlEndRow(writer);
            if (this._childNodes == null)
            {
                return;
            }
            this.HtmlDrawChildNodes(writer, indent + XmlDiffView.DeltaIndent);
            XmlDiffView.HtmlStartRow(writer);
            for (var index = 0; index < 2; ++index)
            {
                XmlDiffView.HtmlStartCell(writer, indent);
                if (XmlDiffView.HtmlWriteToPane[(int)this._op, index])
                {
                    if (this._op == XmlDiffViewOperation.Change)
                    {
                        Debug.Assert(diffViewOperation == XmlDiffViewOperation.Match);
                        XmlDiffView.HtmlWriteString(writer, diffViewOperation, "</");
                        if (index == 0)
                        {
                            this.DrawHtmlNameChange(writer, this._localName, this._prefix);
                        }
                        else
                        {
                            this.DrawHtmlNameChange(writer, this._changeInfo._localName, this._changeInfo._prefix);
                        }
                        XmlDiffView.HtmlWriteString(writer, diffViewOperation, ">");
                    }
                    else
                    {
                        this.DrawHtmlName(writer, diffViewOperation, "</", ">");
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                XmlDiffView.HtmlEndCell(writer);
            }
            XmlDiffView.HtmlEndRow(writer);
        }
コード例 #19
0
        internal override void DrawHtml(XmlWriter writer, int indent)
        {
            XmlDiffViewOperation opForColor = _op;
            bool bCloseElement = false;

            XmlDiffView.HtmlStartRow(writer);
            for (int i = 0; i < 2; i++)
            {
                XmlDiffView.HtmlStartCell(writer, indent);
                if (XmlDiffView.HtmlWriteToPane[(int)_op, i])
                {
                    bCloseElement = OutputNavigation(writer);

                    if (_op == XmlDiffViewOperation.Change)
                    {
                        opForColor = XmlDiffViewOperation.Match;
                        XmlDiffView.HtmlWriteString(writer, opForColor, "<");
                        if (i == 0)
                        {
                            DrawHtmlNameChange(writer, _localName, _prefix);
                        }
                        else
                        {
                            DrawHtmlNameChange(writer, _changeInfo._localName, _changeInfo._prefix);
                        }
                    }
                    else
                    {
                        DrawHtmlName(writer, opForColor, "<", string.Empty);
                    }

                    if (bCloseElement)
                    {
                        writer.WriteEndElement();
                        bCloseElement = false;
                    }

                    // attributes
                    DrawHtmlAttributes(writer, i);

                    // close start tag
                    if (_childNodes != null)
                    {
                        XmlDiffView.HtmlWriteString(writer, opForColor, ">");
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteString(writer, opForColor, "/>");
                    }
                }
                else
                {
                    XmlDiffView.HtmlWriteEmptyString(writer);
                }
                XmlDiffView.HtmlEndCell(writer);
            }
            XmlDiffView.HtmlEndRow(writer);

            // child nodes
            if (_childNodes != null)
            {
                HtmlDrawChildNodes(writer, indent + XmlDiffView.DeltaIndent);

                // end element
                XmlDiffView.HtmlStartRow(writer);
                for (int i = 0; i < 2; i++)
                {
                    XmlDiffView.HtmlStartCell(writer, indent);
                    if (XmlDiffView.HtmlWriteToPane[(int)_op, i])
                    {
                        if (_op == XmlDiffViewOperation.Change)
                        {
                            Debug.Assert(opForColor == XmlDiffViewOperation.Match);
                            XmlDiffView.HtmlWriteString(writer, opForColor, "</");
                            if (i == 0)
                            {
                                DrawHtmlNameChange(writer, _localName, _prefix);
                            }
                            else
                            {
                                DrawHtmlNameChange(writer, _changeInfo._localName, _changeInfo._prefix);
                            }
                            XmlDiffView.HtmlWriteString(writer, opForColor, ">");
                        }
                        else
                        {
                            DrawHtmlName(writer, opForColor, "</", ">");
                        }
                    }
                    else
                    {
                        XmlDiffView.HtmlWriteEmptyString(writer);
                    }
                    XmlDiffView.HtmlEndCell(writer);
                }
                XmlDiffView.HtmlEndRow(writer);
            }
        }