Ask a Question related to PERL Beginners, Design and Development.
-
Kevin Zembower #1
XML::Writer beginner problems
Hope it's okay to write to this group regarding beginner problems with XML::Writer. I'm a beginner both to XML in general, and XML::Writer in particular.
I'm trying to run this program:
============================
#! /usr/bin/perl
use XML::Writer;
my $writer = new XML::Writer(DATA_MODE => 1,
DATA_INDENT => 3,
UNSAFE =>1);
$writer->xmlDecl("ISO-8859-1");
$writer->dataElement("docnum", "PIP 189165");
$writer->startTag("greeting",
"class" => "simple");
$writer->characters("Hello, world!");
$writer->endTag("greeting");
$writer->end();
============================
When I do, I get the output I think I want:
kevinz@www:~/POPLINE_XML$ ./test.pl
<?xml version="1.0" encoding="ISO-8859-1"?>
<docnum>PIP 189165</docnum>
<greeting class="simple">Hello, world!</greeting>
kevinz@www:~/POPLINE_XML$
This output looks like valid XML to me. I don't see any problems with it.
However, when I remove the UNSAFE and change the third line to:
my $writer = new XML::Writer(DATA_MODE => 1,
DATA_INDENT => 3);
I get this output:
kevinz@www:~/POPLINE_XML$ ./test.pl
<?xml version="1.0" encoding="ISO-8859-1"?>
Attempt to insert start tag after close of document element at ./test.pl line 11
<docnum>PIP 189165</docnum>kevinz@www:~/POPLINE_XML$
I don't understand what I'm doing wrong to cause XML::Writer to complain. Do I not understand XML correctly?
Thanks for your thoughts and suggestions.
-Kevin Zembower
-----
E. Kevin Zembower
Unix Administrator
Johns Hopkins University/Center for Communications Programs
111 Market Place, Suite 310
Baltimore, MD 21202
410-659-6139
Kevin Zembower Guest
-
Isn't DataGrid.Render(writer) supposed to automatically call RenderBeginTag(writer) and RenderEndTag(writer)?
Hi, I'm trying to customize a DataGrid adding custom rows before the endTag </TABLE>, and also some html before and after the control itself. So... -
PDF Writer
Hi, I have had to reinstall my Acrobat Version 5. Previously when I clicked on print I would be offered a choice of using PDF writer or distiller.... -
:Writer beginner problems
> <?xml version="1.0" encoding="ISO-8859-1"?> A rule of XML is that there MAY ONLY BE ONE ROOT ELEMENT. You have two. You need to put <docnum>... -
CD Writer
Anyone know of any manufacturers of external CD writers for a Blade2000 running Solaris8 thanks -
CD Writer problems Plextor24/10/40A on a SUN ultra 10
Hi, Was wondering if anyone hade come across the following problem & how they resolved it. I've been given a Plextor 24/10/40A and I've... -
R. Joseph Newton #2
Re: XML::Writer beginner problems
KEVIN ZEMBOWER wrote:
Well, you are working with a Perl interface, so it's not really too off-topic. On the other hand, the content of your error messages points strongly to anXML> Hope it's okay to write to this group regarding beginner problems with XML::Writer. I'm a beginner both to XML in general, and XML::Writer in particular.
error as the root problem. Your best range of help would probably come from an XML group. When you post to them, though, focus on the content of the XML
being parsed, rather than the Perl code used to generate it.
Joseph
R. Joseph Newton Guest



Reply With Quote

