当前位置: 首页>>代码示例>>C#>>正文


C# IHeader.GetAdditionalAttribtue方法代码示例

本文整理汇总了C#中IHeader.GetAdditionalAttribtue方法的典型用法代码示例。如果您正苦于以下问题:C# IHeader.GetAdditionalAttribtue方法的具体用法?C# IHeader.GetAdditionalAttribtue怎么用?C# IHeader.GetAdditionalAttribtue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IHeader的用法示例。


在下文中一共展示了IHeader.GetAdditionalAttribtue方法的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();
//.........这里部分代码省略.........
开发者ID:alcardac,项目名称:SDMXRI_WS_OF,代码行数:101,代码来源:HeaderWriter.cs


注:本文中的IHeader.GetAdditionalAttribtue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。