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

  • Home
  • SEARCH
  • 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 8020767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:47:00+00:00 2026-06-04T21:47:00+00:00

my xml code fetched over network looks like this <?xml version=’1.0′ ?><liverequestresponse><liverequesttime>180</liverequesttime><livemessage></livemessage></liverequestresponse> and my

  • 0

my xml code fetched over network looks like this

<?xml version='1.0' ?><liverequestresponse><liverequesttime>180</liverequesttime><livemessage></livemessage></liverequestresponse>

and my python minidom code is

import urllib, urllib2, time
from xml.dom.minidom import parse
response = urllib2.urlopen(req)
the_page = response.read() 
#print the_page 
dom = parse(response)
name = dom.getElementsByTagNameNS('liverequestresponse')
print name[0].nodeValue

gives some errors

print the_page

works fine

Or if they are any other libraries which are better than minidom, plz tell me..
I would prefer the one which comes pre-installed on linux

UPDATE

errors

Traceback (most recent call last):
  File "logout.py", line 18, in <module>
    dom = parse(response)
  File "/usr/lib64/python2.7/xml/dom/minidom.py", line 1920, in parse
    return expatbuilder.parse(file)
  File "/usr/lib64/python2.7/xml/dom/expatbuilder.py", line 928, in parse
    result = builder.parseFile(file)
  File "/usr/lib64/python2.7/xml/dom/expatbuilder.py", line 211, in parseFile
    parser.Parse("", True)
xml.parsers.expat.ExpatError: no element found: line 1, column 0
  • 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-04T21:47:03+00:00Added an answer on June 4, 2026 at 9:47 pm

    if you use response.read before parse(response) you’ll already have read the content of the response. a second call to response.read (which parse is doing) will result in an empty string.

    The simplest solution is to just drop the first response.read call. But if you really need the response string for some reason, you could try:

    import urllib, urllib2, time
    import StringIO
    from xml.dom.minidom import parse
    response = urllib2.urlopen(req)
    the_page = response.read() 
    #print the_page 
    dom = parse(StringIO.StringIO(the_page))
    name = dom.getElementsByTagName('liverequesttime')
    text = name[0].firstChild
    print text.nodeValue
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml code that looks like below: <?xml version=1.0 encoding=UTF-8?> <metadata><fields><field-order/></fields><roles><role name=DEFAULT3_MOD><state
My XML code is like this: <?xml version=1.0 encoding=utf-8?> <Tabel> <Member> <Naam>Cruciatum</Naam> <Kills>1000</Kills> <Deaths>10</Deaths>
I have a XML code like this: <?xml version=1.0 encoding=utf-8 ?> <Window xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml>
I want to load the inside values from this xml code: <?xml version=1.0 encoding=UTF-8?>
This is xml code: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/mainLayout android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical> </LinearLayout>
Is that my XML code valid or not. <?xml version=1.0?> <!DOCTYPE nahrung [ <!ELEMENT
hi i have choose XML code over java code for static PNG images to
I have this XML code which generates a button, a textview and another button,
My xml code: <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/RelativeLayout1 android:layout_width=match_parent android:layout_height=match_parent android:orientation=vertical > <RelativeLayout
This XML code results in the checkbox and text being on the same line

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.