Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7129543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:15:13+00:00 2026-05-28T11:15:13+00:00

I am trying to parse the xml feed provide by google apis for there

  • 0

I am trying to parse the xml feed provide by google apis for there profiles. The xml looks like this:

  <ns0:feed ns1:etag="W/"Dk8BQ3o8eCt7I2A9WhRUE0g."">
 <ns0:updated>2012-01-23T21:40:52.470Z</ns0:updated>
 <ns0:category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#profile"/>
 <ns0:id>domain.com</ns0:id>
 <ns0:generator uri="http://www.google.com/m8/feeds" version="1.0">Contacts</ns0:generator>
<ns0:author>
 <ns0:name>domain.com</ns0:name>
 </ns0:author>
 <ns0:link href="http://www.google.com/" rel="alternate" type="text/html"/>
 <ns0:link href="https://www.google.com/m8/feeds/profiles/domain/domain.com/full" rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml"/>
 <ns0:link href="https://www.google.com/m8/feeds/profiles/domain/domain.com/full/batch" rel="http://schemas.google.com/g/2005#batch" type="application/atom+xml"/>
 <ns0:link href="https://www.google.com/m8/feeds/profiles/domain/domain.com/full?max-results=300" rel="self" type="application/atom+xml"/>
 <ns2:startIndex>1</ns2:startIndex>
 <ns2:itemsPerPage>300</ns2:itemsPerPage>
<ns0:entry ns1:etag=""URRaQR4KTit7I2A4"">
 <ns0:category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/contact/2008#profile"/>
 <ns0:id>http://www.google.com/m8/feeds/profiles/domain/domain.com/full/pname</ns0:id>
<ns1:name>
 <ns1:familyName>Name</ns1:familyName>
 <ns1:fullName>Persobn Name</ns1:fullName>
 <ns1:givenName>Robert</ns1:givenName>
 </ns1:name>
 <ns0:updated>2012-01-23T21:40:52.597Z</ns0:updated>
<ns1:organization primary="true" rel="http://schemas.google.com/g/2005#work">
 <ns1:orgTitle>JobField</ns1:orgTitle>
 <ns1:orgDepartment>DepartmentField</ns1:orgDepartment>
 <ns1:orgName>CompanyField</ns1:orgName>
 </ns1:organization>
 <ns3:status indexed="true"/>
 <ns0:title>Person Name</ns0:title>
 <ns0:link href="https://www.google.com/m8/feeds/photos/profile/domain.com/pname" rel="http://schemas.google.com/contacts/2008/rel#photo" type="image/*"/>
 <ns0:link href="https://www.google.com/m8/feeds/profiles/domain/domain.com/full/pname" rel="self" type="application/atom+xml"/>
 <ns0:link href="https://www.google.com/m8/feeds/profiles/domain/domain.com/full/pname" rel="edit" type="application/atom+xml"/>
 <ns1:email address="pname@gapps.domain.com" rel="http://schemas.google.com/g/2005#other"/>
 <ns1:email address="pname@domain.com" primary="true" rel="http://schemas.google.com/g/2005#other"/>
 <ns4:edited>2012-01-23T21:40:52.597Z</ns4:edited>
 </ns0:entry>

I only need the name fields and the fields that are under the Ofganization ns. My question is on the proper way to do this. I have never had to parse xml before, and I see people saying Element Tree, Stone Soup, sax, so on. I have this so far:

import xml.dom.minidom

def explore_children(nodelist,inset):
    for subnode in nodelist:
        if (subnode.nodeType == subnode.ELEMENT_NODE):
            which = subnode.tagName
            called = "" # in case it's not an img or title
            if (which == "img"): called = subnode.getAttribute("name")
            if (which == "title"): called = subnode.getAttribute("text")
            print inset + which + " " + called
            explore_children(subnode.childNodes,"  "+inset)
        if (subnode.nodeType == subnode.TEXT_NODE):
            pass

fh = open("c:\\python27\\junk.xml","r")
doc = xml.dom.minidom.parse(fh)
explore_children(doc.childNodes,"")

Which prints all attrib names to the console and the text from any with name or text. What i want is all the name and org text from a record on one line, and I am completely lost, any help would be much appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:15:14+00:00Added an answer on May 28, 2026 at 11:15 am

    You don’t have to do this manually, use google’s gdata library:

    pip install gdata
    

    then:

    >>> from gdata.contacts import client
    >>> gd_client = client.ContactsClient(source='YOUR_APPLICATION_NAME', domain='place.com')
    >>> profile = gd_client.GetProfile('https://www.google.com/m8/feeds/profiles/domain/place.com/full/pname')
    

    more examples: http://code.google.com/googleapps/domain/profiles/developers_guide.html (the Python tabs in all examples)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to parse an RSS feed using Linq to XML like so:
I'm trying to parse XML feed that I get via Google Contacts API with
I have an xml feed at this url Now im trying parse the content,
I'm trying to parse an RSS feed using LINQ to Xml This is the
I am trying to parse this xml feed [0] => SimpleXMLElement Object ( [title]
I'm trying to parse an xml file My code looks like: string path2 =
Since Days i'm trying to parse a YOUTUBE-XML-Feed by using GDATA-API for iOS. http://code.google.com/intl/de-DE/apis/youtube/2.0/developers_guide_protocol_channel_search.html
I'm trying to parse an Atom feed programmatically. I have the atom XML downloaded
Trying to parse some XML but apparently this is too much for a lazy
I'm trying to parse this XML string: <?xml version=1.0 encoding=UTF-8 standalone=no?> <response type=success> <lots>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.