XmlEventDecoder constructor

XmlEventDecoder({
  1. XmlEntityMapping? entityMapping,
  2. bool validateDocument = false,
  3. bool validateNamespace = false,
  4. bool validateNesting = false,
  5. bool withLocation = false,
  6. bool withNamespace = false,
  7. bool withParent = false,
})

Creates a new XmlEventDecoder.

If validateDocument is true, the parser validates that the root elements of the input follow the requirements of an XML document. This means the document consists of an optional declaration, an optional doctype, and a single root element.

If validateNamespace is true, the parser validates the declaration and use of namespaces and throws a XmlNamespaceException if there is a problem.

If validateNesting is true, the parser validates the nesting of tags and throws an XmlTagException if there is a mismatch or tags are not closed. Again, in case of an error iteration can be resumed with the next event.

Furthermore, the following annotations can be enabled if needed:

  • If withLocation is true, each event is annotated with the starting and stopping position (exclusive) of the event in the input buffer.
  • If withNamespace is true, the namespace of the element is resolved and added to the event.
  • If withParent is true, each event is annotated with its logical parent event.

Implementation

XmlEventDecoder({
  XmlEntityMapping? entityMapping,
  this.validateDocument = false,
  this.validateNamespace = false,
  this.validateNesting = false,
  this.withLocation = false,
  this.withNamespace = false,
  this.withParent = false,
}) : entityMapping = entityMapping ?? defaultEntityMapping;