コード例 #1
0
 internal void Clear()
 {
     _isNil           = false;
     _isDefault       = false;
     _schemaType      = null;
     _schemaElement   = null;
     _schemaAttribute = null;
     _memberType      = null;
     _validity        = XmlSchemaValidity.NotKnown;
     _contentType     = XmlSchemaContentType.Empty;
 }
コード例 #2
0
        public int GetHashCode(XmlSchemaInfo?si)
        {
            if (si == null)
            {
                return(0);
            }
            int h = (int)si.ContentType;

            if (si.IsDefault)
            {
                h ^= 1;
            }
            if (si.IsNil)
            {
                h ^= 1;
            }
            XmlSchemaSimpleType?memberType = si.MemberType;

            if (memberType != null)
            {
                h ^= memberType.GetHashCode();
            }
            XmlSchemaAttribute?schemaAttribute = si.SchemaAttribute;

            if (schemaAttribute != null)
            {
                h ^= schemaAttribute.GetHashCode();
            }
            XmlSchemaElement?schemaElement = si.SchemaElement;

            if (schemaElement != null)
            {
                h ^= schemaElement.GetHashCode();
            }
            XmlSchemaType?schemaType = si.SchemaType;

            if (schemaType != null)
            {
                h ^= schemaType.GetHashCode();
            }
            h ^= (int)si.Validity;
            return(h);
        }
コード例 #3
0
        private string?GetDefaultValue(XmlSchemaAttribute sa)
        {
            XmlSchemaAttribute?saCopy = sa;
            XmlQualifiedName   name   = saCopy.RefName;

            if (!name.IsEmpty)
            {
                saCopy = schemas.GlobalAttributes[name] as XmlSchemaAttribute;
                if (saCopy == null)
                {
                    return(null);
                }
            }
            string?s = saCopy.FixedValue;

            if (s != null)
            {
                return(s);
            }
            return(saCopy.DefaultValue);
        }
コード例 #4
0
        private void Write1_XmlSchemaAttribute(XmlSchemaAttribute?o)
        {
            if ((object?)o == null)
            {
                return;
            }
            WriteStartElement("attribute");
            WriteAttribute(@"id", @"", ((string?)o.@Id));
            WriteAttributes((XmlAttribute[]?)o.@UnhandledAttributes, o);
            WriteAttribute(@"default", @"", ((string?)o.@DefaultValue));
            WriteAttribute(@"fixed", @"", ((string?)o.@FixedValue));
            if (o.Parent != null && !(o.Parent is XmlSchema))
            {
                if (o.QualifiedName != null && !o.QualifiedName.IsEmpty && o.QualifiedName.Namespace != null && o.QualifiedName.Namespace.Length != 0)
                {
                    WriteAttribute(@"form", @"", "qualified");
                }
                else
                {
                    WriteAttribute(@"form", @"", "unqualified");
                }
            }
            WriteAttribute(@"name", @"", ((string?)o.@Name));

            if (!o.RefName.IsEmpty)
            {
                WriteAttribute("ref", "", o.RefName);
            }
            else if (!o.SchemaTypeName.IsEmpty)
            {
                WriteAttribute("type", "", o.SchemaTypeName);
            }
            XmlSchemaUse use = o.Use == XmlSchemaUse.None ? XmlSchemaUse.Optional : o.Use;

            WriteAttribute(@"use", @"", Write30_XmlSchemaUse(use));
            Write5_XmlSchemaAnnotation((XmlSchemaAnnotation?)o.@Annotation);
            Write9_XmlSchemaSimpleType((XmlSchemaSimpleType?)o.@SchemaType);
            WriteEndElement();
        }