A
anthony.raj
Hi,
I have an XML Datasource in the following format -
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
<table>
<event >
<field name="user" value="anthony"/>
<field name="date" value="2005-08-5"/>
</event>
<event>
<field name="user" value="anthony"/>
<field name="date" value="2005-08-5"/>
</event>
........
</table>
I require to search for the following fields - user & date (act as
filters).
Following is the code to handle the same -
use XML::XPath;
use XML::XPath::XMLParser;
my $filename = 'data.xml';
my $pathn =
'/table/event/field/[@name="user"][@value="anthony"]|[@name="date"][@value="2005-08-06"]';
my $xp = XML::XPath->new(filename => $filename);
my $nodeset = $xp->find($pathn);
foreach my $node ($nodeset->get_nodelist) {
print XML::XPath::XMLParser::as_string($node),"\n\n";
}
Could someone guide me about details on union operators
or SQL's AND approach .
Goal -
Require to select data based on user='anthony' and date = '2005-08-05'
TIA,
Antonio
I have an XML Datasource in the following format -
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
<table>
<event >
<field name="user" value="anthony"/>
<field name="date" value="2005-08-5"/>
</event>
<event>
<field name="user" value="anthony"/>
<field name="date" value="2005-08-5"/>
</event>
........
</table>
I require to search for the following fields - user & date (act as
filters).
Following is the code to handle the same -
use XML::XPath;
use XML::XPath::XMLParser;
my $filename = 'data.xml';
my $pathn =
'/table/event/field/[@name="user"][@value="anthony"]|[@name="date"][@value="2005-08-06"]';
my $xp = XML::XPath->new(filename => $filename);
my $nodeset = $xp->find($pathn);
foreach my $node ($nodeset->get_nodelist) {
print XML::XPath::XMLParser::as_string($node),"\n\n";
}
Could someone guide me about details on union operators
or SQL's AND approach .
Goal -
Require to select data based on user='anthony' and date = '2005-08-05'
TIA,
Antonio