Exemplo n.º 1
0
 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);
     }
 }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Generates output data in text form for a difference due
 /// to adding data.
 /// </summary>
 /// <param name="writer">output stream</param>
 /// <param name="typeOfDifference">type of difference</param>
 /// <param name="tagStart">xml tags at start of statement</param>
 /// <param name="tagEnd">xml tags at end of statement</param>
 private void DrawHtmlName(
     XmlWriter writer,
     XmlDiffViewOperation typeOfDifference,
     string tagStart,
     string tagEnd)
 {
     if (this.Prefix != string.Empty && this.ignorePrefixes)
     {
         XmlDiffView.HtmlWriteString(
             writer,
             typeOfDifference,
             tagStart);
         XmlDiffView.HtmlWriteString(
             writer,
             XmlDiffViewOperation.Ignore,
             this.Prefix + ":");
         XmlDiffView.HtmlWriteString(
             writer,
             typeOfDifference,
             this.LocalName + tagEnd);
     }
     else
     {
         XmlDiffView.HtmlWriteString(
             writer,
             typeOfDifference,
             tagStart + this.Name + tagEnd);
     }
 }
        /// <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);
            }
        }
Exemplo n.º 5
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);
            }
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        private void DrawHtmlAttributeChange(XmlWriter writer, XmlDiffViewAttribute attr, string localName, string prefix, string value)
        {
            if (prefix != string.Empty)
            {
                XmlDiffView.HtmlWriteString(writer,
                                            _ignorePrefixes ? XmlDiffViewOperation.Ignore :
                                            (attr._prefix == attr._changeInfo._prefix) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change,
                                            prefix + ":");
            }

            XmlDiffView.HtmlWriteString(writer,
                                        (attr._localName == attr._changeInfo._localName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change,
                                        localName);

            if (attr._value != attr._changeInfo._value)
            {
                XmlDiffView.HtmlWriteString(writer, "=\"");
                XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Change, value);
                XmlDiffView.HtmlWriteString(writer, "\"");
            }
            else
            {
                XmlDiffView.HtmlWriteString(writer, "=\"" + value + "\"");
            }
        }
Exemplo n.º 8
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);
            }
        }
Exemplo n.º 9
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);
 }
