Class: Uniword::Validation::Rules::RelationshipIntegrityRule

Inherits:
Base
  • Object
show all
Defined in:
lib/uniword/validation/rules/relationship_integrity_rule.rb

Overview

Validates relationship integrity: rId references resolve to real parts.

DOC-108: All rId references in XML parts must have matching Relationship entries, and targets must exist in the ZIP. Validity rule: R6

Constant Summary collapse

R_NS =
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
RELS_NS =
"http://schemas.openxmlformats.org/package/2006/relationships"

Instance Method Summary collapse

Instance Method Details

#applicable?(context) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/uniword/validation/rules/relationship_integrity_rule.rb', line 24

def applicable?(context)
  context.part_exists?("[Content_Types].xml")
end

#categoryObject



21
# File 'lib/uniword/validation/rules/relationship_integrity_rule.rb', line 21

def category = :relationships

#check(context) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/uniword/validation/rules/relationship_integrity_rule.rb', line 28

def check(context)
  issues = []

  check_document_rels(context, issues)
  check_package_rels(context, issues)

  issues
end

#codeObject



18
# File 'lib/uniword/validation/rules/relationship_integrity_rule.rb', line 18

def code = "DOC-108"

#descriptionObject



20
# File 'lib/uniword/validation/rules/relationship_integrity_rule.rb', line 20

def description = "All rId references must resolve through .rels files to existing parts"

#severityObject



22
# File 'lib/uniword/validation/rules/relationship_integrity_rule.rb', line 22

def severity = "error"

#validity_ruleObject



19
# File 'lib/uniword/validation/rules/relationship_integrity_rule.rb', line 19

def validity_rule = "R6"