That ought to be working except that if you are using dataElement the startTag/endTag pairs are redundant and will generate pairs of nested tags.
The sample code below works for me and is essentially what you are trying to do:
use strict; use warnings; use XML::Writer; my $writer = new XML::Writer(); $writer->xmlDecl(); $writer->startTag("Main"); $writer->startTag("NewHits"); $writer->dataElement( "GI" , "Element string"); $writer->endTag("NewHits"); $writer->endTag("Main"); $writer->end();
<?xml version="1.0"?> <Main><NewHits><GI><GI>Element string</GI></GI></NewHits></Main>
Note: reducing your sample code to a small example that demonstrates the problem will not only get a better response from the monks, but may reveal your problem along the way.
In reply to Re: XML tagging problem
by GrandFather
in thread XML tagging problem
by MonkPaul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |