/// <summary> /// Parses the <c>xsd:boolean</c> value of the indicated attribute, returning <c>true</c> for /// a value of <c>"true"</c> or <c>"1"</c>, <c>false</c> for a value of <c>"false"</c> or /// <c>"0"</c>, or <c>null</c> if the attribute does not exist. If the attribute exists but /// does not match any of the above values, an exception is thrown. /// </summary> /// <param name="element"></param> /// <param name="attributeName"></param> /// <returns></returns> /// <exception cref="FormatException"> /// The attribute is present but not a valid <c>xsd:boolean</c> value ( <c>"0"</c>, /// <c>"false"</c>, <c>"1"</c>, or <c>"true"</c>). /// </exception> public static bool?ParseXsdBooleanAttribute(IXPathNavigable element, XName attributeName) { Checker.NotNull(element, "element"); Checker.NotNull(attributeName, "attributeName"); var attributeValue = element.AttributeValue(attributeName); return(ParseXsdBooleanAttributeValue(attributeName, attributeValue)); }