- #!/usr/bin/perl
- use XML::LibXML;
- my $content = do { local($/); <DATA>; };
- $parser = XML::LibXML->new();
- $doc = $parser->parse_string($content);
- my $xc = XML::LibXML::XPathContext->new();
- $xc->registerNs( atom => "http://www.w3.org/2005/Atom" );
- $xc->registerNs( app => "http://www.w3.org/2007/app" );
- $xc->registerNs( gd => "http://schemas.google.com/g/2005" );
- $xc->registerNs( gcontact => "http://schemas.google.com/contact/2008" );
- $xc->registerNs( batch => "http://schemas.google.com/gdata/batch" );
- $xc->registerNs( openSearch => "http://a9.com/-/spec/opensearchrss/1.0/" );
- foreach my $entry ( $xc->findnodes( '/atom:feed/atom:entry', $doc ) ) {
- print "entry = '", $entry->toString(1), "'\n";
- my @logins = $xc->findnodes( "//apps:login", $entry );
- print join( "\n", @logins ), "\n";
- }
- __END__
- <?xml version="1.0" encoding="UTF-8"?>
- <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">
- <id>https://apps-apis.google.com/a/feeds/mst.edu/user/2.0</id>
- <updated>1970-01-01T00:00:00.000Z</updated>
- <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/apps/2006#user"/>
- <title type="text">Users</title>
- <link rel="next" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0?startUsername=norbert"/>
- <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"/>
- <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"/>
- <link rel="self" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0"/>
- <openSearch:startIndex>1</openSearch:startIndex>
- <entry>
- <id>https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user1</id>
- <updated>1970-01-01T00:00:00.000Z</updated>
- <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/apps/2006#user"/>
- <title type="text">user1</title>
- <link rel="self" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user1"/>
- <link rel="edit" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user1"/>
- <apps:login userName="user1" suspended="false" ipWhitelisted="false" admin="false" changePasswordAtNextLogin="false" agreedToTerms="true"/>
- <apps:quota limit="7168"/>
- <apps:name familyName="Last1" givenName="First1"/>
- <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"/>
- <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"/>
- </entry>
- <entry>
- <id>https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user2</id>
- <updated>1970-01-01T00:00:00.000Z</updated>
- <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/apps/2006#user"/>
- <title type="text">user2</title>
- <link rel="self" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user2"/>
- <link rel="edit" type="application/atom+xml" href="https://apps-apis.google.com/a/feeds/mst.edu/user/2.0/user2"/>
- <apps:login userName="user2" suspended="false" ipWhitelisted="false" admin="false" changePasswordAtNextLogin="false" agreedToTerms="true"/>
- <apps:quota limit="7168"/>
- <apps:name familyName="Last2" givenName="First2"/>
- <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"/>
- <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"/>
- </entry>
- </feed>