fromUri static method
Future<XmlDocument?>
fromUri(
- String uri, {
- bool parseCharacterEntities = true,
- bool parseComments = false,
- bool trimWhitespace = true,
- bool parseCdataAsText = true,
override
Attempts to load and parse a XML document from a URI.
If parseCharacterEntities
is true
, text
and attribute values
will be parsed for character entities and replaced with their
corresponding characters.
If parseComments
is true
, commments will be scrubbed
from string
before parsing.
If trimWhitespace
is true
, unnecessary whitespace between nodes
will be removed and all remaining whitespace will be replaced with
a single space. trimWhitespace
must not be null
.
If parseCdataAsText
is true
, all CDATA sections will be
returned as XmlText nodes. parseCdataAsText
must not be null
.
Returns null
if the document couldn't be reached or is empty.
Implementation
static Future<XmlDocument?> fromUri(
String uri, {
bool parseCharacterEntities = true,
bool parseComments = false,
bool trimWhitespace = true,
bool parseCdataAsText = true,
}) async {
final XmlDocument document = await XmlNode.fromUri(
uri,
parseCharacterEntities: parseCharacterEntities,
parseComments: parseComments,
trimWhitespace: trimWhitespace,
returnNodesOfType: [XmlDocument],
parseCdataAsText: parseCdataAsText,
);
return document;
}