private void LoadAttributes()
        {
            Debug.Assert(_xmlReader != null);

            _attributeList.Clear();
            _nsDecls.Clear();

            // read attributes
            if (_xmlReader.HasAttributes)
            {
                while (_xmlReader.MoveToNextAttribute())
                {
                    if (_xmlReader.Prefix == OpenXmlElementContext.xmlnsPrefix)
                    {
                        _nsDecls.Add(new KeyValuePair <string, string>(_xmlReader.LocalName, _xmlReader.Value));
                    }
                    else
                    {
                        OpenXmlAttribute attribute = new OpenXmlAttribute(_xmlReader.Prefix, _xmlReader.LocalName, _xmlReader.NamespaceURI, _xmlReader.Value);
                        _attributeList.Add(attribute);
                    }
                }

                //  Moves the reader back to the element node.
                _xmlReader.MoveToElement();
            }
        }
 /// <summary>
 /// Get attribute value of the specified attribute.
 /// </summary>
 /// <param name="element"></param>
 /// <param name="localName"></param>
 /// <param name="namespaceUri"></param>
 /// <returns></returns>
 internal static string GetAttributeValueEx(this OpenXmlElement element, string localName, string namespaceUri)
 {
     try
     {
         OpenXmlAttribute attribute = element.GetAttribute(localName, namespaceUri);
         return(attribute.Value);
     }
     catch (KeyNotFoundException)
     {
         return(null);
     }
 }