Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: XML not well-formed (invalid token)

by GrandFather (Saint)
on May 03, 2017 at 04:14 UTC ( [id://1189381]=note: print w/replies, xml ) Need Help??


in reply to XML not well-formed (invalid token)

That script doesn't produce the error you describe. It generates:

Global symbol "$trans_type" requires explicit package name at noname.p +l line 26. Global symbol "$transaction_id" requires explicit package name at nona +me.pl line 28. Global symbol "$mem_number" requires explicit package name at noname.p +l line 29. Global symbol "$apt" requires explicit package name at noname.pl line +30. Global symbol "$month" requires explicit package name at noname.pl lin +e 31. Global symbol "$year" requires explicit package name at noname.pl line + 32. Global symbol "$amount" requires explicit package name at noname.pl li +ne 33. Global symbol "$gateway" requires explicit package name at noname.pl l +ine 38. Unmatched right curly bracket at noname.pl line 42, at end of line syntax error at noname.pl line 42, near "}" noname.pl has too many errors.

Maybe you should run the sample code you post before you post it to check that it demonstrates the problem you describe?

Note that Perl gives you better ways to generate blocks of inline text:

use strict; use DBI; use CGI::Session; use CGI qw(:standard); my $query = new CGI; print <<HEADER; HTTP/1.0 200 OK\n"; Content-type:text/html <HTML> <Head> <Title>Members</Title> </Head> <body> HEADER my $sid = $query->cookie("CGISESSID") || undef; my $session = new CGI::Session(undef, $sid, {Directory => 'Temp/'}); my $trans_type = 'xxx'; my $transaction_id = 'xxx'; my $mem_number = 'xxx'; my $apt = 'xxx'; my $month = 'xxx'; my $year = 'xxx'; my $amount = 'xxx'; my $naijaXMLRequest = <<XML; <Lastbill>"; <TransactionType>$trans_type</TransactionType>"; <MerchantID>NAIJAMAN009</MerchantID>"; <TransactionID>$transaction_id</TransactionID>"; <MemberNum>$mem_number</MemberNum>"; <apt>$apt</apt>"; <aptExpMonth>$month</aptExpMonth>"; <aptExpYear>$year</aptExpYear>"; <TotalAmountdue>$amount</TotalAmountdue>"; </Lastbill>"; XML my $mem = new LastBill; my $gateway = 'xxx'; $mem->sendHTTP($gateway, "$naijaXMLRequest"); $session->delete(); print qq[<script type='text/javascript'>window.open('','_self','');windo +w.close()</script>];

and that CGI will generate the header for you using print $cgi->header();.

Showing us the CGI related code probably isn't relevant to your issue so you could remove that to focus on the real problem you want help with.

Premature optimization is the root of all job security

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1189381]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-26 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found