/// <summary>
 /// Gets the attribute.
 /// </summary>
 /// <param name="reader">
 /// The reader.
 /// </param>
 /// <param name="attribute">
 /// The attribute.
 /// </param>
 /// <returns>
 /// The attribute value if it exists; otherwise null.
 /// </returns>
 public static string GetAttribute(this XmlReader reader, AttributeNameTable attribute)
 {
     return reader.GetAttribute(attribute.FastToString());
 }
 /// <summary>
 /// Write the attribute and it's value
 /// </summary>
 /// <param name="attribute">
 /// The attribute name
 /// </param>
 /// <param name="value">
 /// The attribute value
 /// </param>
 protected void WriteAttribute(AttributeNameTable attribute, bool value)
 {
     this.WriteAttribute(NameTableCache.GetAttributeName(attribute), value);
 }
 /// <summary>
 /// Write an attribute with the specified name and value
 /// </summary>
 /// <param name="name">
 /// Attribute name
 /// </param>
 /// <param name="value">
 /// Attribute value
 /// </param>
 protected void WriteAttributeString(AttributeNameTable name, string value)
 {
     this.WriteAttributeString(NameTableCache.GetAttributeName(name), value);
 }
 /// <summary>
 /// Write the attribute and it's value
 /// </summary>
 /// <param name="attribute">
 /// The attribute name
 /// </param>
 /// <param name="value">
 /// The attribute value
 /// </param>
 protected void TryWriteAttribute(AttributeNameTable attribute, decimal value)
 {
     this.TryWriteAttribute(NameTableCache.GetAttributeName(attribute), value);
 }
 /// <summary>
 /// Write the attribute and it's value
 /// </summary>
 /// <param name="attribute">
 /// The attribute name
 /// </param>
 /// <param name="value">
 /// The attribute value
 /// </param>
 protected void TryWriteAttribute(AttributeNameTable attribute, decimal? value)
 {
     if (value.HasValue)
     {
         this.TryWriteAttribute(attribute, value.Value);
     }
 }
 /// <summary>
 /// Write an attribute with the specified name and value
 /// </summary>
 /// <param name="namespacePrefixPair">
 /// The XML prefix
 /// </param>
 /// <param name="name">
 /// Attribute name
 /// </param>
 /// <param name="value">
 /// Attribute value
 /// </param>
 protected void WriteAttributeString(
     NamespacePrefixPair namespacePrefixPair, AttributeNameTable name, string value)
 {
     this.WriteAttributeString(namespacePrefixPair, NameTableCache.GetAttributeName(name), value);
 }
 /// <summary>
 /// Write the attribute if it's value is not  null
 /// </summary>
 /// <param name="attribute">
 /// The attribute name
 /// </param>
 /// <param name="value">
 /// The attribute value
 /// </param>
 protected void TryWriteAttribute(AttributeNameTable attribute, TertiaryBool value)
 {
     if (value != null)
     {
         this.TryWriteAttribute(NameTableCache.GetAttributeName(attribute), value.EnumType);
     }
 }
 /// <summary>
 /// Checks if the given <paramref name="localName"/> equals to the given <paramref name="attributeName"/>.
 /// </summary>
 /// <param name="localName">
 /// Objectified string containing the current local name
 /// </param>
 /// <param name="attributeName">
 /// The element name to check against
 /// </param>
 /// <returns>
 /// True if the <paramref name="localName"/> is <paramref name="attributeName"/>
 /// </returns>
 public static bool IsAttribute(object localName, AttributeNameTable attributeName)
 {
     return ReferenceEquals(localName, _instance._elementNameCache[(int)attributeName]);
 }
 /// <summary>
 /// Gets the <paramref name="attributeName"/> name string
 /// </summary>
 /// <param name="attributeName">
 /// The element name
 /// </param>
 /// <returns>
 /// The atomized string of the <paramref name="attributeName"/>
 /// </returns>
 public static string GetAttributeName(AttributeNameTable attributeName)
 {
     return (string)_instance._elementNameCache[(int)attributeName];
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GenericDataWriterEngine"/> class.
 /// </summary>
 /// <param name="writer">
 /// The writer.
 /// </param>
 /// <param name="namespaces">
 /// The namespaces.
 /// </param>
 /// <param name="schema">
 /// The schema.
 /// </param>
 public GenericDataWriterEngine(XmlWriter writer, SdmxNamespaces namespaces, SdmxSchema schema)
     : base(writer, namespaces, schema)
 {
     if (this.IsTwoPointOne)
     {
         this._conceptAttribute = AttributeNameTable.id;
         this._writeObservationMethod = this.WriteObservation21;
     }
     else
     {
         this._conceptAttribute = AttributeNameTable.concept;
         this._writeObservationMethod = this.WriteObservation20;
     }
 }
 /// <summary>
 /// Adds the <paramref name="conceptRef"/> to <paramref name="attachList"/> if <paramref name="attribute"/> exists in
 ///     <paramref name="attributes"/> with value <c>true</c>
 /// </summary>
 /// <param name="conceptRef">
 /// The concept ref.
 /// </param>
 /// <param name="attachList">
 /// The attach list.
 /// </param>
 /// <param name="attribute">
 /// The attribute.
 /// </param>
 /// <param name="attributes">
 /// The attributes.
 /// </param>
 private static void AddCrossSectionalAttach(string conceptRef, ICollection<string> attachList, AttributeNameTable attribute, IDictionary<string, string> attributes)
 {
     if (Helper.TrySetFromAttribute(attributes, attribute, false))
     {
         attachList.Add(conceptRef);
     }
 }
 public void TestIsAttribute(string localName, AttributeNameTable element, bool shouldEqual)
 {
     string add = NameTableCache.Instance.NameTable.Add(localName);
     Assert.IsTrue(NameTableCache.IsAttribute(add, element) == shouldEqual);
 }