472,353 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

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.xsl"');
#line 75
$writer->startTag( 'testcase' );
$writer->dataElement( "name", $test_case_name);
$writer->dataElement( "timestamp", $test_case_timestamp);
$writer->dataElement( "overview", $test_case_overview);

foreach(@conditions) {
my $cond_id = LW::TestCondition->getConditionID($_);
my $cond_comp = LW::TestCondition->getConditionComp($_);
my $cond_pass_fail = LW::TestCondition->getConditionPassFail($_);
my $cond_pass_desc = LW::TestCondition->getConditionDesc($_);
my $cond_err_msg = LW::TestCondition->getConditionErrMsg($_);

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

$writer->dataElement( "description", $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>Tue Sep 30 11:19:55 2003</timestamp>
<overview>text containing many wise and wonderful
things</overview>
<condition id="1" completed="yes" pass_fail="pass">
<description>this is the description for condition
1</description>
<err_msg>none</err_msg>
</condition>
<condition id="2" completed="no" pass_fail="fail">
<description>this is the description for condition
2</description>
<err_msg>condition 1 failed</err_msg>
</condition>
<condition id="3" completed="yes" pass_fail="pass">
<description>this is the description for condition
3</description>
<err_msg>none</err_msg>
</condition>
<condition id="4" completed="yes" pass_fail="fail">
<description>this is the description for condition
4</description>
<err_msg>files not the same</err_msg>
</condition>
</testcase>
Jul 20 '05 #1
2 2182
da******@pacbell.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****@attglobal.net> wrote in message news:<87************@megginson.com>...
da******@pacbell.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
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
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...
8
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...
3
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...
4
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 " ...
1
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;...
2
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 =...
3
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...
0
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

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.