Skip to content

Commit

Permalink
configurate xmlreadersetting globally
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinPogoda committed Sep 26, 2023
1 parent e8658eb commit 7f58f5f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using System.Xml;

namespace SharpVectors.Dom.Settings
{
public static class GlobalXmlReaderSettingsConfigurator
{
public static XmlReaderSettings XmlReaderSettings { get; set; }
}
}
7 changes: 7 additions & 0 deletions Source/SharpVectorModel/DocumentStructure/SvgDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using SharpVectors.Woffs;
using SharpVectors.Dom.Css;
using SharpVectors.Dom.Resources;
using SharpVectors.Dom.Settings;
using SharpVectors.Dom.Stylesheets;

namespace SharpVectors.Dom.Svg
Expand Down Expand Up @@ -376,10 +377,16 @@ public override bool Supports(string feature, string version)

private XmlReaderSettings GetXmlReaderSettings()
{
if (GlobalXmlReaderSettingsConfigurator.XmlReaderSettings != null)
{
return GlobalXmlReaderSettingsConfigurator.XmlReaderSettings;
}

if (_settings != null)
{
return _settings;
}

DynamicXmlUrlResolver xmlResolver = new DynamicXmlUrlResolver();
xmlResolver.Resolving += OnXmlResolverResolving;
xmlResolver.GettingEntity += OnXmlResolverGettingEntity;
Expand Down

0 comments on commit 7f58f5f

Please sign in to comment.