fromXml static method

Category? fromXml(
  1. XmlElement node
)

Creates a new category object from an XmlElement

Implementation

static Category? fromXml(XmlElement node) {
  final value = siblingText(node);
  final scheme = node.getAttribute('domain') ?? node.getAttribute('scheme');
  final label = node.getAttribute('label');
  final term = node.getAttribute('term');

  if (scheme == null && label == null && value.trim().isEmpty) {
    return null;
  }

  return Category(scheme: scheme, value: value, label: label ?? value, term: term);
}