Connecting Tech Pros Worldwide Forums | Help | Site Map

Posting XML

Newbie
 
Join Date: Oct 2007
Posts: 3
#1: Oct 17 '07
hi
i m new to perl
and i have created a xml output with perl with this code

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2.  use XML::Writer;
  3.   use IO::File;
  4.  
  5.   my $output = new IO::File(">output.xml");
  6.  
  7.   my $writer = new XML::Writer(OUTPUT => $output);
  8.   $writer->startTag("greeting", 
  9.                     "class" => "simple");
  10.   $writer->characters("xml tamam!");
  11.   $writer->endTag("greeting");
  12.   $writer->end();
  13.   $output->close();
  14.  
i need to post this output.xml to a webpage (example=http://..../cgi-bin/aa.cgi)
pls give me the code to send this
(NOT=i m newbie at perl so try explain clearly pls)

numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,572
#2: Oct 17 '07

re: Posting XML


Quote:

Originally Posted by YARIKKAYA

hi
i m new to perl
and i have created a xml output with perl with this code

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2.  use XML::Writer;
  3.   use IO::File;
  4.  
  5.   my $output = new IO::File(">output.xml");
  6.  
  7.   my $writer = new XML::Writer(OUTPUT => $output);
  8.   $writer->startTag("greeting", 
  9.                     "class" => "simple");
  10.   $writer->characters("xml tamam!");
  11.   $writer->endTag("greeting");
  12.   $writer->end();
  13.   $output->close();
  14.  
i need to post this output.xml to a webpage (example=http://..../cgi-bin/aa.cgi)
pls give me the code to send this
(NOT=i m newbie at perl so try explain clearly pls)

Welcome to TSDN and to Perl programming!!!!

Unfortunately nobody here is going to just give you the code you are asking for as this is not a code writing service. What the members here will do is to assist you in writing your code, where you need help. So, why not try writing the code yourself and if you get stuck, post your code here ( in code tags) and we will help you troubleshoot.

To produce an HTML file, you will need to look at the CGI module from CPAN. One link you can look at is the CGI::Simple module, which is a completely OO interface to CGI.

Regards,

Jeff
Newbie
 
Join Date: Oct 2007
Posts: 3
#3: Oct 19 '07

re: Posting XML


actually i m using asp to on webpages
i don t know how to use perl or cgi scripts
my boss wants me to post to unix apache server http://.../aa.cgi an xml page
and he wants me to do it with perl
i know noting about perl or cgi
so it s an bad sutiation for me..
i need to send xml file file with perl but i don t have time to learn how to send xml files with perl i searched whole internet but only found how to write output
but i can t send it
so i need some time(i don t have time boss is awaiting results) or someone to help me to how to send this xml page
its an emergency pls help me!
numberwhun's Avatar
Site Moderator
 
Join Date: May 2007
Location: New Hampshire
Posts: 2,572
#4: Oct 19 '07

re: Posting XML


Quote:

Originally Posted by YARIKKAYA

actually i m using asp to on webpages
i don t know how to use perl or cgi scripts
my boss wants me to post to unix apache server http://.../aa.cgi an xml page
and he wants me to do it with perl
i know noting about perl or cgi
so it s an bad sutiation for me..
i need to send xml file file with perl but i don t have time to learn how to send xml files with perl i searched whole internet but only found how to write output
but i can t send it
so i need some time(i don t have time boss is awaiting results) or someone to help me to how to send this xml page
its an emergency pls help me!

I understand that you have a difficult situation, but if you are going to do this in Perl, then you are going to have to learn some Perl one way or the other. This is a learning forum, not an answers forum.

So, you have an XML file and you say you need to "send it to the Unix server"? Can you please be more specific? Are you saying that you need to have Perl write the file over to the directory on the server so it can be served by Apache, or are you saying you need to simply "move" the file over there? Your explanation is not completely clear.

Perl can do a lot of things, especially with regards to dealing with files. Please be more specific as to what exactly you are wanting to do.

In the future though, I would not bite off more than you can chew for a project without first letting your boss know whether you know the technology or not. Either way, it will not end up good for you, especially when you either don't meet your date, or you cannot do what was asked.

Regards,

Jeff
Newbie
 
Join Date: Oct 2007
Posts: 3
#5: Oct 19 '07

re: Posting XML


Quote:

Originally Posted by numberwhun

I understand that you have a difficult situation, but if you are going to do this in Perl, then you are going to have to learn some Perl one way or the other. This is a learning forum, not an answers forum.

So, you have an XML file and you say you need to "send it to the Unix server"? Can you please be more specific? Are you saying that you need to have Perl write the file over to the directory on the server so it can be served by Apache, or are you saying you need to simply "move" the file over there? Your explanation is not completely clear.

Perl can do a lot of things, especially with regards to dealing with files. Please be more specific as to what exactly you are wanting to do.

In the future though, I would not bite off more than you can chew for a project without first letting your boss know whether you know the technology or not. Either way, it will not end up good for you, especially when you either don't meet your date, or you cannot do what was asked.

Regards,

Jeff

Thank you for answer

i have searched and found how to write xml in perl
and i have created an xml file so
for example aa.xml
inside of aa.xml
<?xml version='1.0'?>
<employees>
<employee>
<name>John Doe</name>
<age>43</age>
<sex>M</sex>
<department>Operations</department>
</employee>
<employee>
<name>Jane Doe</name>
<age>31</age>
<sex>F</sex>
<department>Accounts</department>
</employee>
<employee>
<name>Be Goode</name>
<age>32</age>
<sex>M</sex>
<department>Human Resources</department>
</employee>
</employees>

i need to post aa.xml's inside codes to http://mydomain/cgi-bin/chn1.cgi
then chn1.cgi uses it in our program
it can read only xml format
so i need to post things in xml
my output.xml's inside must be posted
what i m exactly trying to do is this
thanks for your interests.
Reply