NodeType property

XmlNodeType? get NodeType

Implementation

xml.XmlNodeType? get NodeType {
  if (!_isStarted || _isFinished) {
    return null;
  }
  switch (_current!.nodeType) {
    case XmlNodeType.TEXT:
      return xml.XmlNodeType.Text;
    case XmlNodeType.ELEMENT:
      if (_current is XmlStartElementEvent) {
        return xml.XmlNodeType.Element;
      } else if (_current is XmlEndElementEvent) {
        return xml.XmlNodeType.EndElement;
      } else {
        throw ArgumentException("Unexpected ${_current} element");
      }
      break;
    case XmlNodeType.ATTRIBUTE:
      break;
    case XmlNodeType.CDATA:
      // TODO: Handle this case.
      break;
    case XmlNodeType.PROCESSING:
      return xml.XmlNodeType.XmlDeclaration;
    case XmlNodeType.COMMENT:
      // TODO: Handle this case.
      break;
    case XmlNodeType.DOCUMENT:
      // TODO: Handle this case.
      break;
    case XmlNodeType.DOCUMENT_FRAGMENT:
      // TODO: Handle this case.
      break;
    case XmlNodeType.DOCUMENT_TYPE:
      // TODO: Handle this case.
      break;
    case XmlNodeType.DECLARATION:
      return xml.XmlNodeType.XmlDeclaration;
  }
  throw NotImplementedException("Can't convert NodeType of ${_current}");
}