Category.parse constructor

Category.parse(
  1. XmlElement element
)

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

The factory constructor takes an XmlElement representing the category element and extracts its attributes 'scheme' and 'label', as well as its inner text 'value'. The extracted values are used to initialize the properties of the Category object.

Implementation

factory Category.parse(XmlElement element) {
  return Category(
    scheme: element.getAttribute('scheme'), // Extract 'scheme' attribute.
    label: element.getAttribute('label'), // Extract 'label' attribute.
    value: element.innerText, // Extract inner text.
  );
}