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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlSchemaSimpleType.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.     using System.Diagnostics;
  21.    
  22.     /// <include file='doc\XmlSchemaSimpleType.uex' path='docs/doc[@for="XmlSchemaSimpleType"]/*' />
  23.     /// <devdoc>
  24.     /// <para>[To be supplied.]</para>
  25.     /// </devdoc>
  26.     public class XmlSchemaSimpleType : XmlSchemaType
  27.     {
  28.         XmlSchemaSimpleTypeContent content;
  29.        
  30.         /// <include file='doc\XmlSchemaSimpleType.uex' path='docs/doc[@for="XmlSchemaSimpleType.Content"]/*' />
  31.         /// <devdoc>
  32.         /// <para>[To be supplied.]</para>
  33.         /// </devdoc>
  34.        
  35.         public XmlSchemaSimpleType()
  36.         {
  37.             Debug.Assert(SchemaContentType == XmlSchemaContentType.TextOnly);
  38.         }
  39.        
  40.         /// <include file='doc\XmlSchemaSimpleType.uex' path='docs/doc[@for="XmlSchemaSimpleType.Content1"]/*' />
  41.         [XmlElement("restriction", typeof(XmlSchemaSimpleTypeRestriction)), XmlElement("list", typeof(XmlSchemaSimpleTypeList)), XmlElement("union", typeof(XmlSchemaSimpleTypeUnion))]
  42.         public XmlSchemaSimpleTypeContent Content {
  43.             get { return content; }
  44.             set { content = value; }
  45.         }
  46.        
  47.         internal override XmlQualifiedName DerivedFrom {
  48.             get {
  49.                 if (content == null) {
  50.                     // type derived from anyType
  51.                     return XmlQualifiedName.Empty;
  52.                 }
  53.                 if (content is XmlSchemaSimpleTypeRestriction) {
  54.                     return ((XmlSchemaSimpleTypeRestriction)content).BaseTypeName;
  55.                 }
  56.                 return XmlQualifiedName.Empty;
  57.             }
  58.         }
  59.        
  60.         internal override XmlSchemaObject Clone()
  61.         {
  62.             XmlSchemaSimpleType newSimpleType = (XmlSchemaSimpleType)MemberwiseClone();
  63.             if (content != null) {
  64.                 newSimpleType.Content = (XmlSchemaSimpleTypeContent)content.Clone();
  65.             }
  66.             return newSimpleType;
  67.         }
  68.     }
  69. }

Developer Fusion