File: Node.pm

package info (click to toggle)
libxml-validator-schema-perl 1.10-2.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 708 kB
  • sloc: perl: 3,682; xml: 16; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 738 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package XML::Validator::Schema::Node;
use base qw(Tree::DAG_Node);

=head1 NAME

XML::Validator::Schema::Node - base class

=head1 DESCRIPTION

Base class for nodes in the schema tree.  Used by both temporary nodes
resolved during compilation (ex. ::ModelNode) and permanent nodes
(ex. ::ElementNode).

This is an abstract base class and may not be directly instantiated.

=cut

sub new {
    my $pkg = shift;
    croak("Illegal attempt to instantiate a Node directly!")
      if $pkg eq __PACKAGE__;
    return $pkg->SUPER::new(@_);
}

sub parse {
    my $pkg = shift;
    croak("$pkg neglected to supply a parse() implementation!");
}

# override to declare root-ness
sub is_root {
    return 0 if shift->{mother};
    return 1;
}

1;