What do the numbers near a user name on the user list mean?
More XPath problems
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What can I do?
• What to Read?
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Зарегистрируйся!

QAIX > Perl web-programming > More XPath problems 19 May 2004 14:50:49

  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Moderators:

More XPath problems

Michel Rodriguez 19 May 2004 14:50:49
 Hi,

It looks like I found one more XML::XPath bug:

findnodes( '/root/daughter/..'­) returns as many times the root node as
there are daughter nodes, instead of just one.

code below:

#!/usr/bin/perl -w
use strict;
use XML::XPath;
use XML::LibXML;
use Test::More qw(no_plan);

my $xml='<root><daught­er att="3"/><daughter att="4"/><daughter att="5"/></root>';
my @queries= ( '/root/daughter/..'­,);

my $xpath = XML::XPath->new( xml => $xml);
my $libxml = XML::LibXML->new->p­arse_string( $xml);

foreach my $path ( @queries)
{ print "find( '$path'):\n";
my @xpath_result = $xpath->findnodes( $path);
my @libxml_result= $libxml->findnodes(­ $path);
is( dump_nodes( @xpath_result) => dump_nodes( @libxml_result), "path:$­path");
}


sub dump_nodes
{ return join '-', map { $_->getName . "[" . $_->getAttribute( 'att') . "]" } @_ }

--
Michel Rodriguez
Perl & XML
http://www.xmltwig.­com
___________________­____________________­________
Perl-XML mailing list
Perl-XML@listserv.A­ctiveState.com
To unsubscribe: http://listserv.Act­iveState.com/mailman­/mysubs

Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или УК РФ.


QAIX > Perl web-programming > More XPath problems 19 May 2004 14:50:49

see also:
[Beginners Corner] - JBoss 4.0 embedded…
[EJB/JBoss] - EntityBeans whith local…
[Installation & Configuration]…
пройди тесты:
see also:
Blackfriday&Cybermonday special…
'Jasper' Xbox 360s finally availabl...
Nintendo makes $6 profit on each Wii…

  Copyright © 2001—2008 QAIX
Idea: Miсhael Monashev
Помощь и задать вопросы можно в сообществе support.qaix.com.
Сообщения об ошибках оставляем в сообществе bugs.qaix.com.
Предложения и комментарии пишем в сообществе suggest.qaix.com.
Информация для родителей.
Write us at:
If you would like to report an abuse of our service, such as a spam message, please .