Exemple #1
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);
            }
        }
Exemple #2
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);
            }
        }
Exemple #3
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);
 }
Exemple #4
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);
            }
        }
Exemple #5
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);
            }
        }
Exemple #6
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);
            }
        }