The Labs \ Source Viewer \ SSCLI \ System.Xml.Schema \ XmlSchemaSimpleTypeUnion

  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlSchemaSimpleTypeUnion.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. // <owner current="true" primary="true">priyal</owner>
  15. //------------------------------------------------------------------------------
  16. namespace System.Xml.Schema
  17. {
  18.    
  19.     using System.Xml.Serialization;
  20.    
  21.     /// <include file='doc\XmlSchemaSimpleTypeUnion.uex' path='docs/doc[@for="XmlSchemaSimpleTypeUnion"]/*' />
  22.     /// <devdoc>
  23.     /// <para>[To be supplied.]</para>
  24.     /// </devdoc>
  25.     public class XmlSchemaSimpleTypeUnion : XmlSchemaSimpleTypeContent
  26.     {
  27.         XmlSchemaObjectCollection baseTypes = new XmlSchemaObjectCollection();
  28.         XmlQualifiedName[] memberTypes;
  29.         XmlSchemaSimpleType[] baseMemberTypes;
  30.         // Compiled
  31.         /// <include file='doc\XmlSchemaSimpleTypeUnion.uex' path='docs/doc[@for="XmlSchemaSimpleTypeUnion.BaseTypes"]/*' />
  32.         /// <devdoc>
  33.         /// <para>[To be supplied.]</para>
  34.         /// </devdoc>
  35.         [XmlElement("simpleType", typeof(XmlSchemaSimpleType))]
  36.         public XmlSchemaObjectCollection BaseTypes {
  37.             get { return baseTypes; }
  38.         }
  39.        
  40.         /// <include file='doc\XmlSchemaSimpleTypeUnion.uex' path='docs/doc[@for="XmlSchemaSimpleTypeUnion.MemberTypes"]/*' />
  41.         [XmlAttribute("memberTypes")]
  42.         public XmlQualifiedName[] MemberTypes {
  43.             get { return memberTypes; }
  44.             set { memberTypes = value; }
  45.         }
  46.        
  47.         //Compiled Information
  48.         /// <include file='doc\XmlSchemaSimpleTypeUnion.uex' path='docs/doc[@for="XmlSchemaSimpleTypeUnion.BaseMemberTypes"]/*' />
  49.         [XmlIgnore()]
  50.         public XmlSchemaSimpleType[] BaseMemberTypes {
  51.             get { return baseMemberTypes; }
  52.         }
  53.        
  54.         internal void SetBaseMemberTypes(XmlSchemaSimpleType[] baseMemberTypes)
  55.         {
  56.             this.baseMemberTypes = baseMemberTypes;
  57.         }
  58.        
  59.         internal override XmlSchemaObject Clone()
  60.         {
  61.             if (memberTypes != null && memberTypes.Length > 0) {
  62.                 //Only if the union has MemberTypes defined
  63.                 XmlSchemaSimpleTypeUnion newUnion = (XmlSchemaSimpleTypeUnion)MemberwiseClone();
  64.                 XmlQualifiedName[] newQNames = new XmlQualifiedName[memberTypes.Length];
  65.                
  66.                 for (int i = 0; i < memberTypes.Length; i++) {
  67.                     newQNames[i] = memberTypes[i].Clone();
  68.                 }
  69.                 newUnion.MemberTypes = newQNames;
  70.                 return newUnion;
  71.             }
  72.             return this;
  73.         }
  74.     }
  75. }

Developer Fusion