public Tag GetTag(XName name) { try { Type type; if (RegisteredItems.TryGetValue(name, out type)) { // Try doc and qname constructor ConstructorInfo ctorName = GetConstructor(type, new Type[] { name.GetType() }); if (ctorName != null) { return(ctorName.Invoke(new object[] { name }) as Tag); } // Try empty constructor ConstructorInfo ctorDefault = GetConstructor(type, new Type[] { }); if (ctorDefault != null) { return(ctorDefault.Invoke(new object[] { }) as Tag); } } return(null); } catch { return(null); } }