473,561 Members | 3,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Confusing message when using XML::Writer module in Perl

I'm getting the following message when I run my Perl script that uses
the XML::Writer module:

"Processing instruction target begins with 'xml' at
.../makeconf/LW/LWTest.pm line 75"

The pi() statement is almost identical to the example for the module
at cpan.org. In fact, I tried replacing my use with the example and
got the same result. Can anyone tell me why I'm getting this warning,
even though I'm getting the correct output?

Here is the code snippet where I'm using XML::Writer:

###BEGIN SNIP
my $output = new IO::File(">$out _file_path");
my $writer = new XML::Writer( OUTPUT => $output, DATA_MODE => 1,
DATA_INDENT => 4 );

$writer->xmlDecl( 'ISO-8859-1', 'yes' );
$writer->pi('xml-stylesheet', 'type="text/xsl" href="LW_Test.x sl"');
#line 75
$writer->startTag( 'testcase' );
$writer->dataElement( "name", $test_case_name );
$writer->dataElement( "timestamp" , $test_case_time stamp);
$writer->dataElement( "overview", $test_case_over view);

foreach(@condit ions) {
my $cond_id = LW::TestConditi on->getConditionID ($_);
my $cond_comp = LW::TestConditi on->getConditionCo mp($_);
my $cond_pass_fail = LW::TestConditi on->getConditionPa ssFail($_);
my $cond_pass_desc = LW::TestConditi on->getConditionDe sc($_);
my $cond_err_msg = LW::TestConditi on->getConditionEr rMsg($_);

$writer->startTag( 'condition', 'id' => $cond_id,
'completed' => $cond_comp,
'pass_fail' => $cond_pass_fail );

$writer->dataElement( "descriptio n", $cond_pass_desc );
$writer->dataElement( "err_msg", $cond_err_msg);
$writer->endTag( 'condition' );
}

$writer->endTag( 'testcase' );
###END SNIP

The output file looks like this (which is what I wanted):

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes "?>
<?xml-stylesheet href="style.css " type="text/css"?>

<testcase>
<name>my test case</name>
<timestamp>Tu e Sep 30 11:19:55 2003</timestamp>
<overview>tex t containing many wise and wonderful
things</overview>
<condition id="1" completed="yes" pass_fail="pass ">
<description>th is is the description for condition
1</description>
<err_msg>none </err_msg>
</condition>
<condition id="2" completed="no" pass_fail="fail ">
<description>th is is the description for condition
2</description>
<err_msg>condit ion 1 failed</err_msg>
</condition>
<condition id="3" completed="yes" pass_fail="pass ">
<description>th is is the description for condition
3</description>
<err_msg>none </err_msg>
</condition>
<condition id="4" completed="yes" pass_fail="fail ">
<description>th is is the description for condition
4</description>
<err_msg>file s not the same</err_msg>
</condition>
</testcase>
Jul 20 '05 #1
2 2284
da******@pacbel l.net (David McBride) writes:
The pi() statement is almost identical to the example for the module
at cpan.org. In fact, I tried replacing my use with the example and
got the same result. Can anyone tell me why I'm getting this warning,
even though I'm getting the correct output?


Because the XML-Writer module is getting a little old, and I haven't
been maintaining it actively. This recommendation

http://www.w3.org/TR/xml-stylesheet/

