Server IP : 103.119.228.120 / Your IP : 18.188.227.192 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/lib64/perl5/XML/LibXML/SAX/ |
Upload File : |
# $Id$ # # This is free software, you may use it and distribute it under the same terms as # Perl itself. # # Copyright 2001-2003 AxKit.com Ltd., 2002-2006 Christian Glahn, 2006-2009 Petr Pajas # # package XML::LibXML::SAX::Builder; use strict; use warnings; use XML::LibXML; use XML::NamespaceSupport; use vars qw ($VERSION); sub CLONE_SKIP { return $XML::LibXML::__threads_shared ? 0 : 1; } $VERSION = "2.0128"; # VERSION TEMPLATE: DO NOT CHANGE sub new { my $class = shift; return bless {@_}, $class; } sub result { $_[0]->{LAST_DOM}; } sub done { my ($self) = @_; my $dom = $self->{DOM}; $dom = $self->{Parent} unless defined $dom; # this is for parsing document chunks delete $self->{NamespaceStack}; delete $self->{Parent}; delete $self->{DOM}; $self->{LAST_DOM} = $dom; return $dom; } sub set_document_locator { } sub start_dtd { my ($self, $dtd) = @_; if (defined $dtd->{Name} and (defined $dtd->{SystemId} or defined $dtd->{PublicId})) { $self->{DOM}->createExternalSubset($dtd->{Name},$dtd->{PublicId},$dtd->{SystemId}); } } sub end_dtd { } sub start_document { my ($self, $doc) = @_; $self->{DOM} = XML::LibXML::Document->createDocument(); if ( defined $self->{Encoding} ) { $self->xml_decl({Version => ($self->{Version} || '1.0') , Encoding => $self->{Encoding}}); } $self->{NamespaceStack} = XML::NamespaceSupport->new; $self->{NamespaceStack}->push_context; $self->{Parent} = undef; return (); } sub xml_decl { my $self = shift; my $decl = shift; if ( defined $decl->{Version} ) { $self->{DOM}->setVersion( $decl->{Version} ); } if ( defined $decl->{Encoding} ) { $self->{DOM}->setEncoding( $decl->{Encoding} ); } return (); } sub end_document { my ($self, $doc) = @_; my $d = $self->done(); return $d; } sub start_prefix_mapping { my $self = shift; my $ns = shift; unless ( defined $self->{DOM} or defined $self->{Parent} ) { $self->{Parent} = XML::LibXML::DocumentFragment->new(); $self->{NamespaceStack} = XML::NamespaceSupport->new; $self->{NamespaceStack}->push_context; } $self->{USENAMESPACESTACK} = 1; $self->{NamespaceStack}->declare_prefix( $ns->{Prefix}, $ns->{NamespaceURI} ); return (); } sub end_prefix_mapping { my $self = shift; my $ns = shift; $self->{NamespaceStack}->undeclare_prefix( $ns->{Prefix} ); return (); } sub start_element { my ($self, $el) = @_; my $node; unless ( defined $self->{DOM} or defined $self->{Parent} ) { $self->{Parent} = XML::LibXML::DocumentFragment->new(); $self->{NamespaceStack} = XML::NamespaceSupport->new; $self->{NamespaceStack}->push_context; } if ( defined $self->{Parent} ) { $el->{NamespaceURI} ||= ""; $node = $self->{Parent}->addNewChild( $el->{NamespaceURI}, $el->{Name} ); } else { if ($el->{NamespaceURI}) { if ( defined $self->{DOM} ) { $node = $self->{DOM}->createRawElementNS($el->{NamespaceURI}, $el->{Name}); } else { $node = XML::LibXML::Element->new( $el->{Name} ); $node->setNamespace( $el->{NamespaceURI}, $el->{Prefix} , 1 ); } } else { if ( defined $self->{DOM} ) { $node = $self->{DOM}->createRawElement($el->{Name}); } else { $node = XML::LibXML::Element->new( $el->{Name} ); } } $self->{DOM}->setDocumentElement($node); } # build namespaces my $skip_ns= 0; foreach my $p ( $self->{NamespaceStack}->get_declared_prefixes() ) { $skip_ns= 1; my $uri = $self->{NamespaceStack}->get_uri($p); my $nodeflag = 0; if ( defined $uri and defined $el->{NamespaceURI} and $uri eq $el->{NamespaceURI} ) { # $nodeflag = 1; next; } $node->setNamespace($uri, $p, 0 ); } $self->{Parent} = $node; $self->{NamespaceStack}->push_context; # do attributes foreach my $key (keys %{$el->{Attributes}}) { my $attr = $el->{Attributes}->{$key}; if (ref($attr)) { # catch broken name/value pairs next unless $attr->{Name} ; next if $self->{USENAMESPACESTACK} and ( $attr->{Name} eq "xmlns" or ( defined $attr->{Prefix} and $attr->{Prefix} eq "xmlns" ) ); if ( defined $attr->{Prefix} and $attr->{Prefix} eq "xmlns" and $skip_ns == 0 ) { # ok, the generator does not set namespaces correctly! my $uri = $attr->{Value}; $node->setNamespace($uri, $attr->{LocalName}, $uri eq $el->{NamespaceURI} ? 1 : 0 ); } else { $node->setAttributeNS($attr->{NamespaceURI} || "", $attr->{Name}, $attr->{Value}); } } else { $node->setAttribute($key => $attr); } } return (); } sub end_element { my ($self, $el) = @_; return unless $self->{Parent}; $self->{NamespaceStack}->pop_context; $self->{Parent} = $self->{Parent}->parentNode(); return (); } sub start_cdata { my $self = shift; $self->{IN_CDATA} = 1; return (); } sub end_cdata { my $self = shift; $self->{IN_CDATA} = 0; return (); } sub characters { my ($self, $chars) = @_; if ( not defined $self->{DOM} and not defined $self->{Parent} ) { $self->{Parent} = XML::LibXML::DocumentFragment->new(); $self->{NamespaceStack} = XML::NamespaceSupport->new; $self->{NamespaceStack}->push_context; } return unless $self->{Parent}; my $node; unless ( defined $chars and defined $chars->{Data} ) { return; } if ( defined $self->{DOM} ) { if ( defined $self->{IN_CDATA} and $self->{IN_CDATA} == 1 ) { $node = $self->{DOM}->createCDATASection($chars->{Data}); } else { $node = $self->{Parent}->appendText($chars->{Data}); return; } } elsif ( defined $self->{IN_CDATA} and $self->{IN_CDATA} == 1 ) { $node = XML::LibXML::CDATASection->new($chars->{Data}); } else { $node = XML::LibXML::Text->new($chars->{Data}); } $self->{Parent}->addChild($node); return (); } sub comment { my ($self, $chars) = @_; my $comment; if ( not defined $self->{DOM} and not defined $self->{Parent} ) { $self->{Parent} = XML::LibXML::DocumentFragment->new(); $self->{NamespaceStack} = XML::NamespaceSupport->new; $self->{NamespaceStack}->push_context; } unless ( defined $chars and defined $chars->{Data} ) { return; } if ( defined $self->{DOM} ) { $comment = $self->{DOM}->createComment( $chars->{Data} ); } else { $comment = XML::LibXML::Comment->new( $chars->{Data} ); } if ( defined $self->{Parent} ) { $self->{Parent}->addChild($comment); } else { $self->{DOM}->addChild($comment); } return (); } sub processing_instruction { my ( $self, $pi ) = @_; my $PI; return unless defined $self->{DOM}; $PI = $self->{DOM}->createPI( $pi->{Target}, $pi->{Data} ); if ( defined $self->{Parent} ) { $self->{Parent}->addChild( $PI ); } else { $self->{DOM}->addChild( $PI ); } return (); } sub warning { my $self = shift; my $error = shift; # fill $@ but do not die seriously eval { $error->throw; }; } sub error { my $self = shift; my $error = shift; delete $self->{NamespaceStack}; delete $self->{Parent}; delete $self->{DOM}; $error->throw; } sub fatal_error { my $self = shift; my $error = shift; delete $self->{NamespaceStack}; delete $self->{Parent}; delete $self->{DOM}; $error->throw; } 1; __END__