Using xml Syntax Highlighting
<Info>
<Id>12345</Id>
<Account>
<Card>
<cardActive>1</cardActive>
<cardExp></cardExp>
<cardId>777889003666</cardId>
<cardLost>0</cardLost>
</Card>
<Card>
<cardActive>1</cardActive>
<cardExp></cardExp>
<cardId>777889003672</cardId>
<cardLost>0</cardLost>
</Card>
</Account>
</Info>
<Id>12345</Id>
<Account>
<Card>
<cardActive>1</cardActive>
<cardExp></cardExp>
<cardId>777889003666</cardId>
<cardLost>0</cardLost>
</Card>
<Card>
<cardActive>1</cardActive>
<cardExp></cardExp>
<cardId>777889003672</cardId>
<cardLost>0</cardLost>
</Card>
</Account>
</Info>
Coloreado en 0.000 segundos, usando GeSHi 1.0.8.4
La parte de <Card> ya la pude sacar con este código:
Using perl Syntax Highlighting
my @rows;
sDB_Select($dbh,$stmt,\@rows,$sub);
my $dump = Dumper(\@rows);
print "$dump\n";
print "<BR>--------------------------------------<BR>\n";
my $max = scalar(@rows);
#my $hash=();
for ( my $ptr=0; $ptr<$max; $ptr++ ) {
my $cardActive = 1;
if ( $rows[$ptr]{dt_inactivated} ne '' ) { $cardActive = 0; }
my $hash = {
'patronCard' => {
'cardId' => $rows[$ptr]{cardnum},
'cardExp' => sDateTimeTos2sDateTime($ini,$rows[$ptr]{dt_validthru}),
'cardLost' => '0',
'cardActive' => $cardActive
}
};
$xmlout .= XMLout($hash,AttrIndent => 1, KeepRoot => 1, NoAttr => 1);
} # end for
return $xmlout;
sDB_Select($dbh,$stmt,\@rows,$sub);
my $dump = Dumper(\@rows);
print "$dump\n";
print "<BR>--------------------------------------<BR>\n";
my $max = scalar(@rows);
#my $hash=();
for ( my $ptr=0; $ptr<$max; $ptr++ ) {
my $cardActive = 1;
if ( $rows[$ptr]{dt_inactivated} ne '' ) { $cardActive = 0; }
my $hash = {
'patronCard' => {
'cardId' => $rows[$ptr]{cardnum},
'cardExp' => sDateTimeTos2sDateTime($ini,$rows[$ptr]{dt_validthru}),
'cardLost' => '0',
'cardActive' => $cardActive
}
};
$xmlout .= XMLout($hash,AttrIndent => 1, KeepRoot => 1, NoAttr => 1);
} # end for
return $xmlout;
Coloreado en 0.002 segundos, usando GeSHi 1.0.8.4
La pregunta es cómo hago para agregar 'Info', 'id', 'Account'.