XmlDocument class

A XML document.

It contains optional XML Declaration and Document Type Declarations, and a root element that contains every other element nested within it.

Inheritance
Annotations
  • @immutable

Constructors

XmlDocument(List<XmlNode> children)
A XML document.
const

Properties

children List<XmlNode>
The list of root level nodes in this document.
final
doctype XmlDoctype?
The XML document type definition.
no setter
firstChild XmlElement?
Returns the first XmlElement found in children.
no setterinherited
hasChildren bool
Returns true if children isn't null or empty.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
lastChild XmlElement?
Returns the last XmlElement found in children.
no setterinherited
root XmlElement?
The root level element.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
xmlDeclaration XmlDeclaration?
The raw value of the XML document declaration.
no setter

Methods

getChild(String elementName) XmlElement?
Returns the first direct child named elementName.
inherited
getChildren(String elementName, {int start = 0, int? stop}) List<XmlElement>?
Returns all direct children named elementName.
inherited
getChildrenWhere({String? name, String? id, List<String>? attributeNames, List<XmlAttribute>? attributes, bool matchAllAttributes = false, bool attributesMustBeIdentical = false, List<XmlNode>? children, bool matchAllChildren = false, bool childrenMustBeIdentical = false, int start = 0, int? stop}) List<XmlElement>?
Returns all direct children with properties matching those specified.
inherited
getChildWhere({String? name, String? id, List<String>? attributeNames, List<XmlAttribute>? attributes, bool matchAllAttributes = false, bool attributesMustBeIdentical = false, List<XmlNode>? children, bool matchAllChildren = false, bool childrenMustBeIdentical = false}) XmlElement?
Returns all direct children with properties matching those specified.
inherited
getElement(String elementName) XmlElement?
Recursively checks all elements within this node tree and returns the first element found named elementName.
inherited
getElements(String elementName, {bool ignoreNestedMatches = true, int start = 0, int? stop}) List<XmlElement>?
Recursively checks all elements within this node tree and returns any elements found named elementName.
inherited
getElementsWhere({String? name, String? id, List<String>? attributeNames, List<XmlAttribute>? attributes, bool matchAllAttributes = false, bool attributesMustBeIdentical = false, List<XmlNode>? children, bool matchAllChildren = false, bool childrenMustBeIdentical = false, bool ignoreNestedMatches = true, int start = 0, int? stop, bool global = true, bool reversed = false}) List<XmlElement>?
Recursively checks all elements within the node tree and returns any elements found with properties matching those specified.
inherited
getElementWhere({String? name, String? id, List<String>? attributeNames, List<XmlAttribute>? attributes, bool matchAllAttributes = false, bool attributesMustBeIdentical = false, List<XmlNode>? children, bool matchAllChildren = false, bool childrenMustBeIdentical = false}) XmlElement?
Recursively checks all elements within the node tree and returns the first element found with properties matching those specified.
inherited
getLastChild(String elementName) XmlElement?
Returns the last direct child named elementName.
inherited
getLastChildWhere({String? name, String? id, List<String>? attributeNames, List<XmlAttribute>? attributes, bool matchAllAttributes = false, bool attributesMustBeIdentical = false, List<XmlNode>? children, bool matchAllChildren = false, bool childrenMustBeIdentical = false}) XmlElement?
Returns the last direct child with properties matching those specified.
inherited
getLastElement(String elementName) XmlElement?
Recursively checks all elements within this node tree and returns the last element found named elementName.
inherited
getLastElementWhere({String? name, String? id, List<String>? attributeNames, List<XmlAttribute>? attributes, bool matchAllAttributes = false, bool attributesMustBeIdentical = false, List<XmlNode>? children, bool matchAllChildren = false, bool childrenMustBeIdentical = false}) XmlElement?
Recursively checks all elements within the node tree and returns the last element found with properties matching those specified.
inherited
getNthChild(int index, String elementName) XmlElement?
Returns the nth direct child named elementName.
inherited
getNthChildWhere(int index, {String? name, String? id, List<String>? attributeNames, List<XmlAttribute>? attributes, bool matchAllAttributes = false, bool attributesMustBeIdentical = false, List<XmlNode>? children, bool matchAllChildren = false, bool childrenMustBeIdentical = false}) XmlElement?
Returns the nth direct child with properties matching those specified.
inherited
getNthElement(int index, String elementName, {bool ignoreNestedMatches = true}) XmlElement?
Recursively checks all elements within this node tree and returns the nth element found named elementName.
inherited
getNthElementWhere(int index, {String? name, String? id, List<String>? attributeNames, List<XmlAttribute>? attributes, bool matchAllAttributes = false, bool attributesMustBeIdentical = false, List<XmlNode>? children, bool matchAllChildren = false, bool childrenMustBeIdentical = false}) XmlElement?
Recursively checks all elements within the node tree and returns the nth element found with properties matching those specified.
inherited
hasChild(String elementName) bool
Returns true if this element contains a direct child named elementName.
inherited
hasChildWhere({String? name, String? id, List<String>? attributeNames, List<XmlAttribute>? attributes, bool matchAllAttributes = false, bool attributesMustBeIdentical = false, List<XmlNode>? children, bool matchAllChildren = false, bool childrenMustBeIdentical = false}) bool
Returns true if children contains a direct child with properties matching those specified.
inherited
hasElement(String elementName) bool
Recursively checks all nested elements and returns true if one is found named elementName.
inherited
hasElementWhere({String? name, String? id, List<String>? attributeNames, List<XmlAttribute>? attributes, bool matchAllAttributes = false, bool attributesMustBeIdentical = false, List<XmlNode>? children, bool matchAllChildren = false, bool childrenMustBeIdentical = false, bool global = false}) bool
Recursively checks all nested elements and returns true if one is found with properties matching those specified.
inherited
loadExternalDtd() Future<void>
Attempts to load all external DTD references contained within the XmlDoctype and nested XmlEntitys, load the pages they reference, and parse the DTD elements contained within.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
nthChild(int index) XmlElement?
Returns the nth XmlElement found in children.
inherited
toFormattedString({int nestingLevel = 0, String indent = '\t'}) String
Returns this document as a formatted XML string.
override
toString({bool doubleQuotes = true, bool encodeCharacterEntities = true, String? encodeCharacters}) String
Returns this document as a single-line XML string.
override

Operators

operator ==(Object o) bool
The equality operator.
override

Static Methods

from(String document, {bool parseCharacterEntities = true, bool parseComments = false, bool trimWhitespace = true, bool parseCdataAsText = true}) XmlDocument?
Parses a XML string for its XML document declaration, DocType declaration, and its root element.
override
fromUri(String uri, {bool parseCharacterEntities = true, bool parseComments = false, bool trimWhitespace = true, bool parseCdataAsText = true}) Future<XmlDocument?>
Attempts to load and parse a XML document from a URI.
override