Skip to content

Commit 694bd06

Browse files
committed
Check for repetions in interleaving of properties
1 parent 60afdf4 commit 694bd06

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Schemas/XMP_Properties-xmpDM.rng

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,6 @@
221221
<rng:optional condition="$IsPDFA4OrGreater">
222222
<rng:ref name="xmpDM.takeNumber"/>
223223
</rng:optional>
224-
<rng:optional condition="$IsPDFA4OrGreater">
225-
<rng:ref name="xmpDM.videoFrameRate"/>
226-
</rng:optional>
227224
<rng:optional condition="$IsPDFA4OrGreater">
228225
<rng:ref name="xmpDM.partOfCompilation"/>
229226
</rng:optional>

XMP_RNG_Suite/RNGMerger/RNGMerger.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ static void validateSchema(XElement root)
173173
// Find main <rng:interleave> element
174174
var interleave = root.Descendants(RngNs + "interleave").First();
175175
var refs = interleave.Descendants(RngNs + "ref").ToList();
176+
HashSet<string> properties = new HashSet<string>();
176177
foreach (var reference in refs)
177178
{
178179
var name = reference.Attribute("name")!.Value!;
@@ -182,8 +183,13 @@ static void validateSchema(XElement root)
182183
{
183184
// Ensure the second level interleave elements
184185
// are <rng:optional> elements with a single child
185-
if (child.Name.LocalName != "optional" || child.Elements().Count() != 1)
186+
List<XElement> children;
187+
if (child.Name.LocalName != "optional" || (children = child.Elements().ToList()).Count != 1)
186188
throw new Exception("Invalid interleaved element");
189+
190+
var propName = children[0].Attribute("name")!.Value!;
191+
if (!properties.Add(children[0].Attribute("name")!.Value!))
192+
throw new Exception($"Repeated property \"{propName}\"");
187193
}
188194
}
189195
}

0 commit comments

Comments
 (0)