Re: XML::XPath createNode with the same name??

"Brian" <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
> Normally, it's possible; chances are the bug is on your side. But it's
> hard for us to help without at least a description of the issues you're
> seeing (silent failure? errors? hard drive wiped?) and if possible the
> code you're using to do this.

I'm absolutely convinced the bug is on my side.  At least I am hopeful it
is....

The original code I was using to build the recipient nodes was the
following (assuming $self->{'recipientList'} is a semi-colon delimited
list of emails):

   if (defined($self->{'recipientList'})) {
       my @recipients = split(/;/,$self->{'recipientList'});
        foreach my $recipient (@recipients) {
         my $string =
"/llbeanDocument/document/notificationRequest/notificationRequestHdr/recipientList/recipient";
         $notificationRequest->createNode($string);
         $notificationRequest->setNodeText($string,$recipient);
       }
    }



The code above just overwrites the 1st node of that name over and over,
which makes sense to me logically...

Based on Dave Howorth's response to my query, I tried:

   if (defined($self->{'recipientList'})) {
       my @recipients = split(/;/,$self->{'recipientList'});
        my $i = 0;
        foreach my $recipient (@recipients) {
         $i = $i + 1;
         my $nodeString =
"/myCompanyDocument/document/notificationRequest/notificationRequestHdr/recipientList/recipient[$i]";
         $notificationRequest->createNode($nodeString);
         $notificationRequest->setNodeText($nodeString,$recipient);
       }
    }



but the resulting XML was still incorrect.  When printing out the
resulting XML, the recipientList looks like the following:

<recipientList>
   <recipient[(1)] />
   <recipient[(2)] />
</recipientList>





_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.