Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Error parsing (some) large XML files
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Matthew Wilkens  
View profile  
 More options Oct 11 2012, 10:29 am
From: Matthew Wilkens <mattwilk...@gmail.com>
Date: Thu, 11 Oct 2012 07:29:16 -0700 (PDT)
Local: Thurs, Oct 11 2012 10:29 am
Subject: Error parsing (some) large XML files

I'm having what seems like an odd problem parsing the attached XML file.
When I try this:

from bs4 import BeautifulSoup
soup = BeautifulSoup(open('problem.xml', 'r'), 'xml')

I get the following error:

Traceback (most recent call last):
  File "test-bs-xml.py", line 2, in <module>
    soup = BeautifulSoup(open('problem.xml', 'r'), 'xml')
  File "/Library/Python/2.7/site-packages/bs4/__init__.py", line 172, in
__init__
    self._feed()
  File "/Library/Python/2.7/site-packages/bs4/__init__.py", line 185, in
_feed
    self.builder.feed(self.markup)
  File "/Library/Python/2.7/site-packages/bs4/builder/_lxml.py", line 85,
in feed
    self.parser.close()
  File "parser.pxi", line 1164, in lxml.etree._FeedParser.close
(src/lxml/lxml.etree.c:79835)
  File "parsertarget.pxi", line 126, in
lxml.etree._TargetParserContext._handleParseResult
(src/lxml/lxml.etree.c:88881)
  File "lxml.etree.pyx", line 282, in
lxml.etree._ExceptionContext._raise_if_stored (src/lxml/lxml.etree.c:7469)
  File "saxparser.pxi", line 170, in lxml.etree._handleSaxStart
(src/lxml/lxml.etree.c:84109)
  File "parsertarget.pxi", line 73, in
lxml.etree._PythonSaxParserTarget._handleSaxStart
(src/lxml/lxml.etree.c:88236)
  File "/Library/Python/2.7/site-packages/bs4/builder/_lxml.py", line 126,
in start
    attr = NamespacedAttribute(nsprefix, attr, namespace)
  File "/Library/Python/2.7/site-packages/bs4/element.py", line 30, in
__new__
    obj = unicode.__new__(cls, prefix + ":" + name)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'

Things are working fine on (some) other XML files, so it seems to something
about the content of this one (and many others like it in a set I'm working
with). A Unicode problem, maybe? Any idea what the issue could be? Dumbness
on my part, I suspect.

I'm using Beautiful Soup 4.1.3 and lxml 2.3.6 under Python 2.7.2 on Mac OS
X 10.8.2.

Many thanks!

  problem.xml
12K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Leonard Richardson  
View profile  
 More options Oct 11 2012, 2:20 pm
From: Leonard Richardson <leona...@segfault.org>
Date: Thu, 11 Oct 2012 14:20:53 -0400
Local: Thurs, Oct 11 2012 2:20 pm
Subject: Re: Error parsing (some) large XML files
This is a bug in Beautiful Soup. I've filed it for you:

https://bugs.launchpad.net/beautifulsoup/+bug/1065617

A fix will be present in the next release.

Leonard


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Matthew Wilkens  
View profile  
 More options Oct 16 2012, 4:27 pm
From: Matthew Wilkens <mattwilk...@gmail.com>
Date: Tue, 16 Oct 2012 13:27:41 -0700 (PDT)
Local: Tues, Oct 16 2012 4:27 pm
Subject: Re: Error parsing (some) large XML files

Excellent - thanks very much!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »