XmlDiffViewDocumentType.cs
上传用户:hbhltzc
上传日期:2022-06-04
资源大小:1925k
文件大小:32k
源码类别:

xml/soap/webservice

开发平台:

Visual C++

  1. //  ---------------------------------------------------------------------------
  2. // <copyright company="Microsoft Corporation" file="XmlDiffViewDocumentType.cs">
  3. //     Copyright (c) Microsoft Corporation 2005
  4. // </copyright>
  5. // <project>
  6. //     XmlDiffView
  7. // </project>
  8. // <summary>
  9. //     Generate output data for differences in 
  10. ///    the DOCTYPE declaration (DTD) nodes. This
  11. ///    does not drill down into the components of
  12. ///    the DTD's internal subset.
  13. // </summary>
  14. // <history>
  15. //      [barryw] 03MAR05 Created
  16. // </history>
  17. //  ---------------------------------------------------------------------------
  18. namespace Microsoft.XmlDiffPatch
  19. {
  20.     #region Using directives
  21.     using System;
  22.     using System.Xml;
  23.     using System.IO;
  24.     using System.Diagnostics;
  25.     
  26.     #endregion
  27.     /// <summary>
  28.     /// Class to generate output data for differences in 
  29.     /// the DOCTYPE declaration (DTD) nodes.
  30.     /// </summary>
  31.     /// <remarks>Programmer notes for future code 
  32.     ///  enhancements: The PublicLiteral 
  33.     ///  and the SystemLiteral are considered attributes. 
  34.     ///  The attribute names are PUBLIC and SYSTEM. 
  35.     ///  To retrieve the content of the attribute, use 
  36.     ///  GetAttribute or another attribute accessing 
  37.     ///  method.</remarks>
  38.     internal class XmlDiffViewDocumentType : XmlDiffViewNode
  39.     {
  40.         #region Member variables section
  41.         /// <summary>
  42.         /// Name given to the DOCTYPE declaration (DTD).
  43.         /// </summary>
  44.         private string nameStore;
  45.         private string systemIdStore;
  46.         private string publicIdStore;
  47.         private string internalDtdSubset;
  48.         #endregion
  49.         
  50.         #region  Constructors section
  51.         /// <summary>
  52.         /// Constructor
  53.         /// </summary>
  54.         /// <param name="name">declaration name</param>
  55.         /// <param name="publicId">value of the PUBLIC  declaration 'attribute'</param>
  56.         /// <param name="systemId">value of the SYSTEM declaration 'attribute'</param>
  57.         /// <param name="documentTypeSubset">The inner declaration data</param>
  58.         public XmlDiffViewDocumentType(string name, string publicId, string systemId, string documentTypeSubset) : base(XmlNodeType.DocumentType) 
  59.         {
  60.             this.Name = name;
  61.             this.PublicId = (publicId == null) ? string.Empty : publicId;
  62.             this.SystemId = (systemId == null) ? string.Empty : systemId;
  63.             this.Subset = documentTypeSubset;
  64.         }
  65.         #endregion
  66.         #region Properties section
  67.       
  68.         /// <summary>
  69.         /// Gets and sets the value of the SYSTEM declaration 'attribute'
  70.         /// </summary>
  71.         public string SystemId
  72.         {
  73.             get
  74.             {
  75.                 return this.systemIdStore;
  76.             }
  77.             set
  78.             {
  79.                 this.systemIdStore = value;
  80.             }
  81.         }
  82.         /// <summary>
  83.         /// Gets and sets the declaration name
  84.         /// </summary>
  85.         public string Name
  86.         {
  87.             get
  88.             {
  89.                 return this.nameStore;
  90.             }
  91.             set
  92.             {
  93.                 this.nameStore = value;
  94.             }
  95.         }
  96.         /// <summary>
  97.         /// Gets and sets the value of the PUBLIC declaration 'attribute'
  98.         /// </summary>
  99.         public string PublicId
  100.         {
  101.             get
  102.             {
  103.                 return this.publicIdStore;
  104.             }
  105.             set
  106.             {
  107.                 this.publicIdStore = value;
  108.             }
  109.         }
  110.         /// <summary>
  111.         /// Gets and sets the inner data for the declaration
  112.         /// </summary>
  113.         public string Subset
  114.         {
  115.             get
  116.             {
  117.                 return this.internalDtdSubset;
  118.             }
  119.             set
  120.             {
  121.                 this.internalDtdSubset = value;
  122.             }
  123.         }
  124.         /// <summary>
  125.         /// Returns the complete declaration 
  126.         /// </summary>
  127.         public override string OuterXml
  128.         {
  129.             get
  130.             {
  131.                 string dtd = "<!DOCTYPE " + this.Name + " ";
  132.                 if (this.PublicId != string.Empty)
  133.                 {
  134.                     dtd += Tags.DtdPublic + """ + this.PublicId + "" ";
  135.                 }
  136.                 else if (this.SystemId != string.Empty)
  137.                 {
  138.                     dtd += Tags.DtdSystem + """ + this.SystemId + "" ";
  139.                 }
  140.                 if (this.Subset != string.Empty)
  141.                 {
  142.                     dtd += "[" + this.Subset + "]";
  143.                 }
  144.                 dtd += ">";
  145.                 return dtd;
  146.             }
  147.         }
  148.         #endregion
  149.         
  150.         #region Methods section
  151.         /// <summary>
  152.         /// Creates a complete copy of the current node.
  153.         /// </summary>
  154.         /// <param name="deep">deprecated</param>
  155.         /// <returns>Exception: Clone method should 
  156.         /// never be called on a document type 
  157.         /// node.</returns>
  158.         [Obsolete("Clone method should never be called on document type node.", true)]
  159.         internal override XmlDiffViewNode Clone(bool deep)
  160.         {
  161.             Debug.Assert(false, "Clone method should never be called on document type node.");
  162.             return null;
  163.         }
  164.         /// <summary>
  165.         /// Generates  output data in html form
  166.         /// </summary>
  167.         /// <param name="writer">output stream</param>
  168.         /// <param name="indent">number of indentations</param>
  169.         internal override void DrawHtml(XmlWriter writer, int indent) 
  170.         {
  171.             if (Operation == XmlDiffViewOperation.Change) 
  172.             {
  173.                 XmlDiffView.HtmlStartRow(writer);
  174.                 this.DrawLinkNode(writer);
  175.                 for (int i = 0; i < 2; i++) 
  176.                 {
  177.                     XmlDiffView.HtmlStartCell(writer, indent);
  178.                     // name
  179.                     XmlDiffView.HtmlWriteString(
  180.                         writer, 
  181.                         XmlDiffViewOperation.Match, 
  182.                         Tags.XmlDocumentTypeBegin);
  183.                     if (i == 0)
  184.                     {
  185.                         XmlDiffView.HtmlWriteString(
  186.                             writer, 
  187.                             (this.Name == ChangeInformation.LocalName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change, 
  188.                             this.Name);
  189.                     }
  190.                     else 
  191.                     {
  192.                         XmlDiffView.HtmlWriteString(
  193.                             writer, 
  194.                             (this.Name == ChangeInformation.LocalName) ? XmlDiffViewOperation.Match : XmlDiffViewOperation.Change, 
  195.                             ChangeInformation.LocalName);
  196.                     }
  197.                     XmlDiffView.HtmlWriteString(
  198.                         writer, 
  199.                         XmlDiffViewOperation.Match, 
  200.                         " ");
  201.                     string systemString = "SYSTEM ";
  202.                     // public id
  203.                     if (this.PublicId == ChangeInformation.Prefix) 
  204.                     {
  205.                         // match
  206.                         if (this.PublicId != string.Empty) 
  207.                         {
  208.                             XmlDiffView.HtmlWriteString(
  209.                                 writer, 
  210.                                 XmlDiffViewOperation.Match, 
  211.                                 Tags.DtdPublic + """ + this.PublicId + "" ");
  212.                             systemString = string.Empty;
  213.                         }
  214.                     }
  215.                     else 
  216.                     {
  217.                         // add
  218.                         if (this.PublicId == string.Empty) 
  219.                         {
  220.                             if (i == 1) 
  221.                             {
  222.                                 XmlDiffView.HtmlWriteString(
  223.                                     writer, 
  224.                                     XmlDiffViewOperation.Add,
  225.                                     Tags.DtdPublic + """ + ChangeInformation.Prefix + "" ");
  226.                                 systemString = string.Empty;
  227.                             }
  228.                         }
  229.                             // remove
  230.                         else if (ChangeInformation.Prefix == string.Empty) 
  231.                         {
  232.                             if (i == 0) 
  233.                             {
  234.                                 XmlDiffView.HtmlWriteString(
  235.                                     writer, 
  236.                                     XmlDiffViewOperation.Remove,
  237.                                     Tags.DtdPublic + """ + this.PublicId + "" ");
  238.                                 systemString = string.Empty;
  239.                             }
  240.                         }
  241.                             // change
  242.                         else 
  243.                         {
  244.                             XmlDiffView.HtmlWriteString(
  245.                                 writer, 
  246.                                 XmlDiffViewOperation.Change,
  247.                                 Tags.DtdPublic + """ + ((i == 0) ? this.PublicId : ChangeInformation.Prefix) + """);
  248.                             systemString = string.Empty;
  249.                         }
  250.                     }
  251.                     // system id
  252.                     if (this.SystemId == ChangeInformation.NamespaceUri) 
  253.                     {
  254.                         if (this.SystemId != string.Empty) 
  255.                         {
  256.                             XmlDiffView.HtmlWriteString(
  257.                                 writer, 
  258.                                 XmlDiffViewOperation.Match, 
  259.                                 systemString  + """ + this.SystemId + "" ");
  260.                         }
  261.                     }
  262.                     else 
  263.                     { 
  264.                         // add 
  265.                         if (this.SystemId == string.Empty) 
  266.                         {
  267.                             if (i == 1) 
  268.                             {
  269.                                 XmlDiffView.HtmlWriteString(
  270.                                     writer, 
  271.                                     XmlDiffViewOperation.Add, 
  272.                                     systemString  + """ + ChangeInformation.NamespaceUri + "" ");
  273.                             }                
  274.                         }
  275.                             // remove
  276.                         else if (ChangeInformation.Prefix == string.Empty) 
  277.                         {
  278.                             if (i == 0) 
  279.                             {
  280.                                 XmlDiffView.HtmlWriteString(
  281.                                     writer, 
  282.                                     XmlDiffViewOperation.Remove, 
  283.                                     systemString  + """ + this.SystemId + """);
  284.                             }
  285.                         }
  286.                             // change
  287.                         else 
  288.                         {
  289.                             XmlDiffView.HtmlWriteString(
  290.                                 writer, 
  291.                                 XmlDiffViewOperation.Change, 
  292.                                 systemString  + """ + ((i == 0) ? this.SystemId : ChangeInformation.NamespaceUri) + "" ");
  293.                         }
  294.                     }
  295.                     // internal subset
  296.                     if (this.Subset == ChangeInformation.Subset) 
  297.                     {
  298.                         if (this.Subset != string.Empty) 
  299.                         {
  300.                             XmlDiffView.HtmlWriteString(
  301.                                 writer, 
  302.                                 XmlDiffViewOperation.Match, 
  303.                                 "[" + this.Subset + "]");
  304.                         }
  305.                     }
  306.                     else 
  307.                     {
  308.                         // add 
  309.                         if (this.Subset == string.Empty) 
  310.                         {
  311.                             if (i == 1) 
  312.                             {
  313.                                 XmlDiffView.HtmlWriteString(
  314.                                     writer, 
  315.                                     XmlDiffViewOperation.Add, 
  316.                                     "[" + ChangeInformation.Subset + "]");
  317.                             }                
  318.                         }
  319.                             // remove
  320.                         else if (ChangeInformation.Subset == string.Empty) 
  321.                         {
  322.                             if (i == 0) 
  323.                             {
  324.                                 XmlDiffView.HtmlWriteString(
  325.                                     writer, 
  326.                                     XmlDiffViewOperation.Remove, 
  327.                                     "[" + this.Subset + "]");
  328.                             }
  329.                         }
  330.                             // change
  331.                         else 
  332.                         {
  333.                             XmlDiffView.HtmlWriteString(
  334.                                 writer, 
  335.                                 XmlDiffViewOperation.Change, 
  336.                                 "[" + ((i == 0) ? this.Subset : ChangeInformation.Subset) + "]");
  337.                         }
  338.                     }
  339.                     // close start tag
  340.                     XmlDiffView.HtmlWriteString(
  341.                         writer, 
  342.                         XmlDiffViewOperation.Match, 
  343.                         Tags.XmlDocumentTypeEnd);
  344.                     XmlDiffView.HtmlEndCell(writer);
  345.                 }
  346.                 XmlDiffView.HtmlEndRow(writer);
  347.             }
  348.             else 
  349.             {
  350.                 DrawHtmlNoChange(writer, indent);
  351.             }
  352.         }
  353.         /// <summary>
  354.         /// Add the DocumentType data to the output. 
  355.         /// </summary>
  356.         /// <param name="writer">Output data stream</param>
  357.         /// <param name="indent">current size of text indentation</param>
  358.         /// <remarks>If the DOCTYPE declaration includes
  359.         /// declarations that are to be combined with 
  360.         /// external files or the external subset, it 
  361.         /// uses the following syntax.
  362.         ///   DOCTYPE rootElement SYSTEM "URIreference"
  363.         ///     [declarations]
  364.         ///   or 
  365.         /// DOCTYPE rootElement PUBLIC "PublicIdentifier" "URIreference"
  366.         /// [declarations]
  367.         /// </remarks>
  368.         internal override void DrawText(TextWriter writer, int indent)
  369.         {
  370.             Debug.Assert(NodeType == XmlNodeType.DocumentType);
  371.             // indent the text.
  372.             writer.Write(XmlDiffView.IndentText(indent));
  373.             switch (Operation)
  374.             {
  375.                 case XmlDiffViewOperation.Add:
  376.                     this.DrawTextAdd(writer, indent);
  377.                     break;
  378.                 case XmlDiffViewOperation.Change:
  379.                     this.DrawTextChange(writer, indent);
  380.                     break;
  381.                 case XmlDiffViewOperation.Ignore:
  382.                 case XmlDiffViewOperation.MoveFrom:
  383.                     this.DrawTextMoveFrom(writer, indent);
  384.                     break;
  385.                 case XmlDiffViewOperation.MoveTo:
  386.                     this.DrawTextMoveTo(writer, indent);
  387.                     break;
  388.                 case XmlDiffViewOperation.Match:
  389.                     // for 'Ignore' and match operations
  390.                     // write out the baseline data
  391.                     this.DrawTextNoChange(writer, indent);
  392.                     break;
  393.                 case XmlDiffViewOperation.Remove:
  394.                     this.DrawTextRemove(writer, indent);
  395.                     break;
  396.                 default:
  397.                     Debug.Assert(false);
  398.                     break;
  399.             }
  400.             writer.Write(writer.NewLine);
  401.         }
  402.         /// <summary>
  403.         /// Generates the original document type sudo-attribute
  404.         /// </summary>
  405.         /// <returns>document type sudo-attribute</returns>
  406.         private string DocumentTypeSudoAttributes()
  407.         {
  408.             string systemString = "SYSTEM ";
  409.             const string publicString = "PUBLIC ";
  410.             string attributes = " ";
  411.             switch (Operation)
  412.             {
  413.                 case XmlDiffViewOperation.Add:
  414.                 case XmlDiffViewOperation.Remove:
  415.                 case XmlDiffViewOperation.MoveFrom:
  416.                 case XmlDiffViewOperation.Match:
  417.                     // for 'add'/'remove'/'move from' differences and
  418.                     // match the values are in the regular properties, 
  419.                     // not the changed information object 
  420.                     if ((null != this.PublicId) &&
  421.                         (this.PublicId != string.Empty))
  422.                     {
  423.                         attributes += publicString + """ + this.PublicId + "" ";
  424.                     }
  425.                     else if ((null != this.SystemId) &&
  426.                         (this.SystemId != string.Empty))
  427.                     {
  428.                         attributes += systemString + """ + this.SystemId + "" ";
  429.                     }
  430.                     else if (null != ChangeInformation)
  431.                     {
  432.                         if ((null != ChangeInformation.Prefix) &&
  433.                         (ChangeInformation.Prefix != string.Empty))
  434.                         {
  435.                             Debug.Assert(
  436.                                 false,
  437.                                 "Unexpected value ",
  438.                                 publicString + """ + ChangeInformation.Prefix + "" ");
  439.                         }
  440.                         else if ((null != ChangeInformation.NamespaceUri) &&
  441.                         (ChangeInformation.NamespaceUri != string.Empty))
  442.                         {
  443.                             Debug.Assert(
  444.                                 false,
  445.                                 "Unexpected value ",
  446.                                 systemString + """ + ChangeInformation.NamespaceUri + "" ");
  447.                         }
  448.                     }
  449.                     break;
  450.                 case XmlDiffViewOperation.MoveTo:
  451.                     // for ''move to' differences the values
  452.                     // are in the changed information object
  453.                     if ((null != ChangeInformation.Prefix) &&
  454.                         (ChangeInformation.Prefix != string.Empty))
  455.                     {
  456.                         attributes += publicString + """ + ChangeInformation.Prefix + "" ";
  457.                     }
  458.                     else if ((null != ChangeInformation.NamespaceUri) &&
  459.                         (ChangeInformation.NamespaceUri != string.Empty))
  460.                     {
  461.                         attributes += systemString + """ + ChangeInformation.NamespaceUri + "" ";
  462.                     }
  463.                     else if ((null != this.PublicId) &&
  464.                         (this.PublicId != string.Empty))
  465.                     {
  466.                         Debug.Assert(
  467.                             false,
  468.                             "Unexpected value ",
  469.                             publicString + """ + this.PublicId + "" ");
  470.                     }
  471.                     else if ((null != this.SystemId) &&
  472.                    (this.SystemId != string.Empty))
  473.                     {
  474.                         Debug.Assert(
  475.                             false,
  476.                             "Unexpected value ",
  477.                             systemString + """ + this.SystemId + "" ");
  478.                     }
  479.                     break;
  480.                 case XmlDiffViewOperation.Ignore:
  481.                     attributes = string.Empty;
  482.                     break;
  483.                 case XmlDiffViewOperation.Change:
  484.                     attributes = " ";
  485.                     // check for changes in the public "attribute" value
  486.                     if (((null != this.PublicId) ||
  487.                         (null != ChangeInformation.Prefix)) &&
  488.                         (this.PublicId == ChangeInformation.Prefix))
  489.                     {
  490.                         // match
  491.                         if (string.Empty != this.PublicId)
  492.                         {
  493.                             attributes += Tags.DtdPublic + """ + this.PublicId + "" ";
  494.                             systemString = string.Empty;
  495.                         }
  496.                     }
  497.                     else
  498.                     {
  499.                         if ((string.Empty == this.PublicId) &&
  500.                             (string.Empty != ChangeInformation.Prefix))
  501.                         {
  502.                             // add
  503.                             attributes += Difference.Tag + Difference.DocumentTypeAdded;
  504.                             attributes += " " + Tags.DtdPublic + """ + ChangeInformation.Prefix + "" ";
  505.                             systemString = string.Empty;
  506.                         }
  507.                         else if ((string.Empty == ChangeInformation.Prefix) &&
  508.                             (string.Empty != this.PublicId))
  509.                         {
  510.                             // remove
  511.                             attributes += Difference.Tag + Difference.DocumentTypeDeleted;
  512.                             attributes += Tags.DtdPublic + """ + this.PublicId + "" ";
  513.                             systemString = string.Empty;
  514.                         }
  515.                         else
  516.                         {
  517.                             // if both have values, they must be different
  518.                             if ((string.Empty != ChangeInformation.Prefix) &&
  519.                                 (string.Empty != this.PublicId))
  520.                             {
  521.                                 // change
  522.                                 attributes += Difference.Tag + "=" +
  523.                                     Difference.ChangeBegin +
  524.                                     Tags.DtdPublic + """ + this.PublicId + "" " +
  525.                                     Difference.ChangeTo +
  526.                                     Tags.DtdPublic + """ + ChangeInformation.Prefix +
  527.                                     "" " +
  528.                                     Difference.ChangeEnd;
  529.                                 systemString = string.Empty;
  530.                             }
  531.                         }
  532.                     }
  533.                     // system id
  534.                     if (((null != this.SystemId) ||
  535.                         (null != ChangeInformation.NamespaceUri)) &&
  536.                         (this.SystemId == ChangeInformation.NamespaceUri))
  537.                     {
  538.                         // match
  539.                         if (this.SystemId != string.Empty)
  540.                         {
  541.                             attributes += systemString + """ + this.SystemId + "" ";
  542.                         }
  543.                     }
  544.                     else
  545.                     {
  546.                         if ((string.Empty == this.SystemId) &&
  547.                             (string.Empty != ChangeInformation.NamespaceUri))
  548.                         {
  549.                             // add 
  550.                             attributes += Difference.Tag + Difference.DocumentTypeAdded;
  551.                             attributes += systemString + """ +
  552.                                 ChangeInformation.NamespaceUri + "" ";
  553.                         }
  554.                         // remove
  555.                         else if ((ChangeInformation.Prefix == string.Empty) &&
  556.                             (string.Empty != this.SystemId))
  557.                         {
  558.                             attributes += Difference.Tag + Difference.DocumentTypeDeleted;
  559.                             attributes += systemString + """ + this.SystemId + "" ";
  560.                         }
  561.                         // change
  562.                         else
  563.                         {
  564.                             // if both have values, they must be different
  565.                             if ((string.Empty != ChangeInformation.NamespaceUri) &&
  566.                                 (string.Empty != this.SystemId))
  567.                             {
  568.                                 // change
  569.                                 attributes += Difference.Tag + "=" +
  570.                                     Difference.ChangeBegin +
  571.                                     systemString + """ + this.SystemId + "" " +
  572.                                     Difference.ChangeTo +
  573.                                     systemString + """ + ChangeInformation.NamespaceUri +
  574.                                     "" " +
  575.                                     Difference.ChangeEnd;
  576.                             }
  577.                         }
  578.                     }
  579.                     break;
  580.                 default:
  581.                     Trace.WriteLine("This differencing operation is not recognized");
  582.                     throw new ArgumentOutOfRangeException(
  583.                         "Operation",
  584.                         Operation,
  585.                         "This differencing operation is not recognized");
  586.             }
  587.             return attributes;
  588.         }
  589.         /// <summary>
  590.         /// Generates output data in text form for differences
  591.         /// due to adding data
  592.         /// </summary>
  593.         /// <param name="writer">output stream</param>
  594.         /// <param name="indent">number of indentations</param>
  595.         private void DrawTextAdd(
  596.             TextWriter writer,
  597.             int indent)
  598.         {
  599.             writer.Write(Tags.XmlDocumentTypeBegin +
  600.                 this.Name + this.DocumentTypeSudoAttributes() +
  601.                 "[" + writer.NewLine +
  602.                 XmlDiffView.IndentText(indent + indent) +
  603.                 Tags.XmlCommentOldStyleBegin + " " + Difference.Tag + 
  604.                 Difference.DocumentTypeAdded +
  605.                 " " + Tags.XmlCommentOldStyleEnd + writer.NewLine +
  606.                 this.internalDtdSubset +
  607.                 writer.NewLine + "]" +
  608.                 Tags.XmlDocumentTypeEnd);
  609.         }
  610.         /// <summary>
  611.         /// Generates output data in text form for differences
  612.         /// due to moving data from a location
  613.         /// </summary>
  614.         /// <param name="writer">output stream</param>
  615.         /// <param name="indent">number of indentations</param>
  616.         private void DrawTextMoveFrom(
  617.             TextWriter writer,
  618.             int indent)
  619.         {
  620.             // generate the dtd name and sudo-attributes
  621.             writer.Write(Tags.XmlDocumentTypeBegin +
  622.                 this.Name + this.DocumentTypeSudoAttributes() +
  623.                 "[" + writer.NewLine);
  624.             // generate the main body of the dtd.
  625.             writer.Write(XmlDiffView.IndentText(indent + indent) +
  626.                 writer.NewLine);
  627.             // include a comment about the difference.
  628.             writer.Write(Tags.XmlCommentOldStyleBegin + " " + Difference.Tag +
  629.                 Difference.DocumentTypeMovedFromBegin + OperationId +
  630.                 Difference.DocumentTypeMovedFromEnd +
  631.                 " " + Tags.XmlCommentOldStyleEnd + writer.NewLine);
  632.             // include main body and closing tags
  633.             writer.Write(XmlDiffView.IndentText(indent + indent) +
  634.                 this.internalDtdSubset +
  635.                 writer.NewLine + "]" +
  636.                 Tags.XmlDocumentTypeEnd);
  637.         }
  638.         /// <summary>
  639.         /// Generates output data in text form for differences
  640.         /// due to moving data to a new location
  641.         /// </summary>
  642.         /// <param name="writer">output stream</param>
  643.         /// <param name="indent">number of indentations</param>
  644.         private void DrawTextMoveTo(
  645.             TextWriter writer,
  646.             int indent)
  647.         {
  648.             // generate the dtd name and sudo-attributes
  649.             writer.Write(Tags.XmlDocumentTypeBegin +
  650.                 this.Name + this.DocumentTypeSudoAttributes() +
  651.                 "[" + writer.NewLine);
  652.             // generate the main body of the dtd.
  653.             writer.Write(XmlDiffView.IndentText(indent + indent) +
  654.                 writer.NewLine);
  655.             // include a comment about the difference.
  656.             writer.Write(Tags.XmlCommentOldStyleBegin + " " + Difference.Tag +
  657.                 Difference.DocumentTypeMovedToBegin + OperationId +
  658.                 Difference.DocumentTypeMovedToEnd +
  659.                 " " + Tags.XmlCommentOldStyleEnd + writer.NewLine);
  660.             // include main body and closing tags
  661.             writer.Write(XmlDiffView.IndentText(indent + indent) +
  662.                 this.internalDtdSubset +
  663.                 writer.NewLine + "]" +
  664.                 Tags.XmlDocumentTypeEnd);
  665.         }
  666.         /// <summary>
  667.         /// Generates output data in text form for differences
  668.         /// due to removing data
  669.         /// </summary>
  670.         /// <param name="writer">output stream</param>
  671.         /// <param name="indent">number of indentations</param>
  672.         private void DrawTextRemove(
  673.             TextWriter writer,
  674.             int indent)
  675.         {
  676.             // generate the dtd name and sudo-attributes
  677.             writer.Write(Tags.XmlDocumentTypeBegin +
  678.                 this.Name + this.DocumentTypeSudoAttributes() +
  679.                 "[" + writer.NewLine);
  680.             // generate the main body of the dtd.
  681.             writer.Write(XmlDiffView.IndentText(indent + indent));
  682.             // include a comment about the difference.
  683.             writer.Write(Tags.XmlCommentOldStyleBegin + " " + Difference.Tag +
  684.                 Difference.DocumentTypeDeleted +
  685.                 " " + Tags.XmlCommentOldStyleEnd + writer.NewLine);
  686.             // include main body and closing tags
  687.             writer.Write(XmlDiffView.IndentText(indent + indent) +
  688.                 this.internalDtdSubset +
  689.                 writer.NewLine +
  690.                 XmlDiffView.IndentText(indent + indent) +
  691.                 "]" +
  692.                 Tags.XmlDocumentTypeEnd);
  693.         }
  694.         /// <summary>
  695.         /// Generates output data in text form for differences
  696.         /// due to changing data
  697.         /// </summary>
  698.         /// <param name="writer">output stream</param>
  699.         /// <param name="indent">number of indentations</param>
  700.         private void DrawTextChange(
  701.             TextWriter writer,
  702.             int indent)
  703.         {
  704.             // generate the dtd name and sudo-attributes
  705.             writer.Write(Tags.XmlDocumentTypeBegin +
  706.                 this.Name + this.DocumentTypeSudoAttributes() +
  707.                 "[" + writer.NewLine);
  708.             // generate the main body of the dtd.
  709.             writer.Write(XmlDiffView.IndentText(indent + indent) +
  710.                 writer.NewLine);
  711.             // include a comment about the difference showing the old subset data.
  712.             writer.Write(Tags.XmlCommentOldStyleBegin + writer.NewLine +
  713.                 " " + Difference.Tag +
  714.                 Difference.ChangeBegin + this.internalDtdSubset + Difference.ChangeEnd +
  715.                 writer.NewLine +
  716.                 " " + Tags.XmlCommentOldStyleEnd + 
  717.                 writer.NewLine);
  718.             // include main body and closing tags
  719.             writer.Write(XmlDiffView.IndentText(indent + indent) +
  720.                 changeInfo.Subset +
  721.                 writer.NewLine + "]" +
  722.                 Tags.XmlDocumentTypeEnd);
  723.         }
  724.         /// <summary>
  725.         /// Generates output data in text form for differences
  726.         /// due to changing existing data
  727.         /// </summary>
  728.         /// <param name="writer">output stream</param>
  729.         /// <param name="indent">number of indentations</param>
  730.         private new void DrawTextNoChange(
  731.             TextWriter writer,
  732.             int indent)
  733.         {
  734.             string dtd = Tags.XmlDocumentTypeBegin +
  735.                 this.Name + this.DocumentTypeSudoAttributes() +
  736.                 this.internalDtdSubset +
  737.                 Tags.XmlDocumentTypeEnd;
  738.         }
  739.         #endregion
  740.         
  741.     }
  742. }