Han.
take out no spam
I've worked with the WDDX.pm that is in CPAN. What is your question?
--
This space intentionally left blank
> I have been given a wddx file to process in perl, but I have never
> done any xml before.
> I have the dtd, xml, wddx.pm files up on my server, yet I keep getting
> server error.
Looks like you've got some serious learning to do. :) Most of it
won't be perl-related. For instance, XML is quite distinct from
perl. You can use perl to work with XML documents, but you can also
use any number of programming languages and tools as well.
Server errors are nearly always the result of server configuration
issues rather than perl issues.
I've never heard of wddx.pm (or wddx files), but it sounds like a perl
module. You need a perl script to use a perl module. If you don't
have one, you're going to have to write one yourself or convince
someone else to write one for you. Perhaps the person who gave you
the wddx file could help you.
If you do have a script and there is a problem with it (as opposed to
a server configuration problem), you could try isolating the problem
to a few lines and post your code, data and expected output to this
newsgroup. At this point we can only guess what the problem might be.
Jon
--
Two are better than one, because they have a good return for their
work: If one falls down, his friend can help him up... Though one
may be overpowered, two can defend themselves. A cord of three
strands is not quickly broken. -- Ecclesiastes 4:9,12 (NIV)
I have my dtd, xml and wddx.pm files in my cgi-bin; Is this the right
place to put them?
What permisions should be set?
Han.
>
>I've worked with the WDDX.pm that is in CPAN. What is your question?
>--
> This space intentionally left blank
take out no spam
use wddx;
my(%pXML);
$parser = new wddx(
'DEBUG' , '0'
);
$parser->parsefile("test8.xml");
$arrayRef = $parser->cfwddx(
'action' => 'wddx2perl'
);
%hsh = %{@{$arrayRef}[0]};
print "After the xml parsing:\n";
print "Record Count =
$hsh{'WDDXPROPERTIES'}{'RECORDCOUNT'}\n";
print "Field Count = $hsh{'WDDXPROPERTIES'}{'FIELDCOUNT'}\n";
print "Field Names =
@{$hsh{'WDDXPROPERTIES'}{'FIELDNAMES'}}\n";
print "The 2nd Field is named
@{$hsh{'WDDXPROPERTIES'}{'FIELDNAMES'}}[1]\n\n";
for ($i = 0; $i < $hsh{'WDDXPROPERTIES'}{'RECORDCOUNT'}; $i++)
{
print "Record $i:\n";
print "\tNumber Column: $hsh{'NUMBERCOL'}[$i]\n";
print "\tString Column: $hsh{'STRINGCOL'}[$i]\n";
print "\tDate Column: $hsh{'DATECOL'}[$i]\n";
}
exit;
and my wddx/xml is :
<?xml version='1.0'?>
<!DOCTYPE wddxPacket SYSTEM 'wddx_0090.dtd'>
<wddxPacket version='0.9'>
<header/>
<data><recordset rowCount='2'
fieldNames='numbercol,stringcol,datecol'>
<field name='numbercol'>
<number>1</number>
<number>2</number>
</field>
<field name='stringcol'>
<string>One</string>
<string>Two</string>
</field>
<field name='datecol'>
<dateTime>1969-4-18T0:0:0-5:0</dateTime>
<dateTime>1971-1-30T0:0:0-5:0</dateTime>
</field>
</recordset>
</data>
</wddxPacket>
It has a dtd file.
I also have the wddx.pm file.
The cgi and pm are set to 755 and the xml and dtd are set to 777.
Any ponters in the right direction would be gratefully received.
> I just have a simple cgi script:
Since this is CGI, you might consider the
comp.infosystems.www.authoring.cgi newsgroup. Be sure to consult the
FAQ before posting.
> #!/usr/bin/perl
You don't have strict or warnings turned on. Both of these switches
are extremely helpful while debugging and maintaining perl code.
Since this is a CGI script, it would probably be good to turn on taint
mode as well.
#!/usr/bin/perl -wT
use strict;
(These changes will require other changes to your script.)
> use wddx;
wddx.pm needs to be in one of the places perl is looking for perl
modules. The command "perl -V" shows the value of the @INC variable.
Be sure that wddx.pm is in one of those places. Read "perldoc lib" if
you don't have permission to write to those directories.
Since this is a CGI script you should also look into CGI.pm:
use CGI qw/:standard/;
Read all about it with "perldoc CGI". Pay particular attention to the
"header" function.
[snip the rest of the script and the data]
I don't know enough about wddx.pm to help you with the rest of your
code. You can test your CGI script from the command line. If it
looks good, you have a CGI/server configuration problem, not a perl
problem.