Ejemplo n.º 1
0
        public Purse SelectPurse(string xPath)
        {
            if (string.IsNullOrEmpty(xPath))
            {
                throw new ArgumentNullException(nameof(xPath));
            }

            string text = SelectNotEmptyString(xPath);
            Purse  purse;

            if (!Purse.TryParse(text, out purse))
            {
                throw new FormatException(string.Format(CultureInfo.InvariantCulture,
                                                        "The value of the element '{0}' is not in a correct format.",
                                                        xPath));
            }

            return(purse);
        }
Ejemplo n.º 2
0
        public Purse?SelectPurseIfExists(string xPath)
        {
            if (string.IsNullOrEmpty(xPath))
            {
                throw new ArgumentNullException(nameof(xPath));
            }

            string text = TrySelectNotEmptyString(xPath);

            if (null == text)
            {
                return(null);
            }

            if (!Purse.TryParse(text, out var purse))
            {
                throw new FormatException(string.Format(CultureInfo.InvariantCulture,
                                                        "The value '{0}' of the element '{1}' is not in a correct format.", text, xPath));
            }

            return(purse);
        }