lookupNamespace method

String? lookupNamespace(
  1. String prefix
)

The namespace URI bound to prefix here ('' for the default namespace when none is declared; null for an undeclared prefix).

Implementation

String? lookupNamespace(String prefix) {
  for (XmlLiteElement? e = this; e != null; e = e.parent) {
    for (final a in e.attributes) {
      if (prefix.isEmpty ? a.qname == 'xmlns' : a.qname == 'xmlns:$prefix') {
        return a.value;
      }
    }
  }
  if (prefix == 'xml') return 'http://www.w3.org/XML/1998/namespace';
  return prefix.isEmpty ? '' : null;
}