Ejemplo n.º 1
0
        private object UnWrapUnion(object typedValue)
        {
            XsdSimpleValue simpleValue = typedValue as XsdSimpleValue;

            if (simpleValue != null)
            {
                typedValue = simpleValue.TypedValue;
            }
            return(typedValue);
        }
        private void SetDefaultAttributeSchemaInfo(XmlSchemaAttribute schemaAttribute)
        {
            this.attributeSchemaInfo.Clear();
            this.attributeSchemaInfo.IsDefault       = true;
            this.attributeSchemaInfo.IsNil           = false;
            this.attributeSchemaInfo.SchemaType      = schemaAttribute.AttributeSchemaType;
            this.attributeSchemaInfo.SchemaAttribute = schemaAttribute;
            SchemaAttDef attDef = schemaAttribute.AttDef;

            if (attDef.Datatype.Variety == XmlSchemaDatatypeVariety.Union)
            {
                XsdSimpleValue defaultValueTyped = attDef.DefaultValueTyped as XsdSimpleValue;
                this.attributeSchemaInfo.MemberType = defaultValueTyped.XmlType;
            }
            this.attributeSchemaInfo.Validity = XmlSchemaValidity.Valid;
        }
Ejemplo n.º 3
0
        private void SetDefaultAttributeSchemaInfo(XmlSchemaAttribute schemaAttribute)
        {
            Debug.Assert(_attributeSchemaInfo != null);
            _attributeSchemaInfo.Clear();
            _attributeSchemaInfo.IsDefault       = true;
            _attributeSchemaInfo.IsNil           = false;
            _attributeSchemaInfo.SchemaType      = schemaAttribute.AttributeSchemaType;
            _attributeSchemaInfo.SchemaAttribute = schemaAttribute;

            //Get memberType for default attribute
            SchemaAttDef attributeDef = schemaAttribute.AttDef;

            if (attributeDef.Datatype.Variety == XmlSchemaDatatypeVariety.Union)
            {
                XsdSimpleValue simpleValue = attributeDef.DefaultValueTyped as XsdSimpleValue;
                Debug.Assert(simpleValue != null);
                _attributeSchemaInfo.MemberType = simpleValue.XmlType;
            }
            _attributeSchemaInfo.Validity = XmlSchemaValidity.Valid;
        }