XML-SAX

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

t/11xmldecl2.t
t/12miscstart.t
t/13int_ent.t
t/14encoding.t
t/15element.t
t/16large.t
t/19pi.t
t/20factory.t
t/21saxini.t
t/30parse_file.t
t/40cdata.t
t/42entities.t
t/99cleanup.t
testfiles/01.xml
testfiles/02a.xml
testfiles/02b.xml
testfiles/03a.xml
testfiles/03b.xml
testfiles/04a.xml
testfiles/06a.xml
testfiles/06b.xml

lib/XML/SAX/PurePerl.pm  view on Meta::CPAN

    return 1;
}

sub CDSect {
    my ($self, $reader) = @_;
    
    my $data = $reader->data(9);
    return 0 unless $data =~ /^<!\[CDATA\[/;
    $reader->move_along(9);
    
    $self->start_cdata({});
    
    $data = $reader->data;
    while (1) {
        $self->parser_error("EOF looking for CDATA section end", $reader)
            unless length($data);
        
        if ($data =~ /^(.*?)\]\]>/s) {
            my $chars = $1;
            $reader->move_along(length($chars) + 3);
            $self->characters({Data => $chars});
            last;
        }
        else {
            $self->characters({Data => $data});
            $reader->move_along(length($data));
            $data = $reader->data;
        }
    }
    $self->end_cdata({});
    return 1;
}

sub CharData {
    my ($self, $reader) = @_;
    
    my $data = $reader->data;
    
    while (1) {
        return unless length($data);

lib/XML/SAX/PurePerl.pm  view on Meta::CPAN

    
    my $data = $reader->data(2);
    return if $data =~ /^\/?>/;
    
    if (my $name = $self->Name($reader)) {
        $self->skip_whitespace($reader);
        $reader->match('=') or $self->parser_error("No '=' in Attribute", $reader);
        $self->skip_whitespace($reader);
        my $value = $self->AttValue($reader);

        if (!$self->cdata_attrib($name)) {
            $value =~ s/^\x20*//; # discard leading spaces
            $value =~ s/\x20*$//; # discard trailing spaces
            $value =~ s/ {1,}/ /g; # all >1 space to single space
        }
        
        return $name, $value;
    }
    
    return;
}

sub cdata_attrib {
    # TODO implement this!
    return 1;
}

sub AttValue {
    my ($self, $reader) = @_;
    
    my $quote = $self->quote($reader);
    
    my $value = '';

testfiles/xmltest.xml  view on Meta::CPAN

	URI="not-wf/sa/109.xml" SECTIONS="4.2 [70]">
    Tags invalid within EntityDecl. </TEST>
<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-110"
	URI="not-wf/sa/110.xml" SECTIONS="4.1 [68]">
    Entity reference must be in content of element. </TEST>
<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-111"
	URI="not-wf/sa/111.xml" SECTIONS="3.1 [43]">
    Entiry reference must be in content of element not Start-tag. </TEST>
<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-112"
	URI="not-wf/sa/112.xml" SECTIONS="2.7 [19]">
    CDATA sections start '&lt;![CDATA[', not '&lt;!cdata['.</TEST>
<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-113"
	URI="not-wf/sa/113.xml" SECTIONS="2.3 [9]">
    Parameter entity values must use valid reference syntax;
    this reference is malformed.</TEST>
<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-114"
	URI="not-wf/sa/114.xml" SECTIONS="2.3 [9]">
    General entity values must use valid reference syntax;
    this reference is malformed.</TEST>
<TEST TYPE="not-wf" ENTITIES="none" ID="not-wf-sa-115"
	URI="not-wf/sa/115.xml" SECTIONS="4.5">



( run in 0.244 second using v1.01-cache-2.11-cpan-454fe037f31 )