package obus
Install
Dune Dependency
Authors
Maintainers
Sources
md5=81eb1034c6ef4421a2368a9b352199de
sha512=4b540497188a7d78f4f14f94c6b7fdff47dd06436a34e650ff378dd77bb3e2acb7afd45cd72daf4ddba06e732e9944d560c2882dc37862f1b1f1bb6df37e6205
doc/obus.internals/OBus_xml_parser/index.html
Module OBus_xml_parser
Source
Monadic xml parsing
This module implements a simple monadic xml parser.
It is intended to make it easy to write XML document parsers. In OBus it is used to parse introspection document.
Type of an xml parser. It is used to parse a sequence of arguments and children of an element.
Type of a single xml node parser, returning a value of type 'a
Fail at current position with the given error message
Run a parser on a xml input. If it fails it raises a Parse_failure
Parsing of attributes
For the following functions, the first argument is the attribute name and each letter mean:
o
: the attribute is optionnalr
: the attribute is requiredd
: a default value is givenf
: a associative list for the attribute value is specified.
Parsing of elements
elt typ parser
creates a node parser. It will parse element of type typ
. parser
is used to parse the attributes and children of the element.
Note that parser
must consume all children, if some are left unparsed the parsing will fail.
union nodes
Node parser which parses any node matched by one of the given node parsers
Modifiers
one node
parse exactly one node with the given node parser. It will fail if there is 0 or more than one node matched by node
.
same as one
but do not fail if there is no node matched by node
.
any node
Parse all element matched by node
. The resulting list is in the same order as the order in which nodes appears in the xml.