本文整理汇总了C#中IHeader.HasAdditionalAttribtue方法的典型用法代码示例。如果您正苦于以下问题:C# IHeader.HasAdditionalAttribtue方法的具体用法?C# IHeader.HasAdditionalAttribtue怎么用?C# IHeader.HasAdditionalAttribtue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHeader
的用法示例。
在下文中一共展示了IHeader.HasAdditionalAttribtue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteHeader
/// <summary>
/// This is the main method of the class that writes the <see cref="IHeader"/>
/// The methods write the xml Header tag and add it's attributes.
/// </summary>
/// <param name="header">
/// The <see cref="IHeader"/> object containing the header data to be written
/// </param>
/// <param name="dimensionAtObservation">
/// The dimension At Observation.
/// </param>
/// <param name="dataStructureObjects">
/// The data Structure Objects.
/// </param>
public void WriteHeader(
IHeader header, string dimensionAtObservation, params IDataStructureObject[] dataStructureObjects)
{
IHeader providedHeader = header;
SdmxSchemaEnumType sdmxSchema = this.TargetSchema.EnumType;
// TODO split to v2 and v2.1 to reduce complexity and more readable
if (header == null)
{
header = this._retrievalManager != null ? this._retrievalManager.Header : new HeaderImpl(string.Format("IDREF{0}", DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture)), DefaultSenderId);
}
// start header
this.WriteStartElement(this.Namespaces.Message, ElementNameTable.Header);
// id
this.TryToWriteElement(this.Namespaces.Message, ElementNameTable.ID, header.Id);
// test
this.WriteElement(this.Namespaces.Message, ElementNameTable.Test, header.Test);
// only for (2.0)
if (sdmxSchema != SdmxSchemaEnumType.VersionTwoPointOne)
{
// truncated (2.0)
string elementName = NameTableCache.GetElementName(ElementNameTable.Truncated);
bool isTruncated = header.HasAdditionalAttribtue(elementName)
&& bool.TrueString.Equals(header.GetAdditionalAttribtue(elementName));
this.TryToWriteElement(this.Namespaces.Message, ElementNameTable.Truncated, isTruncated);
// names (2.0)
this.WriteTextType(this.Namespaces.Message, header.Name, ElementNameTable.Name);
}
// prepared
DateTime prepared = header.Prepared.HasValue ? header.Prepared.Value : DateTime.Now;
this.TryToWriteElement(this.Namespaces.Message, ElementNameTable.Prepared, DateUtil.FormatDate(prepared));
// sender TODO ensure/check that Sender cannot be null
this.WritePartyType(header.Sender, ElementNameTable.Sender);
// receiver TODO ensure/check that Receiver cannot be null
foreach (IParty text in header.Receiver)
{
this.WritePartyType(text, ElementNameTable.Receiver);
}
// only for 2.1
if (sdmxSchema == SdmxSchemaEnumType.VersionTwoPointOne)
{
// names (2.1)
this.WriteTextType(this.Namespaces.Common, header.Name, ElementNameTable.Name);
// structures (2.1)
foreach (IDataStructureObject datasetStructure in dataStructureObjects)
{
// start structure (message ns)
this.WriteStartElement(this.Namespaces.Message, ElementNameTable.Structure);
// write structureId attribute
this.WriteAttributeString(AttributeNameTable.structureID, GetRef(datasetStructure));
// structure specific namespace attribute
if (this.Namespaces.DataSetStructureSpecific != null)
{
this.WriteAttributeString(
[email protected], this.Namespaces.DataSetStructureSpecific.NS);
}
// dimension at observation attribute
string dimensionAtObs = dimensionAtObservation ?? DimensionObject.TimeDimensionFixedId;
this.WriteAttributeString(AttributeNameTable.dimensionAtObservation, dimensionAtObs);
// start structure (common ns)
this.WriteStartElement(this.Namespaces.Common, ElementNameTable.Structure);
// start Ref
this.WriteStartElement(ElementNameTable.Ref);
this.WriteAttributeString(AttributeNameTable.agencyID, datasetStructure.AgencyId);
this.WriteAttributeString(AttributeNameTable.id, datasetStructure.Id);
this.WriteAttributeString(AttributeNameTable.version, datasetStructure.Version);
// end Ref
this.WriteEndElement();
// end structure (common ns)
this.WriteEndElement();
//.........这里部分代码省略.........