<commit_before>
package PRANG;

1;

__END__

=encoding utf8

=head1 NAME

PRANG - XML graph engine - XML to Moose objects and back!

=head1 SYNOPSIS

 # step 1. define a common role for nodes in your XML language
 package XML::Language::Node;
 use Moose::Role;
 sub xmlns { "http://example.com/language/1.0" }

 # step 2. define the root node(s) of your language
 package XML::Language;
 use Moose;
 use PRANG::Graph;
 sub root_element {
     "envy"
 };
 has_attr 'laziness' =>
      is => "ro",
      isa => "Str",
      ;
 has_element 'lust' =>
      is => "ro",
      isa => "XML::Language::Lust",
      ;
 with 'PRANG::Graph', 'XML::Language::Node';

 # step 3. define further elements in your schema
 package XML::Language::Lust;
 use Moose;
 use PRANG::Graph;
 use PRANG::XMLSchema::Types;

 has_attr 'gluttony' =>
      is => "ro",
      isa => "PRANG::XMLSchema::byte",
      ;
 has_element 'sins' =>
      is => "ro",
      isa => "ArrayRef[XML::Language::Lust|Str]",
      xml_nodeName => {
          'lust' => 'XML::Language::Lust',
          'anger' => 'Str',
      },
      ;
 has_element 'greed' =>
      is => "ro",
      isa => "Bool",
      ;
 with 'XML::Language::Node';

 # step 4a.  parse!
 my $object = XML::Language->parse(<<XML);
 <envy laziness="Very">
   <lust gluttony="127">
     <anger>You wouldn't like me when I'm angry</anger>
     <lust>
       <anger>You've done it now!</anger>
       <greed />
     </lust>
   </lust>
 </envy>
 XML;

 # Parsing the above would give you the same structure as this:
 XML::Language->new(
     laziness => "Very",
     lust => XML::Language::Lust->new(
         gluttony => 127,
         sins => [
             "You wouldn't like me when I'm angry",
             XML::Language::Lust->new(
                 sins => [ "You've done it now!" ],
                 greed => 1,
             ),
         ],
     );

 # step 4b.  emit!
 $format = 1;
 print $object->to_xml($format);

=head1 DESCRIPTION

PRANG is an B<XML Graph> engine, which provides B<post-schema
validation objects> (PSVO).

It is designed for implementing XML languages for which a description
of the valid sets of XML documents is available - for example, a DTD,
W3C XML Schema or Relax specification.  With PRANG (and, like
L<XML::Toolkit>), your class structure I<is> your XML Graph.

XML namespaces are supported, and the module tries to make many XML
conventions as convenient as possible in the generated classes.  This
includes XML data (elements with no attributes and textnode contents),
and presence elements (empty elements with no attributes which
indicate something).  It also supports mixed and unprocessed portions
of the XML, and "pluggable" specifications.<commit_msg>fix syntax errors in example POD<commit_after>
package PRANG;

1;

__END__

=encoding utf8

=head1 NAME

PRANG - XML graph engine - XML to Moose objects and back!

=head1 SYNOPSIS

 # step 1. define a common role for nodes in your XML language
 package XML::Language::Node;
 use Moose::Role;
 sub xmlns { "http://example.com/language/1.0" }

 # step 2. define the root node(s) of your language
 package XML::Language;
 use Moose;
 use PRANG::Graph;
 sub root_element {
     "envy"
 };
 has_attr 'laziness' =>
      is => "ro",
      isa => "Str",
      ;
 has_element 'lust' =>
      is => "ro",
      isa => "XML::Language::Lust",
      ;
 with 'PRANG::Graph', 'XML::Language::Node';

 # step 3. define further elements in your schema
 package XML::Language::Lust;
 use Moose;
 use PRANG::Graph;
 use PRANG::XMLSchema::Types;

 has_attr 'gluttony' =>
      is => "ro",
      isa => "PRANG::XMLSchema::byte",
      ;
 has_element 'sins' =>
      is => "ro",
      isa => "ArrayRef[XML::Language::Lust|Str]",
      xml_nodeName => {
          'lust' => 'XML::Language::Lust',
          'anger' => 'Str',
      },
      ;
 has_element 'greed' =>
      is => "ro",
      isa => "Bool",
      ;
 with 'XML::Language::Node';

 # step 4a.  parse!
 my $object = XML::Language->parse(<<XML);
 <envy laziness="Very">
   <lust gluttony="127">
     <anger>You wouldn't like me when I'm angry</anger>
     <lust>
       <anger>You've done it now!</anger>
       <greed />
     </lust>
   </lust>
 </envy>
 XML

 # Parsing the above would give you the same structure as this:
 XML::Language->new(
     laziness => "Very",
     lust => XML::Language::Lust->new(
         gluttony => 127,
         sins => [
             "You wouldn't like me when I'm angry",
             XML::Language::Lust->new(
                 sins => [ "You've done it now!" ],
                 greed => 1,
             ),
         ],
     )
 );

 # step 4b.  emit!
 $format = 1;
 print $object->to_xml($format);

=head1 DESCRIPTION

PRANG is an B<XML Graph> engine, which provides B<post-schema
validation objects> (PSVO).

It is designed for implementing XML languages for which a description
of the valid sets of XML documents is available - for example, a DTD,
W3C XML Schema or Relax specification.  With PRANG (and, like
L<XML::Toolkit>), your class structure I<is> your XML Graph.

XML namespaces are supported, and the module tries to make many XML
conventions as convenient as possible in the generated classes.  This
includes XML data (elements with no attributes and textnode contents),
and presence elements (empty elements with no attributes which
indicate something).  It also supports mixed and unprocessed portions
of the XML, and "pluggable" specifications.
{'fraction_non_alphanumeric': 0.13081021495498807, 'fraction_numerical': 0.007716332904648172, 'mean_word_length': 2.817671809256662, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2519221', 'n_tokens_mistral': 1771, 'n_tokens_neox': 1690, 'n_words': 592}