Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50429
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <anthra.norell@bluewin.ch> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'subject:error': 0.03; 'output': 0.05; 'tree': 0.05; 'column': 0.07; 'lines.': 0.09; 'xml.': 0.09; 'python': 0.11; 'sections': 0.14; '2.7.3': 0.16; 'angled': 0.16; 'brackets': 0.16; 'brackets.': 0.16; 'dots': 0.16; 'preserve': 0.16; 'received:195.186': 0.16; 'received:bluewin.ch': 0.16; 'slash': 0.16; 'statements,': 0.16; 'all,': 0.19; 'examples': 0.20; 'fit': 0.20; '>>>': 0.22; 'import': 0.22; 'aug': 0.22; 'separate': 0.22; 'header:User-Agent:1': 0.23; 'of.': 0.24; 'parse': 0.24; "haven't": 0.24; 'skip:" 40': 0.26; 'tutorials': 0.26; 'character': 0.29; 'raise': 0.29; 'errors': 0.30; 'lines': 0.31; '"",': 0.31; 'bunch': 0.31; 'fault': 0.31; 'file': 0.32; 'summary': 0.32; '(most': 0.33; 'sense': 0.34; 'could': 0.34; "can't": 0.35; 'in.': 0.36; 'tech': 0.36; 'ubuntu': 0.36; 'thanks': 0.36; 'wrong': 0.37; 'feed': 0.38; 'to:addr:python- list': 0.38; 'recent': 0.39; 'subject:can': 0.39; 'to:addr:python.org': 0.39; 'space': 0.40; 'tag': 0.61; 'numbers': 0.61; 'first': 0.61; 'show': 0.63; 'stand': 0.64; 'url:p': 0.64; 'latest': 0.67; 'url:0': 0.67; 'finance': 0.70; 'url:a': 0.72; 'cut': 0.74; 'url:jpg': 0.83; '"".': 0.84; 'experiment': 0.84; 'url:fi': 0.84; 'url:l': 0.97 |
| Date | Thu, 11 Jul 2013 10:59:16 +0200 |
| From | "F.R." <anthra.norell@bluewin.ch> |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | ElementTree: can't figure out a mismached-tag error |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4577.1373533224.3114.python-list@python.org> (permalink) |
| Lines | 61 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1373533224 news.xs4all.nl 15921 [2001:888:2000:d::a6]:58152 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:50429 |
Show key headers only | View raw
Hi all,
I haven't been able to get up to speed with XML. I do examples from the
tutorials and experiment with variations. Time and time again I fail
with errors messages I can't make sense of. Here's the latest one. The
url is "http://finance.yahoo.com/q?s=XIDEQ&ql=0". Ubuntu 12.04 LTS,
Python 2.7.3 (default, Aug 1 2012, 05:16:07) [GCC 4.6.3]
>>> import xml.etree.ElementTree as ET
>>> tree = ET.parse('q?s=XIDEQ') # output of wget
http://finance.yahoo.com/q?s=XIDEQ&ql=0
Traceback (most recent call last):
File "<pyshell#69>", line 1, in <module>
tree = ET.parse('q?s=XIDEQ')
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1183, in parse
tree.parse(source, parser)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 656, in parse
parser.feed(data)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1643, in feed
self._raiseerror(v)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1507, in
_raiseerror
raise err
ParseError: mismatched tag: line 9, column 2
Below first nine lines. The line numbers and the following space are
hand-edited in. Three dots stand for sections cut out to fit long lines.
Line 6 is a bunch of "meta" statements, all of which I show on a
separate line each in order to preserve the angled brackets. On all
lines the angled brackets have been preserved. The mismatched character
is the slash of the closing tag </head>. What could be wrong with it?
And if it is, what about fault tolerance?
1 <!DOCTYPE html PUBLIC "-//W3C//DTD . . . /strict.dtd">
2 <html lang="en-US">
3 <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
4 <title>XIDEQ: Summary for EXIDE TECH NEW- Yahoo! Finance</title>
5 <meta name="description" xml:space="default" content="View the basic
XIDEQ . . .
6 . . . other companies."><meta name="keywords" content="XIDEQ, EXIDE
TECH . . .">
<meta property="fb:app_id" content="118155468215844">
<meta property="fb:admins" content="503762770,100001149693905">
<meta property="og:type" content="company">
<meta property="og:site_name" content="Yahoo! Finance">
<meta property="og:title" content="Exide Technologies">
<meta property="og:image"
content="http://l.yimg.com/a/p/fi/31/09/00.jpg">
<meta property="og:url" content="http://finance.yahoo.com/q?s=XIDEQ">
<meta property="og:description" content="View the basic XIDEQ . . .
7 other companies."><link rel="canonical"
href="http://finance.yahoo.com/q?s=XIDEQ">
8 <link rel="stylesheet" href="http://l.yimg.com/zz/ . . . type="text/css">
9 </head>
^
Mismatch!
Thanks for suggestions
Frederic
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
ElementTree: can't figure out a mismached-tag error "F.R." <anthra.norell@bluewin.ch> - 2013-07-11 10:59 +0200
csiph-web