internal void GetMinMax(XmlElement elNode, bool isAttribute, ref int minOccurs, ref int maxOccurs)
{
string occurs = elNode.GetAttribute(Keywords.MINOCCURS);
if (occurs != null && occurs.Length > 0)
{
try
{
minOccurs = int.Parse(occurs, CultureInfo.InvariantCulture);
}
catch (Exception e) when (ADP.IsCatchableExceptionType(e))
{
throw ExceptionBuilder.AttributeValues(nameof(minOccurs), "0", "1");
}
}
occurs = elNode.GetAttribute(Keywords.MAXOCCURS);
if (occurs != null && occurs.Length > 0)
{
int bZeroOrMore = string.Compare(occurs, Keywords.STAR, StringComparison.Ordinal);
if (bZeroOrMore == 0)
{
maxOccurs = -1;
}
else
{
try
{
maxOccurs = int.Parse(occurs, CultureInfo.InvariantCulture);
}
catch (Exception e) when (ADP.IsCatchableExceptionType(e))
{
throw ExceptionBuilder.AttributeValues(nameof(maxOccurs), "1", Keywords.STAR);
}
if (maxOccurs != 1)
{
throw ExceptionBuilder.AttributeValues(nameof(maxOccurs), "1", Keywords.STAR);
}
}
}
}