@@ -589,7 +589,7 @@ public virtual bool ShouldWriteElement()
589
589
return ! string . IsNullOrEmpty ( this . ElementName ) ;
590
590
}
591
591
592
- protected virtual void WriteStartElement ( XmlTextWriter writer )
592
+ protected virtual void WriteStartElement ( XmlWriter writer )
593
593
{
594
594
if ( ! string . IsNullOrEmpty ( this . ElementName ) )
595
595
{
@@ -599,14 +599,14 @@ protected virtual void WriteStartElement(XmlTextWriter writer)
599
599
this . WriteAttributes ( writer ) ;
600
600
}
601
601
602
- protected virtual void WriteEndElement ( XmlTextWriter writer )
602
+ protected virtual void WriteEndElement ( XmlWriter writer )
603
603
{
604
604
if ( ! string . IsNullOrEmpty ( this . ElementName ) )
605
605
{
606
606
writer . WriteEndElement ( ) ;
607
607
}
608
608
}
609
- protected virtual void WriteAttributes ( XmlTextWriter writer )
609
+ protected virtual void WriteAttributes ( XmlWriter writer )
610
610
{
611
611
//properties
612
612
var styles = WritePropertyAttributes ( writer ) ;
@@ -662,7 +662,7 @@ protected virtual void WriteAttributes(XmlTextWriter writer)
662
662
}
663
663
}
664
664
665
- private Dictionary < string , string > WritePropertyAttributes ( XmlTextWriter writer )
665
+ private Dictionary < string , string > WritePropertyAttributes ( XmlWriter writer )
666
666
{
667
667
var styles = _styles . ToDictionary ( _styles => _styles . Key , _styles => _styles . Value . Last ( ) . Value ) ;
668
668
@@ -956,7 +956,20 @@ private bool TryResolveParentAttributeValue(string attributeKey, out object pare
956
956
return resolved ;
957
957
}
958
958
959
- public virtual void Write ( XmlTextWriter writer )
959
+ /// <summary>
960
+ /// Write this SvgElement out using a given XmlWriter.
961
+ /// </summary>
962
+ /// <param name="writer">The XmlWriter to use.</param>
963
+ /// <remarks>
964
+ /// Recommendation is to create an XmlWriter by calling a factory method,<br/>
965
+ /// e.g. <see cref="XmlWriter.Create(System.IO.Stream)"/>,
966
+ /// as per <a href="https://docs.microsoft.com/dotnet/api/system.xml.xmltextreader#remarks">Microsoft documentation</a>.<br/>
967
+ /// <br/>
968
+ /// However, unlike an <see cref="XmlTextWriter"/> created via 'new XmlTextWriter()',<br/>
969
+ /// a factory-constructed XmlWriter will not flush output until it is closed<br/>
970
+ /// (normally via a using statement), or unless the client explicitly calls <see cref="XmlWriter.Flush()"/>.
971
+ /// </remarks>
972
+ public virtual void Write ( XmlWriter writer )
960
973
{
961
974
if ( ShouldWriteElement ( ) )
962
975
{
@@ -966,7 +979,7 @@ public virtual void Write(XmlTextWriter writer)
966
979
}
967
980
}
968
981
969
- protected virtual void WriteChildren ( XmlTextWriter writer )
982
+ protected virtual void WriteChildren ( XmlWriter writer )
970
983
{
971
984
if ( this . Nodes . Any ( ) )
972
985
{
0 commit comments