Skip to content

Commit

Permalink
Merge pull request #219 from dotnetprojects/bom
Browse files Browse the repository at this point in the history
TiaGitHandler - add additional namespace for delete date attribute an…
  • Loading branch information
jogibear9988 authored Sep 28, 2024
2 parents ebdacff + b1c34db commit ca881a2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion TiaGitHandler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public static void ConvertPlcAlarmTextListXlsxToCsv(string sourceFile, string ta
var maxColumnNumber = worksheet.Dimension.End.Column;
var totalRowCount = worksheet.Dimension.End.Row;

using (var writer = new StreamWriter(targetFile, false, Encoding.UTF8))
using (var writer = new StreamWriter(targetFile, false, new UTF8Encoding(false)))
{
for (int row = 1; row <= totalRowCount; row++)
{
Expand Down Expand Up @@ -401,6 +401,7 @@ private static void ParseFolder(ProjectFolder folder, string dir, List<string> s
ns.AddNamespace("smns3", "http://www.siemens.com/automation/Openness/SW/NetworkSource/StatementList/v3");
ns.AddNamespace("smns4", "http://www.siemens.com/automation/Openness/SW/NetworkSource/StructuredText/v2");
ns.AddNamespace("smns5", "http://www.siemens.com/automation/Openness/SW/NetworkSource/StructuredText/v4");
ns.AddNamespace("smns6", "http://www.siemens.com/automation/Openness/SW/NetworkSource/StatementList/v5");

try
{
Expand Down Expand Up @@ -552,6 +553,18 @@ private static void ParseFolder(ProjectFolder folder, string dir, List<string> s
{
}

try
{
var nodes = xmlDoc.SelectNodes("//smns6:DateAttribute[@Name='ParameterModifiedTS']", ns);
foreach (var node in nodes.Cast<XmlNode>())
{
node.ParentNode.RemoveChild(node);
}
}
catch
{
}

//try
//{
// var nodes = xmlDoc.SelectNodes("//smns:Address[@Area='None' and @Informative='true']", ns);
Expand Down

0 comments on commit ca881a2

Please sign in to comment.