ConjugationInfo.fromXmlElement constructor

ConjugationInfo.fromXmlElement(
  1. XmlElement data
)

Implementation

factory ConjugationInfo.fromXmlElement(XmlElement data) {
  final conjugationInfo = data.getElement(ApiXmlElement.conjugationInfo.name);
  if (conjugationInfo == null) return ConjugationInfo(conjugation: "");

  var aux = data.getElement(ApiXmlElement.abbreviationInfo.name);
  final abbreviationInfo =
      aux == null ? null : AbbreviationInfo.fromXmlElement(aux);

  final conjugation = conjugationInfo
      .getElement(ApiXmlElement.conjugation.name)!
      .innerText
      .trim();

  aux = conjugationInfo.getElement(ApiXmlElement.pronunciationInfo.name);
  final pronunciationInfo =
      aux == null ? null : PronunciationInfo.fromXmlElement(aux);

  return ConjugationInfo(
    conjugation: conjugation,
    pronunciationInfo: pronunciationInfo,
    abbreviationInfo: abbreviationInfo,
  );
}