Exemplo n.º 10
0
 private void DrawHtmlNameChange(XmlWriter writer, string localName, string prefix)
 {
     if (prefix != string.Empty)
     {
         XmlDiffView.HtmlWriteString(writer, this._ignorePrefixes ? XmlDiffViewOperation.Ignore : (this._prefix == this._changeInfo._prefix ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change), prefix + ":");
     }
     XmlDiffView.HtmlWriteString(writer, this._localName == this._changeInfo._localName ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change, localName);
 }
        /// <summary>
        /// Generate html output data for a differences
        /// due to a change in an attribute.
        /// </summary>
        /// <param name="writer">output stream</param>
        /// <param name="attr">Attribute object</param>
        /// <param name="typeOfDifference">type of difference</param>
        public void DrawHtmlAttribute(
            XmlWriter writer,
            bool ignorePrefixes,
            XmlDiffViewOperation typeOfDifference)
        {
            bool opid = false;

            if (this.OperationId != XmlDiffView.LastVisitedOpId)
            {
                XmlDiffView.LastVisitedOpId = this.OperationId;
                // only write this anchor if the parent elemnt was not also changed.
                if (this.OperationId != 0 && this.Parent.Operation != this.Operation &&
                    (this.PreviousSibling == null || this.PreviousSibling.Operation != this.Operation))
                {
                    writer.WriteStartElement("a");
                    writer.WriteAttributeString("name", "id" + this.OperationId);
                    opid = true;
                }
            }
            if (ignorePrefixes)
            {
                if (this.Prefix == "xmlns" || (this.LocalName == "xmlns" &&
                                               this.Prefix == string.Empty))
                {
                    XmlDiffView.HtmlWriteString(
                        writer,
                        XmlDiffViewOperation.Ignore,
                        this.Name);
                    XmlDiffView.HtmlWriteString(
                        writer,
                        typeOfDifference,
                        "=\"" + this.AttributeValue + "\"");
                    return;
                }
                else if (this.Prefix != string.Empty)
                {
                    XmlDiffView.HtmlWriteString(
                        writer,
                        XmlDiffViewOperation.Ignore,
                        this.Prefix + ":");
                    XmlDiffView.HtmlWriteString(
                        writer,
                        typeOfDifference,
                        this.LocalName + "=\"" + this.AttributeValue + "\"");
                    return;
                }
            }

            XmlDiffView.HtmlWriteString(
                writer,
                typeOfDifference,
                this.Name + "=\"" + this.AttributeValue + "\"");

            if (opid)
            {
                writer.WriteEndElement();
            }
        }
        /// <summary>
        /// Generates output data in html for a difference due
        /// to changing attribute data.
        /// </summary>
        /// <param name="writer">output stream</param>
        /// <param name="attr">Attribute object</param>
        /// <param name="localName">name of attribute
        /// (without the prefix)</param>
        /// <param name="prefix">xml attribute prefix</param>
        /// <param name="attributeValue">The value for the attribute.</param>
        public void DrawHtmlAttributeChange(
            XmlWriter writer,
            string localName,
            string prefix,
            string attributeValue,
            bool ignorePrefixes)
        {
            bool opid = false;

            if (this.OperationId != XmlDiffView.LastVisitedOpId)
            {
                // only write this anchor if the parent elemnt was not also changed.
                if (this.OperationId != 0 && this.Parent.Operation == XmlDiffViewOperation.Match &&
                    (this.PreviousSibling == null || this.PreviousSibling.Operation == XmlDiffViewOperation.Match))
                {
                    XmlDiffView.LastVisitedOpId = this.OperationId;
                    writer.WriteStartElement("a");
                    writer.WriteAttributeString("name", "id" + this.OperationId);
                    opid = true;
                }
            }
            if (prefix != string.Empty)
            {
                XmlDiffView.HtmlWriteString(
                    writer,
                    ignorePrefixes ? XmlDiffViewOperation.Ignore : (this.Prefix == this.ChangeInformation.Prefix) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change,
                    prefix + ":");
            }

            XmlDiffView.HtmlWriteString(
                writer,
                (this.LocalName == this.ChangeInformation.LocalName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change,
                this.localName);

            if (this.AttributeValue != this.ChangeInformation.Subset)
            {
                XmlDiffView.HtmlWriteString(writer, "=\"");
                XmlDiffView.HtmlWriteString(
                    writer,
                    XmlDiffViewOperation.Change,
                    attributeValue);
                XmlDiffView.HtmlWriteString(writer, "\"");
            }
            else
            {
                XmlDiffView.HtmlWriteString(
                    writer,
                    "=\"" + attributeValue + "\"");
            }
            if (opid)
            {
                writer.WriteEndElement();
            }
        }
Exemplo n.º 13
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);
            }
        }
Exemplo n.º 14
0
 private void DrawHtmlName(XmlWriter writer, XmlDiffViewOperation opForColor, string tagStart, string tagEnd)
 {
     if (_prefix != string.Empty && _ignorePrefixes)
     {
         XmlDiffView.HtmlWriteString(writer, opForColor, tagStart);
         XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Ignore, _prefix + ":");
         XmlDiffView.HtmlWriteString(writer, opForColor, _localName + tagEnd);
     }
     else
     {
         XmlDiffView.HtmlWriteString(writer, opForColor, tagStart + _name + tagEnd);
     }
 }
Exemplo n.º 15
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);
     }
 }
Exemplo n.º 16
0
        /// <summary>
        /// Generates output data in html form for a difference due to
        /// a change in element name.
        /// </summary>
        /// <param name="writer">output stream</param>
        /// <param name="localName">name of the
        /// element (without the prefix)</param>
        /// <param name="prefix">prefix</param>
        private void DrawHtmlNameChange(
            XmlWriter writer,
            string localName,
            string prefix)
        {
            if (prefix != string.Empty)
            {
                XmlDiffView.HtmlWriteString(
                    writer,
                    this.ignorePrefixes ? XmlDiffViewOperation.Ignore : (prefix == ChangeInformation.Prefix) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change,
                    prefix + ":");
            }

            XmlDiffView.HtmlWriteString(
                writer,
                (localName == ChangeInformation.LocalName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change,
                localName);
        }
        /// <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);
            }
        }
