else
WriteLine ("return ReadXmlNode (false);");
} else {
- WriteLineInd ("if (Reader.LocalName != " + GetLiteral (typeMap.ElementName) + " || Reader.NamespaceURI != " + GetLiteral (typeMap.Namespace) + ")");
- WriteLine ("throw CreateUnknownNodeException();");
- Unindent ();
+ if (!typeMap.IsAny) {
+ WriteLineInd ("if (Reader.LocalName != " + GetLiteral (typeMap.ElementName) + " || Reader.NamespaceURI != " + GetLiteral (typeMap.Namespace) + ")");
+ WriteLine ("throw CreateUnknownNodeException();");
+ Unindent ();
+ }
WriteLine ("return " + GetReadObjectCall (typeMap, GetLiteral(typeMap.IsNullable), "true") + ";");
}
WriteLine ("Reader.MoveToContent();");
WriteLine ("if (Reader.NodeType == System.Xml.XmlNodeType.Element) ");
WriteLineInd ("{");
- WriteLineInd ("if (Reader.LocalName == " + GetLiteral(typeMap.ElementName) + " && Reader.NamespaceURI == " + GetLiteral (typeMap.Namespace) + ")");
+ if (!typeMap.IsAny)
+ WriteLineInd ("if (Reader.LocalName == " + GetLiteral(typeMap.ElementName) + " && Reader.NamespaceURI == " + GetLiteral (typeMap.Namespace) + ")");
WriteLine ("ob = ReadReferencedElement();");
Unindent ();
- WriteLineInd ("else ");
- WriteLine ("throw CreateUnknownNodeException();");
- Unindent ();
+ if (!typeMap.IsAny) {
+ WriteLineInd ("else ");
+ WriteLine ("throw CreateUnknownNodeException();");
+ Unindent ();
+ }
WriteLineUni ("}");
WriteLineInd ("else ");
WriteLine ("UnknownNode(null);");
WriteLine ("Reader.MoveToContent ();");
WriteLine ("if (Reader.NodeType == XmlNodeType.Element)");
WriteLineInd ("{");
- WriteLine ("if (Reader.LocalName == " + GetLiteral (typeMap.ElementName) + " && Reader.NamespaceURI == " + GetLiteral (typeMap.Namespace) + ")");
+ if (!typeMap.IsAny)
+ WriteLineInd ("if (Reader.LocalName == " + GetLiteral (typeMap.ElementName) + " && Reader.NamespaceURI == " + GetLiteral (typeMap.Namespace) + ")");
WriteLine (String.Format ("\treturn ({0}) ReadSerializable (({0}) Activator.CreateInstance(typeof({0}), true));", typeMap.TypeData.CSharpFullName));
- WriteLine ("else");
- WriteLine ("\tthrow CreateUnknownNodeException ();");
+ Unindent ();
+ if (!typeMap.IsAny) {
+ WriteLine ("else");
+ WriteLine ("\tthrow CreateUnknownNodeException ();");
+ }
WriteLineUni ("}");
WriteLine ("else UnknownNode (null);");
WriteLine ("");