contentAsXml method
Content as an XML document.
Implementation
Future<XmlElement?> contentAsXml() async {
if (!loadedContentAsXml) {
loadedContentAsXml = true;
try {
_contentAsXml = await contentAsString()
.then((it) => it?.let((string) => XmlDocument.parse(string)))
.then((document) => document?.firstElementChild);
} on Exception {
_contentAsXml = null;
}
}
return _contentAsXml;
}