Exemplo n.º 18
0
        private void DrawHtmlAttribute(XmlWriter writer, XmlDiffViewAttribute attr, XmlDiffViewOperation opForColor)
        {
            if (_ignorePrefixes)
            {
                if (attr._prefix == "xmlns" || (attr._localName == "xmlns" && attr._prefix == string.Empty))
                {
                    XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Ignore, attr._name);
                    XmlDiffView.HtmlWriteString(writer, opForColor, "=\"" + attr._value + "\"");
                    return;
                }
                else if (attr._prefix != string.Empty)
                {
                    XmlDiffView.HtmlWriteString(writer, XmlDiffViewOperation.Ignore, attr._prefix + ":");
                    XmlDiffView.HtmlWriteString(writer, opForColor, attr._localName + "=\"" + attr._value + "\"");
                    return;
                }
            }

            XmlDiffView.HtmlWriteString(writer, opForColor, attr._name + "=\"" + attr._value + "\"");
        }
Exemplo n.º 19
0
        /// <summary>
        /// Generate html output data for a differences
        /// due to a change in an attribute.
        /// </summary>
        /// <param name="writer">output stream</param>
        /// <param name="attr">Attribute object</param>
        /// <param name="typeOfDifference">type of difference</param>
        private void DrawHtmlAttribute(
            XmlWriter writer,
            XmlDiffViewAttribute attr,
            XmlDiffViewOperation typeOfDifference)
        {
            if (this.ignorePrefixes)
            {
                if (attr.Prefix == "xmlns" || (attr.LocalName == "xmlns" &&
                                               attr.Prefix == string.Empty))
                {
                    XmlDiffView.HtmlWriteString(
                        writer,
                        XmlDiffViewOperation.Ignore,
                        attr.Name);
                    XmlDiffView.HtmlWriteString(
                        writer,
                        typeOfDifference,
                        "=\"" + attr.AttributeValue + "\"");
                    return;
                }
                else if (attr.Prefix != string.Empty)
                {
                    XmlDiffView.HtmlWriteString(
                        writer,
                        XmlDiffViewOperation.Ignore,
                        attr.Prefix + ":");
                    XmlDiffView.HtmlWriteString(
                        writer,
                        typeOfDifference,
                        attr.LocalName + "=\"" + attr.AttributeValue + "\"");
                    return;
                }
            }

            XmlDiffView.HtmlWriteString(
                writer,
                typeOfDifference,
                attr.Name + "=\"" + attr.AttributeValue + "\"");
        }
Exemplo n.º 20
0
 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);
 }
Exemplo n.º 21
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);
     }
 }
Exemplo n.º 22
0
        /// <summary>
        /// Generates output data in html for a difference due
        /// to changing attribute data.
        /// </summary>
        /// <param name="writer">output stream</param>
        /// <param name="attr">Attribute object</param>
        /// <param name="localName">name of attribute
        /// (without the prefix)</param>
        /// <param name="prefix">xml attribute prefix</param>
        /// <param name="attributeValue">The value for the attribute.</param>
        private void DrawHtmlAttributeChange(
            XmlWriter writer,
            XmlDiffViewAttribute attr,
            string localName,
            string prefix,
            string attributeValue)
        {
            if (prefix != string.Empty)
            {
                XmlDiffView.HtmlWriteString(
                    writer,
                    this.ignorePrefixes ? XmlDiffViewOperation.Ignore : (attr.Prefix == attr.ChangeInformation.Prefix) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change,
                    prefix + ":");
            }

            XmlDiffView.HtmlWriteString(
                writer,
                (attr.LocalName == attr.ChangeInformation.LocalName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change,
                this.localName);

            if (attr.AttributeValue != attr.ChangeInformation.Subset)
            {
                XmlDiffView.HtmlWriteString(writer, "=\"");
                XmlDiffView.HtmlWriteString(
                    writer,
                    XmlDiffViewOperation.Change,
                    attributeValue);
                XmlDiffView.HtmlWriteString(writer, "\"");
            }
            else
            {
                XmlDiffView.HtmlWriteString(
                    writer,
                    "=\"" + attributeValue + "\"");
            }
        }
        /// <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);
            }
        }
Exemplo n.º 24
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);
            }
        }
Exemplo n.º 25
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);
     }
 }
Exemplo n.º 26
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);
            }
        }
Exemplo n.º 27
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);
        }
Exemplo n.º 28
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);
            }
        }
Exemplo n.º 29
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);
            }
        }