//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version: 1.1.4322.573 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ // The following code was generated automatically by use of the Object Model Generator. // If you feel this tool has helped you in any way or there are bugs to notify me of, // please let me know at ovanklot@gmx.net or http://weblogs.asp.net/OKloeten/. // // Omer van Kloeten namespace ObjectModelGenerator { // TODO: Complete Summary tag documentation. /// Represents the NotSoSimpleSchema element. public class NotSoSimpleSchemaElement : object, IXmlElement, System.ICloneable { /// This field holds the collection of objects. private LibraryCollection m_Librarys; /// Represents the referencing name for the inner text of the element. public const string ElementTextName = "#text"; /// Represents the inner text of the element. private string m_Text; /// Represents the referencing name for the element. public const string ElementName = "NotSoSimpleSchema"; /// This is the default constructor. public NotSoSimpleSchemaElement() { this.m_Librarys = this.CreateLibraryCollection(); } /// This constructor is used to deserialize the element from XML DOM. protected internal NotSoSimpleSchemaElement(System.Xml.XmlElement element) { if ((element.Name != ElementName)) { throw new System.ApplicationException("Invalid element initialization."); } this.m_Librarys = new LibraryCollection(element, this); if ((element.Attributes[ElementTextName] != null)) { this.m_Text = element.Attributes[ElementTextName].Value; } } /// Gets the collection of objects. public LibraryCollection Librarys { get { return this.m_Librarys; } } // TODO: Complete Summary tag documentation. /// Represents the inner text of the element. public string Text { get { return this.m_Text; } set { if ((this.m_Text != value)) { this.m_Text = value; this.OnTextChanged(System.EventArgs.Empty); } } } /// Raised when the element's inner text is changed. public event System.EventHandler TextChanged; protected virtual LibraryCollection CreateLibraryCollection() { return new LibraryCollection(this); } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator ==(NotSoSimpleSchemaElement left, NotSoSimpleSchemaElement right) { return (((((object)(left)) == null) && (((object)(right)) == null)) || ((((object)(left)) != null) && (left.Equals(right) == true))); } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator !=(NotSoSimpleSchemaElement left, NotSoSimpleSchemaElement right) { return ((left == right) == false); } /// Raises the event. protected void OnTextChanged(System.EventArgs e) { if ((this.TextChanged != null)) { this.TextChanged(this, e); } } /// Serves as a hash function for the type, suitable for use in hashing algorithms and data structures like a hash table. public override int GetHashCode() { return base.GetHashCode(); } /// Compares two instances of an element of type . /// This does not support checking for equality for untyped attributes. public override bool Equals(object obj) { return ((((obj != null) && (obj.GetType() == typeof(NotSoSimpleSchemaElement))) && (this.m_Librarys == ((NotSoSimpleSchemaElement)(obj)).m_Librarys)) && (this.m_Text == ((NotSoSimpleSchemaElement)(obj)).m_Text)); } /// This method is used to serialize the element to XML DOM. System.Xml.XmlElement IXmlElement.GetXml(System.Xml.XmlDocument document) { System.Xml.XmlElement element = document.CreateElement(ElementName); System.Xml.XmlElement[] librarys = ((IXmlElementCollection)(this.Librarys)).GetXml(document); for (int index = 0; (index < librarys.Length); index = (index + 1)) { element.AppendChild(librarys[index]); } if (((this.m_Text != null) && (this.m_Text != string.Empty))) { element.AppendChild(document.CreateTextNode(this.m_Text)); } return element; } /// This method is used to to clone the element. public object Clone() { NotSoSimpleSchemaElement clone = new NotSoSimpleSchemaElement(); clone.m_Librarys = ((LibraryCollection)(this.m_Librarys.Clone())); clone.m_Librarys.SetParentNotSoSimpleSchemaElement(clone); return clone; } // TODO: Complete Summary tag documentation. /// Represents the Library element. public class LibraryElement : object, IXmlElement, System.ICloneable { /// This field holds the object in this object. private LibrarianElement m_Librarian; /// This field holds the object in this object. private StudentElement m_Student; /// This field holds the object in this object. private BookElement m_Book; /// Represents the referencing name for the inner text of the element. public const string ElementTextName = "#text"; /// Represents the inner text of the element. private string m_Text; /// Represents the referencing name for the element. public const string ElementName = "Library"; /// Represents the parent for this element. private NotSoSimpleSchemaElement m_ParentNotSoSimpleSchemaElement; /// This is the default constructor. public LibraryElement() { } /// This constructor is used to deserialize the element from XML DOM. protected internal LibraryElement(System.Xml.XmlElement element) { if ((element.Name != ElementName)) { throw new System.ApplicationException("Invalid element initialization."); } if ((element[LibrarianElement.ElementName] != null)) { this.Librarian = new LibrarianElement(element[LibrarianElement.ElementName]); } if ((element[StudentElement.ElementName] != null)) { this.Student = new StudentElement(element[StudentElement.ElementName]); } if ((element[BookElement.ElementName] != null)) { this.Book = new BookElement(element[BookElement.ElementName]); } if ((element.Attributes[ElementTextName] != null)) { this.m_Text = element.Attributes[ElementTextName].Value; } } /// Gets the object contained in this object. public LibrarianElement Librarian { get { return this.m_Librarian; } set { this.m_Librarian = value; } } /// Gets the object contained in this object. public StudentElement Student { get { return this.m_Student; } set { this.m_Student = value; } } /// Gets the object contained in this object. public BookElement Book { get { return this.m_Book; } set { this.m_Book = value; } } // TODO: Complete Summary tag documentation. /// Represents the inner text of the element. public string Text { get { return this.m_Text; } set { if ((this.m_Text != value)) { this.m_Text = value; this.OnTextChanged(System.EventArgs.Empty); } } } /// Gets the parent for this element. public NotSoSimpleSchemaElement ParentNotSoSimpleSchemaElement { get { return this.m_ParentNotSoSimpleSchemaElement; } } /// Raised when the element's inner text is changed. public event System.EventHandler TextChanged; /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator ==(LibraryElement left, LibraryElement right) { return (((((object)(left)) == null) && (((object)(right)) == null)) || ((((object)(left)) != null) && (left.Equals(right) == true))); } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator !=(LibraryElement left, LibraryElement right) { return ((left == right) == false); } /// Raises the event. protected void OnTextChanged(System.EventArgs e) { if ((this.TextChanged != null)) { this.TextChanged(this, e); } } /// Serves as a hash function for the type, suitable for use in hashing algorithms and data structures like a hash table. public override int GetHashCode() { return base.GetHashCode(); } /// Compares two instances of an element of type . /// This does not support checking for equality for untyped attributes. public override bool Equals(object obj) { return ((((obj != null) && (obj.GetType() == typeof(LibraryElement))) && (((this.m_Librarian == ((LibraryElement)(obj)).m_Librarian) && (this.m_Student == ((LibraryElement)(obj)).m_Student)) && (this.m_Book == ((LibraryElement)(obj)).m_Book))) && (this.m_Text == ((LibraryElement)(obj)).m_Text)); } /// This method is used to serialize the element to XML DOM. System.Xml.XmlElement IXmlElement.GetXml(System.Xml.XmlDocument document) { System.Xml.XmlElement element = document.CreateElement(ElementName); if ((this.Librarian != null)) { element.AppendChild(((IXmlElement)(this.Librarian)).GetXml(document)); } if ((this.Student != null)) { element.AppendChild(((IXmlElement)(this.Student)).GetXml(document)); } if ((this.Book != null)) { element.AppendChild(((IXmlElement)(this.Book)).GetXml(document)); } if (((this.m_Text != null) && (this.m_Text != string.Empty))) { element.AppendChild(document.CreateTextNode(this.m_Text)); } return element; } /// This method is used to to clone the element. public object Clone() { LibraryElement clone = new LibraryElement(); if ((this.m_Librarian != null)) { clone.m_Librarian = ((LibrarianElement)(this.m_Librarian.Clone())); } if ((this.m_Student != null)) { clone.m_Student = ((StudentElement)(this.m_Student.Clone())); } if ((this.m_Book != null)) { clone.m_Book = ((BookElement)(this.m_Book.Clone())); } return clone; } /// Sets a value for the parent for this element. protected internal void SetParentNotSoSimpleSchemaElement(NotSoSimpleSchemaElement value) { this.m_ParentNotSoSimpleSchemaElement = value; } // TODO: Complete Summary tag documentation. /// Represents the Librarian element. public class LibrarianElement : object, IXmlElement, System.ICloneable { /// This field is used to create the Id attribute/simple element. private string m_Id; /// Represents the referencing name for Id. public const string IdName = "Id"; /// This field is used to create the FirstName attribute/simple element. private string m_FirstName; /// Represents the referencing name for FirstName. public const string FirstNameName = "FirstName"; /// This field is used to create the LastName attribute/simple element. private string m_LastName; /// Represents the referencing name for LastName. public const string LastNameName = "LastName"; /// Represents the referencing name for the inner text of the element. public const string ElementTextName = "#text"; /// Represents the inner text of the element. private string m_Text; /// Represents the referencing name for the element. public const string ElementName = "Librarian"; /// Represents the parent for this element. private LibraryElement m_ParentLibraryElement; /// This is the default constructor. public LibrarianElement() { } /// This constructor is used to deserialize the element from XML DOM. protected internal LibrarianElement(System.Xml.XmlElement element) { if ((element.Name != ElementName)) { throw new System.ApplicationException("Invalid element initialization."); } if ((element[ElementName] != null)) { this.Id = ((string)(System.Convert.ChangeType(element[ElementName].Value, typeof(string)))); } if ((element[ElementName] != null)) { this.FirstName = ((string)(System.Convert.ChangeType(element[ElementName].Value, typeof(string)))); } if ((element[ElementName] != null)) { this.LastName = ((string)(System.Convert.ChangeType(element[ElementName].Value, typeof(string)))); } if ((element.Attributes[ElementTextName] != null)) { this.m_Text = element.Attributes[ElementTextName].Value; } } // TODO: Complete Summary tag documentation. /// Represents the Id attribute/simple element for this element. public string Id { get { return this.m_Id; } set { if ((this.m_Id != value)) { this.m_Id = value; this.OnIdChanged(System.EventArgs.Empty); } } } // TODO: Complete Summary tag documentation. /// Represents the FirstName attribute/simple element for this element. public string FirstName { get { return this.m_FirstName; } set { if ((this.m_FirstName != value)) { this.m_FirstName = value; this.OnFirstNameChanged(System.EventArgs.Empty); } } } // TODO: Complete Summary tag documentation. /// Represents the LastName attribute/simple element for this element. public string LastName { get { return this.m_LastName; } set { if ((this.m_LastName != value)) { this.m_LastName = value; this.OnLastNameChanged(System.EventArgs.Empty); } } } // TODO: Complete Summary tag documentation. /// Represents the inner text of the element. public string Text { get { return this.m_Text; } set { if ((this.m_Text != value)) { this.m_Text = value; this.OnTextChanged(System.EventArgs.Empty); } } } /// Gets the parent for this element. public LibraryElement ParentLibraryElement { get { return this.m_ParentLibraryElement; } } /// Raised when the property is changed. public event System.EventHandler IdChanged; /// Raised when the property is changed. public event System.EventHandler FirstNameChanged; /// Raised when the property is changed. public event System.EventHandler LastNameChanged; /// Raised when the element's inner text is changed. public event System.EventHandler TextChanged; /// Raises the event. protected virtual void OnIdChanged(System.EventArgs e) { if ((this.IdChanged != null)) { this.IdChanged(this, e); } } /// Raises the event. protected virtual void OnFirstNameChanged(System.EventArgs e) { if ((this.FirstNameChanged != null)) { this.FirstNameChanged(this, e); } } /// Raises the event. protected virtual void OnLastNameChanged(System.EventArgs e) { if ((this.LastNameChanged != null)) { this.LastNameChanged(this, e); } } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator ==(LibrarianElement left, LibrarianElement right) { return (((((object)(left)) == null) && (((object)(right)) == null)) || ((((object)(left)) != null) && (left.Equals(right) == true))); } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator !=(LibrarianElement left, LibrarianElement right) { return ((left == right) == false); } /// Raises the event. protected void OnTextChanged(System.EventArgs e) { if ((this.TextChanged != null)) { this.TextChanged(this, e); } } /// Serves as a hash function for the type, suitable for use in hashing algorithms and data structures like a hash table. public override int GetHashCode() { return base.GetHashCode(); } /// Compares two instances of an element of type . /// This does not support checking for equality for untyped attributes. public override bool Equals(object obj) { return ((((obj != null) && (obj.GetType() == typeof(LibrarianElement))) && (((this.m_Id == ((LibrarianElement)(obj)).m_Id) && (this.m_FirstName == ((LibrarianElement)(obj)).m_FirstName)) && (this.m_LastName == ((LibrarianElement)(obj)).m_LastName))) && (this.m_Text == ((LibrarianElement)(obj)).m_Text)); } /// This method is used to serialize the element to XML DOM. System.Xml.XmlElement IXmlElement.GetXml(System.Xml.XmlDocument document) { System.Xml.XmlElement element = document.CreateElement(ElementName); if ((this.Id != null)) { System.Xml.XmlElement elmId = document.CreateElement(ElementName); elmId.Value = this.Id.ToString(); element.AppendChild(elmId); } if ((this.FirstName != null)) { System.Xml.XmlElement elmFirstName = document.CreateElement(ElementName); elmFirstName.Value = this.FirstName.ToString(); element.AppendChild(elmFirstName); } if ((this.LastName != null)) { System.Xml.XmlElement elmLastName = document.CreateElement(ElementName); elmLastName.Value = this.LastName.ToString(); element.AppendChild(elmLastName); } if (((this.m_Text != null) && (this.m_Text != string.Empty))) { element.AppendChild(document.CreateTextNode(this.m_Text)); } return element; } /// This method is used to to clone the element. public object Clone() { LibrarianElement clone = new LibrarianElement(); clone.m_Id = this.m_Id; clone.m_FirstName = this.m_FirstName; clone.m_LastName = this.m_LastName; return clone; } /// Sets a value for the parent for this element. protected internal void SetParentLibraryElement(LibraryElement value) { this.m_ParentLibraryElement = value; } } // TODO: Complete Summary tag documentation. /// Represents the Student element. public class StudentElement : object, IXmlElement, System.ICloneable { /// This field holds the object in this object. private BookInHandElement m_BookInHand; /// This field holds the object in this object. private ShushElement m_Shush; /// This field is used to create the FirstName attribute/simple element. private string m_FirstName; /// Represents the referencing name for FirstName. public const string FirstNameName = "FirstName"; /// This field is used to create the LastName attribute/simple element. private string m_LastName; /// Represents the referencing name for LastName. public const string LastNameName = "LastName"; /// This field is used to create the HoursOfStudy attribute/simple element. private System.Decimal m_HoursOfStudy; /// Represents the referencing name for HoursOfStudy. public const string HoursOfStudyName = "HoursOfStudy"; /// Holds the null status for the value type of the HoursOfStudy attribute/simple element. private bool m_IsHoursOfStudyNull = true; /// Represents the referencing name for the inner text of the element. public const string ElementTextName = "#text"; /// Represents the inner text of the element. private string m_Text; /// Represents the referencing name for the element. public const string ElementName = "Student"; /// Represents the parent for this element. private LibraryElement m_ParentLibraryElement; /// This is the default constructor. public StudentElement() { } /// This constructor is used to deserialize the element from XML DOM. protected internal StudentElement(System.Xml.XmlElement element) { if ((element.Name != ElementName)) { throw new System.ApplicationException("Invalid element initialization."); } if ((element[BookInHandElement.ElementName] != null)) { this.BookInHand = new BookInHandElement(element[BookInHandElement.ElementName]); } if ((element[ShushElement.ElementName] != null)) { this.Shush = new ShushElement(element[ShushElement.ElementName]); } if ((element.Attributes[FirstNameName] != null)) { this.FirstName = ((string)(System.Convert.ChangeType(element.Attributes[FirstNameName].Value, typeof(string)))); } if ((element.Attributes[LastNameName] != null)) { this.LastName = ((string)(System.Convert.ChangeType(element.Attributes[LastNameName].Value, typeof(string)))); } if ((element.Attributes[HoursOfStudyName] != null)) { this.HoursOfStudy = ((System.Decimal)(System.Convert.ChangeType(element.Attributes[HoursOfStudyName].Value, typeof(System.Decimal)))); } else { this.SetHoursOfStudyNull(); } if ((element.Attributes[ElementTextName] != null)) { this.m_Text = element.Attributes[ElementTextName].Value; } } /// Gets the object contained in this object. public BookInHandElement BookInHand { get { return this.m_BookInHand; } set { this.m_BookInHand = value; } } /// Gets the object contained in this object. public ShushElement Shush { get { return this.m_Shush; } set { this.m_Shush = value; } } // TODO: Complete Summary tag documentation. /// Represents the FirstName attribute/simple element for this element. public string FirstName { get { return this.m_FirstName; } set { if ((this.m_FirstName != value)) { this.m_FirstName = value; this.OnFirstNameChanged(System.EventArgs.Empty); } } } // TODO: Complete Summary tag documentation. /// Represents the LastName attribute/simple element for this element. public string LastName { get { return this.m_LastName; } set { if ((this.m_LastName != value)) { this.m_LastName = value; this.OnLastNameChanged(System.EventArgs.Empty); } } } // TODO: Complete Summary tag documentation. /// Represents the HoursOfStudy attribute/simple element for this element. public System.Decimal HoursOfStudy { get { return this.m_HoursOfStudy; } set { if ((this.m_HoursOfStudy != value)) { this.m_HoursOfStudy = value; this.OnHoursOfStudyChanged(System.EventArgs.Empty); } // After setting the value, it is no longer null. this.m_IsHoursOfStudyNull = false; } } /// Gets whether the value type of the HoursOfStudy attribute/simple element is null. public bool IsHoursOfStudyNull { get { return this.m_IsHoursOfStudyNull; } } // TODO: Complete Summary tag documentation. /// Represents the inner text of the element. public string Text { get { return this.m_Text; } set { if ((this.m_Text != value)) { this.m_Text = value; this.OnTextChanged(System.EventArgs.Empty); } } } /// Gets the parent for this element. public LibraryElement ParentLibraryElement { get { return this.m_ParentLibraryElement; } } /// Raised when the property is changed. public event System.EventHandler FirstNameChanged; /// Raised when the property is changed. public event System.EventHandler LastNameChanged; /// Raised when the property is changed. public event System.EventHandler HoursOfStudyChanged; /// Raised when the element's inner text is changed. public event System.EventHandler TextChanged; /// Raises the event. protected virtual void OnFirstNameChanged(System.EventArgs e) { if ((this.FirstNameChanged != null)) { this.FirstNameChanged(this, e); } } /// Raises the event. protected virtual void OnLastNameChanged(System.EventArgs e) { if ((this.LastNameChanged != null)) { this.LastNameChanged(this, e); } } /// Raises the event. protected virtual void OnHoursOfStudyChanged(System.EventArgs e) { if ((this.HoursOfStudyChanged != null)) { this.HoursOfStudyChanged(this, e); } } /// Sets the value type of the HoursOfStudy attribute/simple element to null. public void SetHoursOfStudyNull() { this.m_IsHoursOfStudyNull = true; } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator ==(StudentElement left, StudentElement right) { return (((((object)(left)) == null) && (((object)(right)) == null)) || ((((object)(left)) != null) && (left.Equals(right) == true))); } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator !=(StudentElement left, StudentElement right) { return ((left == right) == false); } /// Raises the event. protected void OnTextChanged(System.EventArgs e) { if ((this.TextChanged != null)) { this.TextChanged(this, e); } } /// Serves as a hash function for the type, suitable for use in hashing algorithms and data structures like a hash table. public override int GetHashCode() { return base.GetHashCode(); } /// Compares two instances of an element of type . /// This does not support checking for equality for untyped attributes. public override bool Equals(object obj) { return (((((((obj != null) && (obj.GetType() == typeof(StudentElement))) && ((this.m_BookInHand == ((StudentElement)(obj)).m_BookInHand) && (this.m_Shush == ((StudentElement)(obj)).m_Shush))) && (this.m_FirstName == ((StudentElement)(obj)).m_FirstName)) && (this.m_LastName == ((StudentElement)(obj)).m_LastName)) && ((this.m_HoursOfStudy == ((StudentElement)(obj)).m_HoursOfStudy) && (this.IsHoursOfStudyNull == ((StudentElement)(obj)).IsHoursOfStudyNull))) && (this.m_Text == ((StudentElement)(obj)).m_Text)); } /// This method is used to serialize the element to XML DOM. System.Xml.XmlElement IXmlElement.GetXml(System.Xml.XmlDocument document) { System.Xml.XmlElement element = document.CreateElement(ElementName); if ((this.BookInHand != null)) { element.AppendChild(((IXmlElement)(this.BookInHand)).GetXml(document)); } if ((this.Shush != null)) { element.AppendChild(((IXmlElement)(this.Shush)).GetXml(document)); } if ((this.FirstName != null)) { element.SetAttribute(FirstNameName, this.FirstName.ToString()); } if ((this.LastName != null)) { element.SetAttribute(LastNameName, this.LastName.ToString()); } if ((this.IsHoursOfStudyNull == false)) { element.SetAttribute(HoursOfStudyName, this.HoursOfStudy.ToString()); } if (((this.m_Text != null) && (this.m_Text != string.Empty))) { element.AppendChild(document.CreateTextNode(this.m_Text)); } return element; } /// This method is used to to clone the element. public object Clone() { StudentElement clone = new StudentElement(); if ((this.m_BookInHand != null)) { clone.m_BookInHand = ((BookInHandElement)(this.m_BookInHand.Clone())); } if ((this.m_Shush != null)) { clone.m_Shush = ((ShushElement)(this.m_Shush.Clone())); } clone.m_FirstName = this.m_FirstName; clone.m_LastName = this.m_LastName; if ((this.IsHoursOfStudyNull == false)) { clone.HoursOfStudy = this.HoursOfStudy; } else { clone.SetHoursOfStudyNull(); } return clone; } /// Sets a value for the parent for this element. protected internal void SetParentLibraryElement(LibraryElement value) { this.m_ParentLibraryElement = value; } // TODO: Complete Summary tag documentation. /// Represents the BookInHand element. public class BookInHandElement : object, IXmlElement, System.ICloneable { /// This field is used to create the ISBN attribute/simple element. private string m_ISBN; /// Represents the referencing name for ISBN. public const string ISBNName = "ISBN"; /// Represents the referencing name for the inner text of the element. public const string ElementTextName = "#text"; /// Represents the inner text of the element. private string m_Text; /// Represents the referencing name for the element. public const string ElementName = "BookInHand"; /// Represents the parent for this element. private StudentElement m_ParentStudentElement; /// This is the default constructor. public BookInHandElement() { } /// This constructor is used to deserialize the element from XML DOM. protected internal BookInHandElement(System.Xml.XmlElement element) { if ((element.Name != ElementName)) { throw new System.ApplicationException("Invalid element initialization."); } if ((element.Attributes[ISBNName] != null)) { this.ISBN = ((string)(System.Convert.ChangeType(element.Attributes[ISBNName].Value, typeof(string)))); } if ((element.Attributes[ElementTextName] != null)) { this.m_Text = element.Attributes[ElementTextName].Value; } } // TODO: Complete Summary tag documentation. /// Represents the ISBN attribute/simple element for this element. public string ISBN { get { return this.m_ISBN; } set { if ((this.m_ISBN != value)) { this.m_ISBN = value; this.OnISBNChanged(System.EventArgs.Empty); } } } // TODO: Complete Summary tag documentation. /// Represents the inner text of the element. public string Text { get { return this.m_Text; } set { if ((this.m_Text != value)) { this.m_Text = value; this.OnTextChanged(System.EventArgs.Empty); } } } /// Gets the parent for this element. public StudentElement ParentStudentElement { get { return this.m_ParentStudentElement; } } /// Raised when the property is changed. public event System.EventHandler ISBNChanged; /// Raised when the element's inner text is changed. public event System.EventHandler TextChanged; /// Raises the event. protected virtual void OnISBNChanged(System.EventArgs e) { if ((this.ISBNChanged != null)) { this.ISBNChanged(this, e); } } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator ==(BookInHandElement left, BookInHandElement right) { return (((((object)(left)) == null) && (((object)(right)) == null)) || ((((object)(left)) != null) && (left.Equals(right) == true))); } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator !=(BookInHandElement left, BookInHandElement right) { return ((left == right) == false); } /// Raises the event. protected void OnTextChanged(System.EventArgs e) { if ((this.TextChanged != null)) { this.TextChanged(this, e); } } /// Serves as a hash function for the type, suitable for use in hashing algorithms and data structures like a hash table. public override int GetHashCode() { return base.GetHashCode(); } /// Compares two instances of an element of type . /// This does not support checking for equality for untyped attributes. public override bool Equals(object obj) { return ((((obj != null) && (obj.GetType() == typeof(BookInHandElement))) && (this.m_ISBN == ((BookInHandElement)(obj)).m_ISBN)) && (this.m_Text == ((BookInHandElement)(obj)).m_Text)); } /// This method is used to serialize the element to XML DOM. System.Xml.XmlElement IXmlElement.GetXml(System.Xml.XmlDocument document) { System.Xml.XmlElement element = document.CreateElement(ElementName); if ((this.ISBN != null)) { element.SetAttribute(ISBNName, this.ISBN.ToString()); } if (((this.m_Text != null) && (this.m_Text != string.Empty))) { element.AppendChild(document.CreateTextNode(this.m_Text)); } return element; } /// This method is used to to clone the element. public object Clone() { BookInHandElement clone = new BookInHandElement(); clone.m_ISBN = this.m_ISBN; return clone; } /// Sets a value for the parent for this element. protected internal void SetParentStudentElement(StudentElement value) { this.m_ParentStudentElement = value; } } // TODO: Complete Summary tag documentation. /// Represents the Shush element. public class ShushElement : object, IXmlElement, System.ICloneable { /// This field is used to create the ShushingLibrarianId attribute/simple element. private string m_ShushingLibrarianId; /// Represents the referencing name for ShushingLibrarianId. public const string ShushingLibrarianIdName = "ShushingLibrarianId"; /// This field is used to create the ShushingTime attribute/simple element. private System.DateTime m_ShushingTime; /// Represents the referencing name for ShushingTime. public const string ShushingTimeName = "ShushingTime"; /// Holds the null status for the value type of the ShushingTime attribute/simple element. private bool m_IsShushingTimeNull = true; /// Represents the referencing name for the inner text of the element. public const string ElementTextName = "#text"; /// Represents the inner text of the element. private string m_Text; /// Represents the referencing name for the element. public const string ElementName = "Shush"; /// Represents the parent for this element. private StudentElement m_ParentStudentElement; /// This is the default constructor. public ShushElement() { } /// This constructor is used to deserialize the element from XML DOM. protected internal ShushElement(System.Xml.XmlElement element) { if ((element.Name != ElementName)) { throw new System.ApplicationException("Invalid element initialization."); } if ((element.Attributes[ShushingLibrarianIdName] != null)) { this.ShushingLibrarianId = ((string)(System.Convert.ChangeType(element.Attributes[ShushingLibrarianIdName].Value, typeof(string)))); } if ((element.Attributes[ShushingTimeName] != null)) { this.ShushingTime = ((System.DateTime)(System.Convert.ChangeType(element.Attributes[ShushingTimeName].Value, typeof(System.DateTime)))); } else { this.SetShushingTimeNull(); } if ((element.Attributes[ElementTextName] != null)) { this.m_Text = element.Attributes[ElementTextName].Value; } } // TODO: Complete Summary tag documentation. /// Represents the ShushingLibrarianId attribute/simple element for this element. public string ShushingLibrarianId { get { return this.m_ShushingLibrarianId; } set { if ((this.m_ShushingLibrarianId != value)) { this.m_ShushingLibrarianId = value; this.OnShushingLibrarianIdChanged(System.EventArgs.Empty); } } } // TODO: Complete Summary tag documentation. /// Represents the ShushingTime attribute/simple element for this element. public System.DateTime ShushingTime { get { return this.m_ShushingTime; } set { if ((this.m_ShushingTime != value)) { this.m_ShushingTime = value; this.OnShushingTimeChanged(System.EventArgs.Empty); } // After setting the value, it is no longer null. this.m_IsShushingTimeNull = false; } } /// Gets whether the value type of the ShushingTime attribute/simple element is null. public bool IsShushingTimeNull { get { return this.m_IsShushingTimeNull; } } // TODO: Complete Summary tag documentation. /// Represents the inner text of the element. public string Text { get { return this.m_Text; } set { if ((this.m_Text != value)) { this.m_Text = value; this.OnTextChanged(System.EventArgs.Empty); } } } /// Gets the parent for this element. public StudentElement ParentStudentElement { get { return this.m_ParentStudentElement; } } /// Raised when the property is changed. public event System.EventHandler ShushingLibrarianIdChanged; /// Raised when the property is changed. public event System.EventHandler ShushingTimeChanged; /// Raised when the element's inner text is changed. public event System.EventHandler TextChanged; /// Raises the event. protected virtual void OnShushingLibrarianIdChanged(System.EventArgs e) { if ((this.ShushingLibrarianIdChanged != null)) { this.ShushingLibrarianIdChanged(this, e); } } /// Raises the event. protected virtual void OnShushingTimeChanged(System.EventArgs e) { if ((this.ShushingTimeChanged != null)) { this.ShushingTimeChanged(this, e); } } /// Sets the value type of the ShushingTime attribute/simple element to null. public void SetShushingTimeNull() { this.m_IsShushingTimeNull = true; } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator ==(ShushElement left, ShushElement right) { return (((((object)(left)) == null) && (((object)(right)) == null)) || ((((object)(left)) != null) && (left.Equals(right) == true))); } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator !=(ShushElement left, ShushElement right) { return ((left == right) == false); } /// Raises the event. protected void OnTextChanged(System.EventArgs e) { if ((this.TextChanged != null)) { this.TextChanged(this, e); } } /// Serves as a hash function for the type, suitable for use in hashing algorithms and data structures like a hash table. public override int GetHashCode() { return base.GetHashCode(); } /// Compares two instances of an element of type . /// This does not support checking for equality for untyped attributes. public override bool Equals(object obj) { return (((((obj != null) && (obj.GetType() == typeof(ShushElement))) && (this.m_ShushingLibrarianId == ((ShushElement)(obj)).m_ShushingLibrarianId)) && ((this.m_ShushingTime == ((ShushElement)(obj)).m_ShushingTime) && (this.IsShushingTimeNull == ((ShushElement)(obj)).IsShushingTimeNull))) && (this.m_Text == ((ShushElement)(obj)).m_Text)); } /// This method is used to serialize the element to XML DOM. System.Xml.XmlElement IXmlElement.GetXml(System.Xml.XmlDocument document) { System.Xml.XmlElement element = document.CreateElement(ElementName); if ((this.ShushingLibrarianId != null)) { element.SetAttribute(ShushingLibrarianIdName, this.ShushingLibrarianId.ToString()); } if ((this.IsShushingTimeNull == false)) { element.SetAttribute(ShushingTimeName, this.ShushingTime.ToString()); } if (((this.m_Text != null) && (this.m_Text != string.Empty))) { element.AppendChild(document.CreateTextNode(this.m_Text)); } return element; } /// This method is used to to clone the element. public object Clone() { ShushElement clone = new ShushElement(); clone.m_ShushingLibrarianId = this.m_ShushingLibrarianId; if ((this.IsShushingTimeNull == false)) { clone.ShushingTime = this.ShushingTime; } else { clone.SetShushingTimeNull(); } return clone; } /// Sets a value for the parent for this element. protected internal void SetParentStudentElement(StudentElement value) { this.m_ParentStudentElement = value; } } } // TODO: Complete Summary tag documentation. /// Represents the Book element. public class BookElement : object, IXmlElement, System.ICloneable { /// This field is used to create the ISBN attribute/simple element. private string m_ISBN; /// Represents the referencing name for ISBN. public const string ISBNName = "ISBN"; /// This field is used to create the Author attribute/simple element. private string m_Author; /// Represents the referencing name for Author. public const string AuthorName = "Author"; /// This field is used to create the Name attribute/simple element. private string m_Name; /// Represents the referencing name for Name. public const string NameName = "Name"; /// Represents the referencing name for the inner text of the element. public const string ElementTextName = "#text"; /// Represents the inner text of the element. private string m_Text; /// Represents the referencing name for the element. public const string ElementName = "Book"; /// Represents the parent for this element. private LibraryElement m_ParentLibraryElement; /// This is the default constructor. public BookElement() { } /// This constructor is used to deserialize the element from XML DOM. protected internal BookElement(System.Xml.XmlElement element) { if ((element.Name != ElementName)) { throw new System.ApplicationException("Invalid element initialization."); } if ((element.Attributes[ISBNName] != null)) { this.ISBN = ((string)(System.Convert.ChangeType(element.Attributes[ISBNName].Value, typeof(string)))); } if ((element.Attributes[AuthorName] != null)) { this.Author = ((string)(System.Convert.ChangeType(element.Attributes[AuthorName].Value, typeof(string)))); } if ((element.Attributes[NameName] != null)) { this.Name = ((string)(System.Convert.ChangeType(element.Attributes[NameName].Value, typeof(string)))); } if ((element.Attributes[ElementTextName] != null)) { this.m_Text = element.Attributes[ElementTextName].Value; } } // TODO: Complete Summary tag documentation. /// Represents the ISBN attribute/simple element for this element. public string ISBN { get { return this.m_ISBN; } set { if ((this.m_ISBN != value)) { this.m_ISBN = value; this.OnISBNChanged(System.EventArgs.Empty); } } } // TODO: Complete Summary tag documentation. /// Represents the Author attribute/simple element for this element. public string Author { get { return this.m_Author; } set { if ((this.m_Author != value)) { this.m_Author = value; this.OnAuthorChanged(System.EventArgs.Empty); } } } // TODO: Complete Summary tag documentation. /// Represents the Name attribute/simple element for this element. public string Name { get { return this.m_Name; } set { if ((this.m_Name != value)) { this.m_Name = value; this.OnNameChanged(System.EventArgs.Empty); } } } // TODO: Complete Summary tag documentation. /// Represents the inner text of the element. public string Text { get { return this.m_Text; } set { if ((this.m_Text != value)) { this.m_Text = value; this.OnTextChanged(System.EventArgs.Empty); } } } /// Gets the parent for this element. public LibraryElement ParentLibraryElement { get { return this.m_ParentLibraryElement; } } /// Raised when the property is changed. public event System.EventHandler ISBNChanged; /// Raised when the property is changed. public event System.EventHandler AuthorChanged; /// Raised when the property is changed. public event System.EventHandler NameChanged; /// Raised when the element's inner text is changed. public event System.EventHandler TextChanged; /// Raises the event. protected virtual void OnISBNChanged(System.EventArgs e) { if ((this.ISBNChanged != null)) { this.ISBNChanged(this, e); } } /// Raises the event. protected virtual void OnAuthorChanged(System.EventArgs e) { if ((this.AuthorChanged != null)) { this.AuthorChanged(this, e); } } /// Raises the event. protected virtual void OnNameChanged(System.EventArgs e) { if ((this.NameChanged != null)) { this.NameChanged(this, e); } } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator ==(BookElement left, BookElement right) { return (((((object)(left)) == null) && (((object)(right)) == null)) || ((((object)(left)) != null) && (left.Equals(right) == true))); } /// Equality operator override. /// This does not support checking for equality for untyped attributes. public static bool operator !=(BookElement left, BookElement right) { return ((left == right) == false); } /// Raises the event. protected void OnTextChanged(System.EventArgs e) { if ((this.TextChanged != null)) { this.TextChanged(this, e); } } /// Serves as a hash function for the type, suitable for use in hashing algorithms and data structures like a hash table. public override int GetHashCode() { return base.GetHashCode(); } /// Compares two instances of an element of type . /// This does not support checking for equality for untyped attributes. public override bool Equals(object obj) { return ((((((obj != null) && (obj.GetType() == typeof(BookElement))) && (this.m_ISBN == ((BookElement)(obj)).m_ISBN)) && (this.m_Author == ((BookElement)(obj)).m_Author)) && (this.m_Name == ((BookElement)(obj)).m_Name)) && (this.m_Text == ((BookElement)(obj)).m_Text)); } /// This method is used to serialize the element to XML DOM. System.Xml.XmlElement IXmlElement.GetXml(System.Xml.XmlDocument document) { System.Xml.XmlElement element = document.CreateElement(ElementName); if ((this.ISBN != null)) { element.SetAttribute(ISBNName, this.ISBN.ToString()); } if ((this.Author != null)) { element.SetAttribute(AuthorName, this.Author.ToString()); } if ((this.Name != null)) { element.SetAttribute(NameName, this.Name.ToString()); } if (((this.m_Text != null) && (this.m_Text != string.Empty))) { element.AppendChild(document.CreateTextNode(this.m_Text)); } return element; } /// This method is used to to clone the element. public object Clone() { BookElement clone = new BookElement(); clone.m_ISBN = this.m_ISBN; clone.m_Author = this.m_Author; clone.m_Name = this.m_Name; return clone; } /// Sets a value for the parent for this element. protected internal void SetParentLibraryElement(LibraryElement value) { this.m_ParentLibraryElement = value; } } } /// This is a typed collection for the LibraryCollection () element. public class LibraryCollection : System.Collections.CollectionBase, IXmlElementCollection, System.ICloneable { private const int MinAmount = 1; /// The parent element for this collection. private NotSoSimpleSchemaElement m_Parent; /// Default internal constructor. protected internal LibraryCollection(NotSoSimpleSchemaElement parent) { this.m_Parent = parent; } /// This constructor is used to deserialize the element collection from XML DOM. protected internal LibraryCollection(System.Xml.XmlElement parentElement, NotSoSimpleSchemaElement parent) { this.m_Parent = parent; for (int index = 0; (index < parentElement.ChildNodes.Count); index = (index + 1)) { if (((parentElement.ChildNodes[index].GetType() == typeof(System.Xml.XmlElement)) && (parentElement.ChildNodes[index].Name == LibraryElement.ElementName))) { base.InnerList.Add(new LibraryElement(((System.Xml.XmlElement)(parentElement.ChildNodes[index])))); } } } /// Gets or sets the at the specific index. public LibraryElement this[int index] { get { return ((LibraryElement)(base.InnerList[index])); } set { if ((this[index] != value)) { base.InnerList[index] = value; this.OnCollectionChanged(System.EventArgs.Empty); } } } /// This event is invoked whenever the collection has items added to it or removed from it. public event System.EventHandler CollectionChanged; /// Adds a to the end of the collection. public int Add(LibraryElement value) { value.SetParentNotSoSimpleSchemaElement(this.m_Parent); int location = base.InnerList.Add(value); this.OnCollectionChanged(System.EventArgs.Empty); return location; } /// Determines whether the object is in the collection. public bool Contains(LibraryElement value) { return base.InnerList.Contains(value); } /// Returns the zero-based index of the first occurrence of the object in the collection. public int IndexOf(LibraryElement value) { return base.InnerList.IndexOf(value); } /// Inserts an object of type into the collection at the specified index. public void Insert(int index, LibraryElement value) { value.SetParentNotSoSimpleSchemaElement(this.m_Parent); base.InnerList.Insert(index, value); this.OnCollectionChanged(System.EventArgs.Empty); } /// Removes the first occurrence of a specific object from the collection. public void Remove(LibraryElement value) { // Check to see if we have reached the minimum amount. if ((base.InnerList.Count == MinAmount)) { throw new System.ApplicationException("Minimum amount of items reached."); } value.SetParentNotSoSimpleSchemaElement(null); base.InnerList.Remove(value); this.OnCollectionChanged(System.EventArgs.Empty); } /// Removes the at the specific index from the collection. public new void RemoveAt(int index) { // Check to see if we have reached the minimum amount. if ((base.InnerList.Count == MinAmount)) { throw new System.ApplicationException("Minimum amount of items reached."); } this[index].SetParentNotSoSimpleSchemaElement(null); base.InnerList.RemoveAt(index); this.OnCollectionChanged(System.EventArgs.Empty); } /// This method is used to serialize the element collection to XML DOM. System.Xml.XmlElement[] IXmlElementCollection.GetXml(System.Xml.XmlDocument document) { if (((base.InnerList.Count != 0) && (base.InnerList.Count < MinAmount))) { throw new System.ApplicationException("Can not serialize element set since it does not comply with minimum / maximum amo" + "unts"); } System.Xml.XmlElement[] elements = new System.Xml.XmlElement[base.InnerList.Count]; for (int index = 0; (index < base.InnerList.Count); index = (index + 1)) { elements[index] = ((IXmlElement)(base.InnerList[index])).GetXml(document); } return elements; } /// This method is used to clone the collection. public object Clone() { LibraryCollection collection = new LibraryCollection(null); for (int index = 0; (index < base.InnerList.Count); index = (index + 1)) { collection.Add(((LibraryElement)(((LibraryElement)(base.InnerList[index])).Clone()))); } return collection; } /// Sets a value for the parent for all elements in this collection. protected internal void SetParentNotSoSimpleSchemaElement(NotSoSimpleSchemaElement parent) { for (int index = 0; (index < base.InnerList.Count); index = (index + 1)) { ((LibraryElement)(this[index])).SetParentNotSoSimpleSchemaElement(parent); } this.m_Parent = parent; } /// This method is used to check element collection equality. public override bool Equals(object obj) { if ((obj == null)) { return false; } try { for (int index = 0; (index < base.InnerList.Count); index = (index + 1)) { if ((this[index] != ((LibraryCollection)(obj))[index])) { return false; } } return true; } catch (System.ArgumentOutOfRangeException ) { return false; } catch (System.InvalidCastException ) { return false; } } /// Equality operator override. public static bool operator ==(LibraryCollection left, LibraryCollection right) { return (((((object)(left)) == null) && (((object)(right)) == null)) || ((((object)(left)) != null) && (left.Equals(right) == true))); } /// Equality operator override. public static bool operator !=(LibraryCollection left, LibraryCollection right) { return ((left == right) == false); } /// Invokes the event. public void OnCollectionChanged(System.EventArgs e) { if ((this.CollectionChanged != null)) { this.CollectionChanged(this, e); } } /// Serves as a hash function for the type, suitable for use in hashing algorithms and data structures like a hash table. public override int GetHashCode() { return base.GetHashCode(); } /// Used to catch insertions done via the interface. protected override void OnInsertComplete(int index, object value) { base.OnInsertComplete(index, value); this.OnCollectionChanged(System.EventArgs.Empty); } /// Used to catch clearing done via the interface. protected override void OnClearComplete() { base.OnClearComplete(); this.OnCollectionChanged(System.EventArgs.Empty); } /// Used to catch insertions done via the interface. protected override void OnRemoveComplete(int index, object value) { base.OnRemoveComplete(index, value); this.OnCollectionChanged(System.EventArgs.Empty); } /// Used to catch insertions done via the interface. protected override void OnSetComplete(int index, object oldValue, object newValue) { base.OnSetComplete(index, oldValue, newValue); this.OnCollectionChanged(System.EventArgs.Empty); } /// Used to catch insertions done via the interface. protected override void OnValidate(object value) { base.OnValidate(value); if (((value.GetType() != typeof(LibraryElement)) && (value.GetType().IsSubclassOf(typeof(LibraryElement)) == false))) { throw new System.ArgumentException(string.Concat("Can not convert type ", value.GetType().FullName, " to type LibraryElement.")); } } } } /// This class is used to load and store files that contain the NotSoSimpleSchema hierarchy. public class NotSoSimpleSchemaDocument : System.Xml.XmlDocument { /// This field is used to store the schema for validation. private static System.Xml.Schema.XmlSchema m_Schema = System.Xml.Schema.XmlSchema.Read(new System.IO.StringReader("\r\n\r\n " + " \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n " + " \r\n \r\n " + " \r\n \r\n " + " \r\n \r\n \r\n " + " \r\n \r\n " + " \r\n \r\n " + " \r\n " + " \r\n " + " \r\n \r\n " + " \r\n \r\n \r\n \r" + "\n \r\n \r\n <" + "xs:element name=\"Book\">\r\n \r\n \r\n \r\n " + " \r\n " + " \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n " + "\r\n"), null); /// This method is used for loading the NotSoSimpleSchemaDocument with data from the DOM. public static NotSoSimpleSchemaDocument FromDOM(NotSoSimpleSchemaElement element) { NotSoSimpleSchemaDocument document = new NotSoSimpleSchemaDocument(); document.AppendChild(document.CreateXmlDeclaration("1.0", "utf-8", "yes")); document.AppendChild(((IXmlElement)(element)).GetXml(document)); System.Xml.XmlAttribute xmlns = document.CreateAttribute("xmlns"); xmlns.Value = m_Schema.TargetNamespace; document[NotSoSimpleSchemaElement.ElementName].Attributes.Append(xmlns); return document; } /// This method is used for loading the DOM into this NotSoSimpleSchemaDocument. public NotSoSimpleSchemaElement CreateDOM() { return new NotSoSimpleSchemaElement(this[NotSoSimpleSchemaElement.ElementName]); } /// Loads the XML document from the specified and validates it against the schema. /// Note that if the namespace does not point to the schema, the document will not be validated. public override void Load(System.Xml.XmlReader reader) { System.Xml.XmlValidatingReader valReader; if ((reader.GetType() == typeof(System.Xml.XmlValidatingReader))) { valReader = ((System.Xml.XmlValidatingReader)(reader)); } else { valReader = new System.Xml.XmlValidatingReader(reader); } valReader.Schemas.Add(m_Schema); valReader.ValidationType = System.Xml.ValidationType.Schema; base.Load(reader); } } /// This interface is used for serializing the DOM, for an element collection. public interface IXmlElementCollection { /// This method is used to serialize an element collection to XML DOM. System.Xml.XmlElement[] GetXml(System.Xml.XmlDocument document); } /// This interface is used for serializing the DOM, for a specific element. public interface IXmlElement { /// This method is used to serialize an element to XML DOM. System.Xml.XmlElement GetXml(System.Xml.XmlDocument document); } }