from static method
Returns the first node found in string
. string
must not be null
.
If parseCharacterEntities
is true
, text values will be parsed
and replace all encoded character entities with their corresponding
character. parseCharacterEntities
must not be null
.
If parseComments
is true
, commments will be scrubbed
from string
before parsing. parseComments
must not be null
.
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 returnNodesOfType
is not null
, only the nodes of the types
contained in returnNodesOfType
will be returned, otherwise, all
nodes, regardless of type, will be returned.
Returns null
if string
is empty.
Implementation
static XmlNode? from(
String string, {
bool parseCharacterEntities = true,
bool parseComments = false,
bool trimWhitespace = true,
bool parseCdataAsText = true,
List<Type>? returnNodesOfType,
}) {
return parseString(
string,
parseCharacterEntities: parseCharacterEntities,
parseComments: parseComments,
trimWhitespace: trimWhitespace,
parseCdataAsText: parseCdataAsText,
stop: 0,
)?.first;
}