NAME

XML::Invisible::Receiver - XML::Invisible Pegex AST constructor

SYNOPSIS

  my $grammar = Pegex::Grammar->new(text => $grammar_text);
  my $parser = Pegex::Parser->new(
    grammar => $grammar,
    receiver => XML::Invisible::Receiver->new,
  );
  my $got = $parser->parse($ixml_text);

DESCRIPTION

Subclass of Pegex::Receiver to turn Pegex parsing events into data usable by XML::Invisible.

The AST returned represents an XML document with a hash-ref with these keys:

nodename
attributes

A hash-ref mapping name to value, since XML attributes can each only occur once on an element, and the ordering is semantically meaningless.

children

An array-ref of child nodes. If the node is a simple scalar, it is a text node.

type

This will be element at the top level.