TryParse() static private méthode

static private TryParse ( string s, DurationType durationType, XsdDuration &result ) : Exception
s string
durationType DurationType
result XsdDuration
Résultat System.Exception
Exemple #1
0
        internal override Exception TryParseValue(string s, XmlNameTable nameTable, IXmlNamespaceResolver nsmgr, out object typedValue)
        {
            typedValue = null;
            if ((s == null) || (s.Length == 0))
            {
                return(new XmlSchemaException("Sch_EmptyAttributeValue", string.Empty));
            }
            Exception exception = DatatypeImplementation.durationFacetsChecker.CheckLexicalFacets(ref s, this);

            if (exception == null)
            {
                XsdDuration duration;
                exception = XsdDuration.TryParse(s, XsdDuration.DurationType.DayTimeDuration, out duration);
                if (exception == null)
                {
                    TimeSpan span;
                    exception = duration.TryToTimeSpan(XsdDuration.DurationType.DayTimeDuration, out span);
                    if (exception == null)
                    {
                        exception = DatatypeImplementation.durationFacetsChecker.CheckValueFacets(span, this);
                        if (exception == null)
                        {
                            typedValue = span;
                            return(null);
                        }
                    }
                }
            }
            return(exception);
        }