By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,345 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,345 IT Pros & Developers. It's quick & easy.

AttributeError: 'module' object has no attribute 'getElementsByTagName'

P: 25

I am using Ubuntu10.04 with python 2.6 on 64bit system,
I want to run xml file but it stucks with an error as mentioned below.

File "", line 60, in readStrokes
strokes = dom.getElementsByTagName("Stroke")
AttributeError: 'module' object has no attribute 'getElementsByTagName'

Please suggest me about the possible error that may have.
Thanks in advance.
Sep 27 '11 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 2.5K+
P: 2,851
I have been using xml.dom.minidom, but it should work in a similar way. Create an xml document object. getElementsByTagName is a method of the xml document object.

Expand|Select|Wrap|Line Numbers
  1. from xml.dom.minidom import parseString
  2. ...snip...
  3.             f = open("data.xml', 'rb')
  4.             self.doc = parseString(
  5.             f.close()
  6.             value = self.doc.getElementsByTagName(tag)
Sep 28 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Browse more Python Questions on Bytes