private void ProcessXsiAttributes(out XmlQualifiedName xsiType, out string xsiNil) {
string[] xsiSchemaLocation = null;
string xsiNoNamespaceSchemaLocation = null;
xsiType = XmlQualifiedName.Empty;
xsiNil = null;
if (reader.Depth == 0) {
//Load schema for empty namespace
LoadSchema(string.Empty, null);
//Should load schemas for namespaces already added to nsManager
foreach(string ns in nsManager.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml).Values) {
LoadSchema(ns, null);
}
}
if (reader.MoveToFirstAttribute()) {
do {
string objectNs = reader.NamespaceURI;
string objectName = reader.LocalName;
if (Ref.Equal(objectNs, NsXmlNs)) {
LoadSchema(reader.Value, null);
if (bManageNamespaces) {
nsManager.AddNamespace(reader.Prefix.Length == 0 ? string.Empty : reader.LocalName, reader.Value);
}
}
else if (Ref.Equal(objectNs, NsXsi)) {
if (Ref.Equal(objectName, XsiSchemaLocation)) {
xsiSchemaLocation = (string[])dtStringArray.ParseValue(reader.Value, NameTable, nsManager);
}
else if (Ref.Equal(objectName, XsiNoNamespaceSchemaLocation)) {
xsiNoNamespaceSchemaLocation = reader.Value;
}
else if (Ref.Equal(objectName, XsiType)) {
xsiType = (XmlQualifiedName)dtQName.ParseValue(reader.Value, NameTable, nsManager);
}
else if (Ref.Equal(objectName, XsiNil)) {
xsiNil = reader.Value;
}
}
} while(reader.MoveToNextAttribute());
reader.MoveToElement();
}
if (xsiNoNamespaceSchemaLocation != null) {
LoadSchema(string.Empty, xsiNoNamespaceSchemaLocation);
}
if (xsiSchemaLocation != null) {
for (int i = 0; i < xsiSchemaLocation.Length - 1; i += 2) {
LoadSchema((string)xsiSchemaLocation[i], (string)xsiSchemaLocation[i + 1]);
}
}
}