diff --git a/VisualCard/Parsers/VcardParser.cs b/VisualCard/Parsers/VcardParser.cs
index d88961b..6f89d7a 100644
--- a/VisualCard/Parsers/VcardParser.cs
+++ b/VisualCard/Parsers/VcardParser.cs
@@ -119,22 +119,28 @@ public Card Parse()
// If we have more than one argument, check for ALTID
if (CardVersion.Major >= 4 && type == PartType.PartsArray)
{
- if (splitArgs[0].StartsWith(VcardConstants._altIdArgumentSpecifier))
+ var cardinality = VcardParserTools.GetPartsArrayEnumFromType(classType, CardVersion).Item2;
+ if (cardinality != PartCardinality.MayBeOneNoAltId && cardinality != PartCardinality.ShouldBeOneNoAltId &&
+ cardinality != PartCardinality.AtLeastOneNoAltId && cardinality != PartCardinality.AnyNoAltId)
{
- // We need ALTID to be numeric
- if (!int.TryParse(splitArgs[0].Substring(VcardConstants._altIdArgumentSpecifier.Length), out altId))
- throw new InvalidDataException("ALTID must be numeric");
+ // The type supports ALTID.
+ if (splitArgs[0].StartsWith(VcardConstants._altIdArgumentSpecifier))
+ {
+ // We need ALTID to be numeric
+ if (!int.TryParse(splitArgs[0].Substring(VcardConstants._altIdArgumentSpecifier.Length), out altId))
+ throw new InvalidDataException("ALTID must be numeric");
- // We need ALTID to be positive
- if (altId < 0)
- throw new InvalidDataException("ALTID must be positive");
+ // We need ALTID to be positive
+ if (altId < 0)
+ throw new InvalidDataException("ALTID must be positive");
- // Here, we require arguments for ALTID
- if (splitArgs.Length <= 1)
- throw new InvalidDataException("ALTID must have one or more arguments to specify why this instance is an alternative");
+ // Here, we require arguments for ALTID
+ if (splitArgs.Length <= 1)
+ throw new InvalidDataException("ALTID must have one or more arguments to specify why this instance is an alternative");
+ }
+ else if (splitArgs.Any((arg) => arg.StartsWith(VcardConstants._altIdArgumentSpecifier)))
+ throw new InvalidDataException("ALTID must be exactly in the first position of the argument, because arguments that follow it are required to be specified");
}
- else if (splitArgs.Any((arg) => arg.StartsWith(VcardConstants._altIdArgumentSpecifier)))
- throw new InvalidDataException("ALTID must be exactly in the first position of the argument, because arguments that follow it are required to be specified");
}
// Finalize the arguments
diff --git a/VisualCard/Parsers/VcardParserTools.cs b/VisualCard/Parsers/VcardParserTools.cs
index 6a9bea9..377c9f1 100644
--- a/VisualCard/Parsers/VcardParserTools.cs
+++ b/VisualCard/Parsers/VcardParserTools.cs
@@ -231,7 +231,7 @@ internal static (PartsArrayEnum, PartCardinality) GetPartsArrayEnumFromType(Type
else if (partsArrayType == typeof(XNameInfo))
return (PartsArrayEnum.NonstandardNames, PartCardinality.Any);
else if (partsArrayType == typeof(RevisionInfo))
- return (PartsArrayEnum.Revision, PartCardinality.MayBeOne);
+ return (PartsArrayEnum.Revision, PartCardinality.MayBeOneNoAltId);
else if (partsArrayType == typeof(BirthDateInfo))
return (PartsArrayEnum.Birthdate, PartCardinality.MayBeOne);
else if (partsArrayType == typeof(AnniversaryInfo))
diff --git a/VisualCard/Parts/Enums/PartCardinality.cs b/VisualCard/Parts/Enums/PartCardinality.cs
index acd2121..c6c0a8c 100644
--- a/VisualCard/Parts/Enums/PartCardinality.cs
+++ b/VisualCard/Parts/Enums/PartCardinality.cs
@@ -41,6 +41,14 @@ internal enum PartCardinality
///
ShouldBeOne,
///
+ /// Cardinality: * (One or more instances per vCard MAY be present.) - AltID not supported
+ ///
+ AnyNoAltId,
+ ///
+ /// Cardinality: 1* (One or more instances per vCard MUST be present.) - AltID not supported
+ ///
+ AtLeastOneNoAltId,
+ ///
/// Cardinality: *1 (Exactly one instance per vCard MAY be present.) - AltID not supported
///
MayBeOneNoAltId,