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 8660761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:20:19+00:00 2026-06-12T16:20:19+00:00

I have a problem during parsing the following xml from a url. sample XML

  • 0

I have a problem during parsing the following xml from a url.

sample XML in my url path:

<?xml version="1.0" encoding="utf-8"?> 
<Documents>
    <class>
        <mid name="yyyyyyyyyyyyy"></mid>
        <person name="yyyyyyyyyy"></person>
        <url name="yyyyyyyyy"></url>
    </class>
    <class>
        <mid name="xxxxx"></mid>
        <person name="xxxxxxxxxx"></person>
        <url name="xxxxxxxxxxx"></url>
    </class>
</Documents>

Below is my python code;

def staff_list(request):

    url = http://path.to.url/
    dom = minidom.parse(urlopen(url))
    person = dom.getElementsByTagName('person')
    for i in person:
        print i.attributes['name'].value

within forloop I want to print the person and url tag values in xml that belongs to same parent class.

I tried the following method with iteration but get the “too many values to unpack” ERROR

def staff_list(request):

    url = http://path.to.url/
    dom = minidom.parse(urlopen(url))
    person = dom.getElementsByTagName('person')
    mid = dom.getElementsByTagName('mid')
    url = dom.getElementsByTagName('url')
    for i,j,k in person,mid,url:
        print i.attributes['name'].value,j.attributes['name'].value,k.attributes['name'].value

Any suggestions ?

  • 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-06-12T16:20:21+00:00Added an answer on June 12, 2026 at 4:20 pm

    You want to use zip() to combine the elements, I think:

    for i,j,k in zip(person, mid, url):
    

    Do yourself a big favour though and use the ElementTree API instead; that API is far pythononic and easier to use than the XML DOM API.

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

Sidebar

Related Questions

I have problem with UIWebView delay when the load image from url. In my
I have got an application, that is getting data via XML-files. During the parsing-part
I have a problem during the installation of Android in Eclipse (Indigo and Helios,
I have a small problem during debugging my App in VS 2010 RC when
We have a memory overwrite problem. At some point, during the course of our
During the parsing of certain xml files, I come across a situation that I
I'm downloading and parsing a XML document. During this, I want to update my
I've hit a problem during parsing of a CSV file where I get the
I have a problem with class member function templates. It seems that gcc is
I have the following problem - I'm running a checkstyle ant task when building

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.