Recent Posts
None | 1 sec ago
None | 47 sec ago
None | 49 sec ago
C# | 1 min ago
None | 1 min ago
PHP | 2 min ago
Java | 2 min ago
Java | 2 min ago
PHP | 3 min ago
Perl | 3 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Nathan Neulinger on the 8th of Feb 2010 03:53:44 PM Download | Raw | Embed | Report
  1. #!/usr/bin/perl
  2.  
  3. use XML::LibXML;
  4.  
  5. my $content = do { local($/); <DATA>; };
  6.  
  7. $parser = XML::LibXML->new();
  8. $doc    = $parser->parse_string($content);
  9.  
  10. my $xc = XML::LibXML::XPathContext->new();
  11. $xc->registerNs( atom       => "http://www.w3.org/2005/Atom" );
  12. $xc->registerNs( app        => "http://www.w3.org/2007/app" );
  13. $xc->registerNs( gd         => "http://schemas.google.com/g/2005" );
  14. $xc->registerNs( gcontact   => "http://schemas.google.com/contact/2008" );
  15. $xc->registerNs( batch      => "http://schemas.google.com/gdata/batch" );
  16. $xc->registerNs( openSearch => "http://a9.com/-/spec/opensearchrss/1.0/" );
  17.  
  18. foreach my $entry ( $xc->findnodes( '/atom:feed/atom:entry', $doc ) ) {
  19.     print "entry = '", $entry->toString(1), "'\n";
  20.  
  21.     my @logins = $xc->findnodes( "//apps:login", $entry );
  22.     print join( "\n", @logins ), "\n";
  23. }
  24.  
  25.  
  26. __END__
  27. <?xml version="1.0" encoding="UTF-8"?>
  28. <feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:apps="http://schemas.google.com/apps/2006" xmlns:gd="http://schemas.google.com/g/2005">
  29.   <id>https://apps-apis.google.com/a/feeds/mst.edu/user/2.0</id>
  30.   <updated>1970-01-01T00:00:00.000Z</updated>
  31.   <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/apps/2006#user"/>
  32.   <title type="text">Users</title>
  33.   <link rel="next" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0?startUsername=norbert"/>
  34.   <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0"/>
  35.   <link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0"/>
  36.   <link rel="self" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0"/>
  37.   <openSearch:startIndex>1</openSearch:startIndex>
  38.   <entry>
  39.     <id>https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user1</id>
  40.     <updated>1970-01-01T00:00:00.000Z</updated>
  41.     <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/apps/2006#user"/>
  42.     <title type="text">user1</title>
  43.     <link rel="self" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user1"/>
  44.     <link rel="edit" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user1"/>
  45.     <apps:login userName="user1" suspended="false" ipWhitelisted="false" admin="false" changePasswordAtNextLogin="false" agreedToTerms="true"/>
  46.     <apps:quota limit="7168"/>
  47.     <apps:name familyName="Last1" givenName="First1"/>
  48.     <gd:feedLink rel="http://schemas.google.com/apps/2006#user.nicknames" href="https://apps-apis.google.com/a/feeds/mst.edu/nickname/2.0?username=user1"/>
  49.     <gd:feedLink rel="http://schemas.google.com/apps/2006#user.emailLists" href="https://apps-apis.google.com/a/feeds/mst.edu/emailList/2.0?recipient=user1%40mst.edu"/>
  50.   </entry>
  51.   <entry>
  52.     <id>https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user2</id>
  53.     <updated>1970-01-01T00:00:00.000Z</updated>
  54.     <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/apps/2006#user"/>
  55.     <title type="text">user2</title>
  56.     <link rel="self" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user2"/>
  57.     <link rel="edit" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user2"/>
  58.     <apps:login userName="user2" suspended="false" ipWhitelisted="false" admin="false" changePasswordAtNextLogin="false" agreedToTerms="true"/>
  59.     <apps:quota limit="7168"/>
  60.     <apps:name familyName="Last2" givenName="First2"/>
  61.     <gd:feedLink rel="http://schemas.google.com/apps/2006#user.nicknames" href="https://apps-apis.google.com/a/feeds/mst.edu/nickname/2.0?username=user2"/>
  62.     <gd:feedLink rel="http://schemas.google.com/apps/2006#user.emailLists" href="https://apps-apis.google.com/a/feeds/mst.edu/emailList/2.0?recipient=user2%40mst.edu"/>
  63.   </entry>
  64. </feed>
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: