pub struct Relationships { /* private fields */ }Expand description
Parsed relationship mapping from word/_rels/document.xml.rels.
Maps relationship IDs (e.g. rId5) to their targets for both image and
hyperlink relationship types. Image targets are resolved to ZIP entry
paths (e.g. word/media/image1.png), while hyperlink targets are stored
as-is (typically an external URL).
Implementations§
Source§impl Relationships
impl Relationships
Sourcepub fn parse(rels_xml: &str) -> Result<Self>
pub fn parse(rels_xml: &str) -> Result<Self>
Parses relationship XML into image and hyperlink mappings.
Expects the standard OOXML relationships XML format:
<Relationships>
<Relationship Id="rId5" Target="media/image1.png" Type="...image" />
<Relationship Id="rId10" Target="https://example.com"
Type="...hyperlink" TargetMode="External" />
</Relationships>Image targets are resolved to ZIP entry paths (prepended with word/).
Hyperlink targets are stored as-is (typically external URLs).
§Errors
Returns DocError::Format on XML parse failure.
Sourcepub fn resolve(&self, rel_id: &str) -> Option<&str>
pub fn resolve(&self, rel_id: &str) -> Option<&str>
Resolves a relationship ID to its media part path in the ZIP archive.
Returns None if the relationship ID is not found among image
relationships. This method is kept for backward compatibility;
prefer resolve_image for new code.
Sourcepub fn resolve_image(&self, rel_id: &str) -> Option<&str>
pub fn resolve_image(&self, rel_id: &str) -> Option<&str>
Resolves a relationship ID to its image part path in the ZIP archive.
Returns None if the relationship ID is not found among image
relationships.
Sourcepub fn resolve_hyperlink(&self, rel_id: &str) -> Option<&str>
pub fn resolve_hyperlink(&self, rel_id: &str) -> Option<&str>
Resolves a relationship ID to its hyperlink URL.
Returns None if the relationship ID is not found among hyperlink
relationships.