Struct Cursor

An implementation of the isCursor trait.

This is the only provided cursor that builds on top of a parser (and not on top of another cursor), so it is part of virtually every parsing chain. All documented methods are implementations of the specifications dictated by isCursor.

Template arguments

struct Cursor(P, std.typecons.Flag!("conflateCDATA").Flag conflateCDATA, ErrorHandler)
if (isLowLevelParser!P);

Constructors

Name Description
this Generic constructor; forwards its arguments to the parser constructor

Methods

Name Description
atBeginning Returns whether the cursor is at the beginning of the document (i.e. whether no enter/next/exit has been performed successfully and thus the cursor points to the xml declaration)
attributes If the current node is an element, return its attributes as a range of triplets (prefix, name, value); if the current node is the document node, return the attributes of the xml declaration (encoding, version, ...); otherwise, returns an empty array.
content Return the text content of a cdata section, a comment or a text node; in all other cases, returns the entire node without the name
documentEnd Returns whether the cursor is at the end of the document.
enter Advances to the first child of the current node and returns true. If it returns false, the cursor is either on the same node (it wasn't an element start) or it is at the close tag of the element it was called on (it was a pair open/close tag without any content)
exit Advances to the end of the parent of the current node.
kind Returns the kind of the current node.
localName If the current node is an element, returns its local name (without namespace prefix); otherwise, returns the same result as name.
name If the current node is an element or a doctype, returns its complete name; it it is a processing instruction, return its target; otherwise, returns an empty string;
next Advances to the next sibling of the current node. Returns whether it succeded. If it fails, either the document has ended or the only meaningful operation is exit.
prefix If the current node is an element, returns its namespace prefix; otherwise, the result in unspecified;
setErrorHandler Overrides the current error handler with a new one. It will be called whenever a non-fatal error occurs. The default handler abort parsing by throwing an exception.
wholeContent Returns the entire text of the current node.

Aliases

Name Description
CharacterType The type of characters in the input, as returned by the underlying low level parser.
StringType The type of sequences of CharacterType, as returned by this parser

Authors

Lodovico Giaretta

Copyright

Copyright Lodovico Giaretta 2016 --

License

Boost License 1.0.