File: AttributeNode.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 (41 lines) | stat: -rw-r--r-- 782 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
38
39
40
41
package XML::Validator::Schema::AttributeNode;
use base 'XML::Validator::Schema::Node';
use strict;
use warnings;

use XML::Validator::Schema::Util qw(_attr _err);
use Carp qw(confess);

=head1 NAME

XML::Validator::Schema::AttributeNode - internal module

=head1 DESCRIPTION

Temporary node in the schema parse tree to represent an attribute.

=cut

sub parse {
    my ($pkg, $data) = @_;
    my $self = $pkg->new();

    # squirl away data for latter use
    $self->{data} = $data;

    return $self;
}

sub compile {
    my ($self) = shift;

    # create a new attribute object and return it
    my $attr = XML::Validator::Schema::Attribute->parse($self->{data});

    # copy in type info if available
    $attr->{type} = $self->{type} if $self->{type};

    return $attr;
}

1;