Не могу догнать и faq что то не очень помогает:
Когда загружаю файл он обрабатывается идя через js > php > perl и вывод результатов в xml файле.
в конфиге php регулярном выражении присутствует амперсанд &
дык этот амперсанд в xml файле и вызывает синтаксическую ошибку.
Генерирует xml файл сам perl и вот думаю решить эту проблему с амперсандом в xml
добавив строку в perl поиск и замена, заменив & на &
Но блин у меня не получается... буду Вам признателен.
вот сам скрипт perl, надеюсь джустусер или кто-нибудь зная поможет с перл:
В 17 строке переменная $config{$config_setting} вот в этой переменной и находится инклуденая регулярное выражение в котором и присутствует амперсанд.
CODE ( perl):
скопировать код в буфер обмена
########################################################################## # Write a XML file containing configuration upload and post information ########################################################################## sub write_uu_file{ my $uploaded_files = shift; my @names = $query->param; $file_handle->print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); $file_handle->print("<uu_upload>\n"); $file_handle->print(" <config>\n"); # Write config values foreach my $config_setting (sort keys(%config)){ $file_handle->print(" <$config_setting>$config{$config_setting}<\/$config_setting>\n"); } $file_handle->print(" <\/config>\n"); $file_handle->print(" <post>\n"); #Write post values foreach my $key (@names){ my @post_values = $query->param($key); foreach my $post_value (@post_values){ $post_value =~ s/&/&/g; $post_value =~ s/</</g; $post_value =~ s/>/>/g; $post_value =~ s/'/'/g; $post_value =~ s/"/"/g; # Search and replace non-latin characters below. eg. # $post_value =~ s/й/e/g; # $post_value =~ s/ь/ue/g; # $post_value =~ s/д/ae/g; # $post_value =~ s/л/e/g; # $post_value =~ s/ф/o/g; $key =~ s/[^a-zA-Z0-9\_\-]//g; $file_handle->print(" <$key>$post_value<\/$key>\n"); } } $file_handle->print(" <\/post>\n"); $file_handle->print(" <file>\n"); # Write upload file info for my $file_slot (keys %uploaded_files){ my $file_name = $uploaded_files{$file_slot}{'file_name'}; my $file_size = $uploaded_files{$file_slot}{'file_size'}; my $file_type = $uploaded_files{$file_slot}{'file_type'}; my $file_status = $uploaded_files{$file_slot}{'file_status'}; my $file_status_description = $uploaded_files{$file_slot}{'file_status_desc'}; $file_handle->print(" <file_upload>\n"); $file_handle->print(" <slot>$file_slot<\/slot>\n"); $file_handle->print(" <name>$file_name<\/name>\n"); $file_handle->print(" <size>$file_size<\/size>\n"); $file_handle->print(" <type>$file_type<\/type>\n"); $file_handle->print(" <status>$file_status<\/status>\n"); $file_handle->print(" <status_desc>$file_status_description<\/status_desc>\n"); $file_handle->print(" <\/file_upload>\n"); } $file_handle->print(" <\/file>\n"); $file_handle->print("<\/uu_upload>\n"); $file_handle->close(); chmod 0666 , $file_handle; }
(Отредактировано автором: 29 Апреля, 2011 - 21:31:25)
|