ixp_runtime library

Utilities for writing an XML parser.

These add extension methods to XML Events and a StreamQueue of XML Events, enabling code such as: ` const NoteName = 'Note';

Future

Preparing the stream:

generateEventsStream prepares the StreamQueue for use:

StreamQueue(source.toXmlEvents().withParentEvents().normalizeEvents().flatten());

You will need to call these yourself if your input isn't a Stream<String>.

Classes

Convert
Conversion methods from String to the Dart primitive types.
EndOfQueue
Indicates that the parser ran out of XML Events while looking for the end of a tag.
MissingAttribute
Indicates that an expected attribute wasn't found.
MissingEndTag
Indicates that an end tag wasn't found for the current start tag.
MissingStartTag
Indicates that an expected (and required) start tag wasn't found.
MissingText
Indicates that expected text wasn't found.
ParsingError
UnexpectedChild

Extensions

Ancestors on XmlParented
AttributeExtension on XmlStartElementEvent
Consume on StreamQueue<XmlEvent>
Find on StreamQueue<XmlEvent>
Logging on XmlStartElementEvent

Functions

autoConverter(Type T) Converter
Returns a converter from String to the specified primitive type.
generateEventStream(Stream<String> source) → StreamQueue<XmlEvent>
Converts a stream of Strings, such as from a file, to to a StreamQueue of XML Events ready for parsing.
inside(XmlStartElementEvent tag) Matcher<XmlEvent>
True if the current event is the between the specified start tag and its end tag, inclusive.
named(String desiredName) Matcher<XmlEvent>
Matches tags with the provided qualified name.
not(Matcher<XmlEvent> match) Matcher<XmlEvent>
startTag([Matcher<XmlEvent>? match]) Matcher<XmlStartElementEvent>
Wraps another matcher so it only sees XmlStartElementEvent.
textElement([Matcher<XmlEvent>? match]) Matcher<XmlTextEvent>
Wraps another matcher so it only sees XmlTextEvent.

Typedefs

Converter<T> = dynamic Function(String s)
Matcher<T extends XmlEvent> = bool Function(XmlEvent event)