Skip to content

Commit 3a1e840

Browse files
laxmi-lal-menariamilkshakeuk
authored andcommitted
Moved IncludeLongNameInEncodedXml to ParserOptions
Moved IncludeLongNameInEncodedXml to ParserOptions, instead of public property.
1 parent ee1d56c commit 3a1e840

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

src/NHapi.Base/Parser/DefaultXMLParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public DefaultXMLParser(IModelClassFactory modelClassFactory)
4646

4747
/// <summary>Test harness. </summary>
4848
[STAThread]
49-
public static new void Main(string[] args)
49+
public new static void Main(string[] args)
5050
{
5151
if (args.Length != 1)
5252
{

src/NHapi.Base/Parser/ParserOptions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public ParserOptions()
1212
InvalidObx2Type = null;
1313
UnexpectedSegmentBehaviour = UnexpectedSegmentBehaviour.AddInline;
1414
NonGreedyMode = false;
15+
IncludeLongNameInEncodedXml = false;
1516
DisableWhitespaceTrimmingOnAllXmlNodes = false;
1617
XmlNodeNamesToDisableWhitespaceTrimming = new HashSet<string>(StringComparer.Ordinal);
1718
PrettyPrintEncodedXml = true;
@@ -129,6 +130,9 @@ public ParserOptions()
129130
/// </example>
130131
public bool NonGreedyMode { get; set; }
131132

133+
/// <summary> _includeLongNameInEncodedXML.</summary>
134+
public bool IncludeLongNameInEncodedXml { get; set; }
135+
132136
/// <summary>
133137
/// <para>
134138
/// If set to <see langword="true"/>, the <see cref="XMLParser"/> is configured to treat all whitespace

src/NHapi.Base/Parser/XMLParser.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ public abstract class XMLParser : ParserBase
6161

6262
private static readonly Regex NameSpaceRegex = new Regex(@$"xmlns(.*)=""{NameSpace}""", RegexOptions.Compiled);
6363
64-
/// <summary> _includeLongNameInEncodedXML.</summary>
65-
private bool _includeLongNameInEncodedXML;
66-
6764
protected XMLParser()
6865
{
6966
}
@@ -73,12 +70,6 @@ protected XMLParser(IModelClassFactory factory)
7370
{
7471
}
7572
76-
public bool IncludeLongNameInEncodedXML
77-
{
78-
get { return _includeLongNameInEncodedXML; }
79-
set { _includeLongNameInEncodedXML = value; }
80-
}
81-
8273
/// <summary>
8374
/// Gets the preferred encoding of this Parser.
8475
/// </summary>
@@ -380,7 +371,7 @@ public virtual bool Encode(ISegment segmentObject, XmlElement segmentElement, Pa
380371
continue;
381372
}
382373

383-
if (_includeLongNameInEncodedXML && reps[j] is AbstractType rep)
374+
if (parserOptions.IncludeLongNameInEncodedXml && reps[j] is AbstractType rep)
384375
{
385376
newNode.SetAttribute("LongName", rep.Description);
386377
}
@@ -880,7 +871,7 @@ private bool EncodeComposite(IComposite datatypeObject, XmlElement datatypeEleme
880871
continue;
881872
}
882873

883-
if (_includeLongNameInEncodedXML && components[i] is AbstractType component)
874+
if (parserOptions.IncludeLongNameInEncodedXml && components[i] is AbstractType component)
884875
{
885876
newNode.SetAttribute("LongName", component.Description);
886877
}

0 commit comments

Comments
 (0)