Skip to main content

parse_unique_id_element

Function parse_unique_id_element 

Source
pub fn parse_unique_id_element(
    element: &XmlElement,
    unique_id_elements: Option<&str>,
) -> String
Expand description

Get a unique ID for an element, using configured fields or a hash of the outer element when no configured field exists in the subtree.

Hashing must be performed on the outer element (not on whatever inner child the search happened to visit first) so siblings whose first nested child shares a value - e.g. a list of <actionOverrides> that all start with <actionName>View</actionName> - still produce distinct filenames reflecting their distinct content.

Resolved configured-field values are passed through [sanitize_path_segment] before being returned so any path-illegal characters in the source value (e.g. / in an EntitlementProcess milestoneName) are mapped to a safe placeholder. Hash-fallback values are pure hex and pass through the sanitizer as a no-op.