void ReadAttributeMembers(ClassMap map, object ob, bool isValueList)
{
XmlTypeMapMember anyAttrMember = map.DefaultAnyAttributeMember;
int anyAttributeIndex = 0;
object anyAttributeArray = null;
while (Reader.MoveToNextAttribute())
{
XmlTypeMapMemberAttribute member = map.GetAttribute(Reader.LocalName, Reader.NamespaceURI);
if (member != null)
{
SetMemberValue(member, ob, GetValueFromXmlString(Reader.Value, member.TypeData, member.MappedType), isValueList);
}
else if (IsXmlnsAttribute(Reader.Name))
{
// If the map has NamespaceDeclarations,
// then store this xmlns to the given member.
// If the instance doesn't exist, then create.
if (map.NamespaceDeclarations != null)
{
XmlSerializerNamespaces nss = this.GetMemberValue(map.NamespaceDeclarations, ob, isValueList) as XmlSerializerNamespaces;
if (nss == null)
{
nss = new XmlSerializerNamespaces();
SetMemberValue(map.NamespaceDeclarations, ob, nss, isValueList);
}
if (Reader.Prefix == "xmlns")
{
nss.Add(Reader.LocalName, Reader.Value);
}
else
{
nss.Add("", Reader.Value);
}
}
}
#if !MOONLIGHT
else if (anyAttrMember != null)
{
XmlAttribute attr = (XmlAttribute)Document.ReadNode(Reader);
ParseWsdlArrayType(attr);
AddListValue(anyAttrMember.TypeData, ref anyAttributeArray, anyAttributeIndex++, attr, true);
}
else
{
ProcessUnknownAttribute(ob);
}
#endif
}
#if !MOONLIGHT
if (anyAttrMember != null)
{
anyAttributeArray = ShrinkArray((Array)anyAttributeArray, anyAttributeIndex, anyAttrMember.TypeData.Type.GetElementType(), true);
SetMemberValue(anyAttrMember, ob, anyAttributeArray, isValueList);
}
#endif
Reader.MoveToElement();
}