2

I've done some research on trying to parse an XML file from another web server and came across something called minidom.

I've tried implementing this in my view.py file:

from xml.dom import minidom
import models

def test(request):

    data={}
    doc=minidom.parse("http://www.someotherdomain.com/XML.aspx?id=27550&limit=100")

The problem I'm running into is I get the error Exception Value: [Errno 2] No such file or directory: 'http://www.someotherdomain.com/XML.aspx?id=27550&limit=100'

I haven't been able to find out if you can use minidom on an external document or if it's only for documents located on the same server.

If this is not possible or is not the ideal solution?

1 Answer 1

9

Apparently minidom cannot parse URLs. You have to do

import urllib2
doc = urllib2.urlopen(your_url)
parsed = minidom.parse(doc)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.