private void ProcessAttributes(Element element) { TypeBrowser browser = TypeBrowser.Create(element.GetType()); while (_reader.MoveToNextAttribute()) { // Check for namespaces first if (string.Equals("xmlns", _reader.Name, StringComparison.Ordinal)) { // Set default namespace only on unknown elements if (element is UnknownElement) { element.Namespaces.AddNamespace(string.Empty, _reader.Value); } } else if (string.Equals("xmlns", _reader.Prefix, StringComparison.Ordinal)) { element.Namespaces.AddNamespace(_reader.LocalName, _reader.Value); } else // just a normal attribute { PropertyInfo property = browser.FindAttribute(new XmlComponent(null, _reader.LocalName, null)); // Attributes never have namespace info. if (property != null) { AssignValue(element, property, _reader.Value); } else { // Unknown, save for later serialization element.AddAttribute(new XmlComponent(_reader)); } } } }