package aXML::Parser; use Modern::Perl; use aXML::Engine; my ( $aXML,$env,$qd,$session,$cookie,$conf,$dbh,$debug_trace ); sub process { $aXML = $_[0]; $env = $_[1]; $qd = $_[2]; $session = $_[3]; $cookie = $_[4]; $conf = $_[5]; $dbh = $_[6]; $aXML =~ s@`@@g; my $plugins = aXML::Engine::init( $env,$qd,$session,$cookie,$conf,$dbh ); $aXML::Engine::scan_more = 1; my $tag_found; while ($aXML::Engine::scan_more) { $aXML::Engine::scan_more = 0; $aXML::Engine::redo = 0; $tag_found = 0; $aXML =~ s@\(([^/\s\)]+)([^\)]*?)\)@ do { if (defined $plugins->{ $1 }) { $tag_found = 1; "(`$1$2)" } else { "($1$2)" } } @egs; if ( $tag_found ) { while($aXML =~ s@\(`([^`\s]+)([^`\)]*?)\)([^`]*?)\(/\1\)@ do { my $command_args = aXML::Engine::parse_args( "$1$2" ); my $data = $3; $data =~ s///gs; $plugins->{ $command_args->{'tag_name'} }->( $data,$command_args ); } @egs ){} } unless ( $aXML::Engine::redo ) { $tag_found = 0; $aXML =~ s@<([^/\s>]+)([^>]*?)>@ do { if (defined $plugins->{ $1 }) { $tag_found = 1; "<`$1$2>" } else { "<$1$2>" } } @egs; if ( $tag_found ) { while($aXML =~ s@<`([^`\s]+)([^`\>]*?)>([^`]*?)@ do { my $command_args = aXML::Engine::parse_args( "$1$2" ); my $data = $3; $data =~ s///gs; $plugins->{ $command_args->{'tag_name'} }->( $data,$command_args ); } @egs ){} } } unless ( $aXML::Engine::redo ) { $tag_found = 0; $aXML =~ s@\[([^/\s\]]+)([^\]]*?)\]@ do { if (defined $plugins->{ $1 }) { $tag_found = 1; "[`$1$2]" } else { "[$1$2]" } } @egs; if ( $tag_found ) { while($aXML =~ s@\[`([^`\s\]]+)([^`\]]*?)\]([^`]*?)\[/\1\]@ do { my $command_args = aXML::Engine::parse_args( "$1$2" ); my $data = $3; $data =~ s///gs; $plugins->{ $command_args->{'tag_name'} }->( $data,$command_args ); } @egs ){} } } } $aXML =~ s@`@@gs; $aXML =~ s@@`@gs; $aXML =~ s@@@gs; return "$aXML $debug_trace" if $debug_trace; return $aXML; } 1;