did not exist (or at least, wasn't a REC) when I wrote the module, and
the XML spec reserves PI's starting with "xml". I seem to remember
that there was a way to disable this kind of strict checking, but I
haven't look at the code for a few years.
All the best,
David
Jul 20 '05 #2
David Megginson <no****@attglob al.net> wrote in message news:<87******* *****@megginson .com>...
da******@pacbel l.net (David McBride) writes:
The pi() statement is almost identical to the example for the module
at cpan.org. In fact, I tried replacing my use with the example and
got the same result. Can anyone tell me why I'm getting this warning,
even though I'm getting the correct output?
Because the XML-Writer module is getting a little old, and I haven't
been maintaining it actively. This recommendation

http://www.w3.org/TR/xml-stylesheet/

did not exist (or at least, wasn't a REC) when I wrote the module, and
the XML spec reserves PI's starting with "xml". I seem to remember
that there was a way to disable this kind of strict checking, but I
haven't look at the code for a few years.
All the best,
David

David,

Thanks for responding.

According to the documentation, strict checking can be turned off by
using "UNSAFE" as follows:

my $writer = new XML::Writer( OUTPUT => $output, DATA_MODE => 1,
DATA_INDENT => 4, UNSAFE => 1);

I didn't quite understand your statement, though:
... This recommendation

http://www.w3.org/TR/xml-stylesheet/

did not exist (or at least, wasn't a REC) when I wrote the module, and
the XML spec reserves PI's starting with "xml".


This seems odd to me because one of the examples in the documentation
for XML::Writer at cpan.org actually uses xml-stylesheet to
demonstrate the use of pi(). Maybe I'm just naive, but it seems like
this example would not have been used if xml-stylesheet was
incompatible with XML::Writer->pi();

One final thought: assuming that the module is a little out of date,
have you given any thought to another revision? It's such a useful
tool, I think that it would be a great service to keep it up to date.

Thanks again for your response.

v/r

David McBride
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1603
by: Marco Meoni | last post by:
Have you ever write an XML Writer in wxPython? A Writer that from a GUI can compose XML Files. Thanks. Marco.
6
10536
by: atinti | last post by:
I'm tyring to write something that will send a simple email using Perl so far this is what I have #!/usr/bin/perl -w use strict; my $executable = "saplotus.exe'; my $server = 'test@domain'; my $from = 'aetinti@gmail.com';
8
5367
crazy4perl
by: crazy4perl | last post by:
hi all !!! i m new to perl. can anyone here please tell me how to communicate with websites using perl. do we need to use CGI for that or simply by using perl... simply i just wnt to fill some field on the web page using perl.. thanks in advance...:-)
3
6808
by: hakiran | last post by:
Hello all, I have been using Perl DBI the last 6months or so. I use it extensively with MySQL. But recently i tried to access Oracle DB with it and was having trouble. Any help would be appreciated. Here is the code and the error i get. I know the table/view do exist. Thanks all Kiran ----------
4
19675
by: jram01 | last post by:
Hi Folks, I am facing problem to to execute .sql command in sql prompt using perl script. I am able to connect sql promt using " my $odbcinput = "odbcinput.txt"; my $odbcoutput = "odbcoutput.txt"; open (ODBCSQLFH, ">$odbcinput") || die "Unable to create input file ($odbcinput) for odbcsql\n";
1
1512
by: nehaz | last post by:
can anyone tell me how can i configure a device from HTTP page using perl ? I am using following cmd to enter the http page use HTTP::Request; $req = HTTP::Request->new($httpRequestMethod => "http://192.168.1.1/"); sleep 10; $req->authorization_basic("admin","password"); sleep 10; How can i change values on that page ? will print...
2
1862
by: nb999 | last post by:
Hello Friends, I was trying to simulate a vending machine using perl just as a fun project. Heres the code I wrote: #!/usr/bin/perl $wt = $ARGV;
3
2743
by: poolboi | last post by:
hi guys, i dunno if this post should be in Perl or MySQL but i'm using Perl DBI to do manupilations now in MySQL i've got problem trying to input 2 arrays of data into 2 fields at the same time say for example now i got
0
1532
by: koti688 | last post by:
Hi Mates, Can u Please tell me how to connect to Berkely Db using Perl . I have two files , i need to access these file using perl. These files with .db extension contains Keys and its Signatures. I need to List out the keys and vaules and signatures respectively.I Have installed Berkely-DB(0.22), BerkelyDB-Lite,DB_File(1.816) using PPM...
0
7570
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8088
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6210
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5187
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3617
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3600
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2068
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1181
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
896
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.