Credit.parse constructor

Credit.parse(
  1. XmlElement element
)

Factory method to create a new Credit instance from an XML element.

The factory constructor takes an XmlElement representing the "credit" element and extracts its attributes 'role' and 'scheme', as well as its inner text value. It uses these values to initialize the properties of the Credit object.

Implementation

factory Credit.parse(XmlElement element) {
  return Credit(
    role: element.getAttribute('role'), // Extract the 'role' attribute.
    scheme: element.getAttribute('scheme'), // Extract the 'scheme' attribute.
    value: element
        .innerText, // Extract the inner text of the element as 'value'.
  );
}