/// <inheritdoc />
        public override bool ValidateValueType(OpenXmlSimpleType attributeValue)
        {
            StringValue stringValue = attributeValue.InnerText;

            var memberValues = UnionHelper.CreatePossibleMembers(this, FileFormat);

            int count = memberValues.Length;

            Debug.Assert(count == UnionTypes.Length);

            OpenXmlSimpleType     simpleValue;
            SimpleTypeRestriction memberRestriction;

            for (int i = 0; i < count; i++)
            {
                simpleValue           = memberValues[i];
                simpleValue.InnerText = stringValue;
                memberRestriction     = UnionTypes[i];

                if (memberRestriction.ValidateValueType(simpleValue))
                {
                    if (memberRestriction.Validate(simpleValue) == RestrictionField.None)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        public OpenXmlSimpleType ConvertValue(OpenXmlSimpleType value)
        {
            var targetValue = UnionHelper.CreateTargetValueObject(this, FileFormat);

            targetValue.InnerText = value.InnerText;

            return(targetValue);
        }