Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit af05baba authored by Markus QUARITSCH's avatar Markus QUARITSCH
Browse files

Merge branch 'feature/VECTO-1410-jrc-fix' into feature/VECTO-1410_IVT-multistage-tool-buses

parents 554506fc b3413414
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,7 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.VehicleInformationF
private XElement _primaryVehicle;
private List<XElement> _manufacturingStages;
private List<XAttribute> _namespaceAttributes;
private HashSet<XAttribute> _namespaceAttributes;
private IPrimaryVehicleInformationInputDataProvider _primaryVehicleInputData;
private IList<IManufacturingStageInputData> _manufacturingStageInputData;
......@@ -79,7 +79,7 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.VehicleInformationF
public XMLMultistageBusReport()
{
_manufacturingStages = new List<XElement>();
_namespaceAttributes = new List<XAttribute>();
_namespaceAttributes = new HashSet<XAttribute>(new XAttributeEqualityComparer());
}
public virtual void Initialize(VectoRunData modelData)
......@@ -174,11 +174,12 @@ namespace TUGraz.VectoCore.OutputData.XML.DeclarationReports.VehicleInformationF
public virtual void GenerateReport()
{
_namespaceAttributes.Add(new XAttribute(XNamespace.Xmlns + "tns", tns));
var retVal = new XDocument();
retVal.Add(
new XElement(tns + XMLNames.VectoOutputMultistep,
_namespaceAttributes,
new XAttribute(XNamespace.Xmlns + "tns", tns),
//new XAttribute(XNamespace.Xmlns + "tns", tns),
_primaryVehicle,
_manufacturingStages,
GenerateInputManufacturingStage()
......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace TUGraz.VectoCore.Utils
{
public class XAttributeEqualityComparer : IEqualityComparer<XAttribute>
{
public bool Equals(XAttribute x, XAttribute y)
{
if (ReferenceEquals(x, y))
return true;
if (ReferenceEquals(x, null))
return false;
if (ReferenceEquals(y, null))
return false;
if (x.GetType() != y.GetType())
return false;
return x.IsNamespaceDeclaration == y.IsNamespaceDeclaration && x.Name.Equals(y.Name) && x.NodeType == y.NodeType && x.Value == y.Value;
}
public int GetHashCode(XAttribute obj)
{
unchecked
{
var hashCode = obj.IsNamespaceDeclaration.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Name.GetHashCode();
hashCode = (hashCode * 397) ^ (int)obj.NodeType;
hashCode = (hashCode * 397) ^ obj.Value.GetHashCode();
return hashCode;
}
}
}
}
......@@ -761,6 +761,7 @@
<DesignTime>True</DesignTime>
<DependentUpon>VectoVersionCore.tt</DependentUpon>
</Compile>
<Compile Include="Utils\XAttributeEqualityComparer.cs" />
<Compile Include="Utils\XMLDefinitions.cs" />
<Compile Include="Utils\XMLHelper.cs" />
<Compile Include="Utils\XmlResourceResolver.cs" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment