In Peter Otten <__pete...@web.de> writes:
>How about
>http://effbot.org/zone/element-iterparse.htm#incremental-parsing
Exactly!
Thanks!
~K
--
http://mail.python.org/mailman/listinfo/python-list
kj wrote:
> I want to write code that parses a file that is far bigger than
> the amount of memory I can count on. Therefore, I want to stay as
> far away as possible from anything that produces a memory-resident
> DOM tree.
>
> The top-level structure of this xml is very simple: it's just a
> v
he generator sense) the next record,
thereby returning control to the caller; the caller can process
the record, delete it from memory, and return control to the
parser-iterator; once parser-iterator regains control, it repeats
this sequence starting where it left off.
The problem, as I see it, is that SAX
On 2 Ιούν, 03:47, John Machin wrote:
> On Jun 2, 1:57 am, "kak...@gmail.com" wrote:
>
>
>
>
>
> > On Jun 1, 11:12 am, "kak...@gmail.com" wrote:
>
> > > On Jun 1, 11:09 am, John Bokma wrote:
>
> > > > "kak...@gmail.com" writes:
> > > > > On Jun 1, 10:34 am, Stefan Behnel wrote:
> > > > >> kak.
On Jun 2, 1:57 am, "kak...@gmail.com" wrote:
> On Jun 1, 11:12 am, "kak...@gmail.com" wrote:
>
>
>
> > On Jun 1, 11:09 am, John Bokma wrote:
>
> > > "kak...@gmail.com" writes:
> > > > On Jun 1, 10:34 am, Stefan Behnel wrote:
> > > >> kak...@gmail.com, 01.06.2010 16:00:
>
> > > >> > how can i f
On Jun 1, 11:12 am, "kak...@gmail.com" wrote:
> On Jun 1, 11:09 am, John Bokma wrote:
>
>
>
> > "kak...@gmail.com" writes:
> > > On Jun 1, 10:34 am, Stefan Behnel wrote:
> > >> kak...@gmail.com, 01.06.2010 16:00:
>
> > >> > how can i fix it, how to "ignore" the headers and parse only
> > >> > t
On Jun 1, 11:09 am, John Bokma wrote:
> "kak...@gmail.com" writes:
> > On Jun 1, 10:34 am, Stefan Behnel wrote:
> >> kak...@gmail.com, 01.06.2010 16:00:
>
> >> > how can i fix it, how to "ignore" the headers and parse only
> >> > the XML?
>
> >> Consider reading the answers you got in the last t
"kak...@gmail.com" writes:
> On Jun 1, 10:34 am, Stefan Behnel wrote:
>> kak...@gmail.com, 01.06.2010 16:00:
>>
>> > how can i fix it, how to "ignore" the headers and parse only
>> > the XML?
>>
>> Consider reading the answers you got in the last thread that you opened
>> with exactly this quest
On Jun 1, 10:34 am, Stefan Behnel wrote:
> kak...@gmail.com, 01.06.2010 16:00:
>
> > how can i fix it, how to "ignore" the headers and parse only
> > the XML?
>
> Consider reading the answers you got in the last thread that you opened
> with exactly this question.
>
> Stefan
That's exactly, what
kak...@gmail.com, 01.06.2010 16:00:
how can i fix it, how to "ignore" the headers and parse only
the XML?
Consider reading the answers you got in the last thread that you opened
with exactly this question.
Stefan
--
http://mail.python.org/mailman/listinfo/python-list
ine 460, in doRead
>> > return self.protocol.dataReceived(data)
>> > File "stdiodemo.py", line 419, in dataReceived
>> > p.Parse(line, 1)
>> > xml.parsers.expat.ExpatError: syntax error: line 1, column 0
>>
>> > The XML Message is coming
ived(data)
> > File "stdiodemo.py", line 419, in dataReceived
> > p.Parse(line, 1)
> > xml.parsers.expat.ExpatError: syntax error: line 1, column 0
>
> > The XML Message is coming in the form of:
>
> > POST /test/pcp/Listener HT
rs.expat.ExpatError: syntax error: line 1, column 0
>
>
> The XML Message is coming in the form of:
>
> POST /test/pcp/Listener HTTP/1.1
Does Expat get this line as well? If so, that's the reason why you get
an error at line 1, column 0.
--
John Bokma
Hi i'm doing the following:
def start_element(name, attrs):
print 'Start element:', name, attrs
def end_element(name):
print 'End element:', name
def char_data(data):
print 'Character data:', repr(data)
class SimpleServer(LineReceiver): # Using Twisted
def connectionMade(self):
Hi i'm doing the following:
def start_element(name, attrs):
print 'Start element:', name, attrs
def end_element(name):
print 'End element:', name
def char_data(data):
print 'Character data:', repr(data)
class SimpleServer(LineReceiver): # Using Twisted
def connectionMade(self):
On Dec 11, 4:39 pm, Rami Chowdhury wrote:
> On Fri, Dec 11, 2009 at 13:23, nnguyen wrote:
>
> > Any ideas on any expat tricks I'm missing out on? I'm also inclined to
> > try another parser that can keep the string together when there are
> > entities, or a
On Dec 11, 4:23 pm, nnguyen wrote:
> I need expat to parse this block of xml:
>
>
> c-P&P
> LOT 3677
> (F)
>
>
> I need to parse the xml and return a dictionary that follows roughly
> the same layout as the xml. Currently the code for the class han
On Fri, Dec 11, 2009 at 13:23, nnguyen wrote:
>
> Any ideas on any expat tricks I'm missing out on? I'm also inclined to
> try another parser that can keep the string together when there are
> entities, or at least ampersands.
IIRC expat explicitly does not guarantee that
I need expat to parse this block of xml:
c-P&P
LOT 3677
(F)
I need to parse the xml and return a dictionary that follows roughly
the same layout as the xml. Currently the code for the class handling
this is:
class XML2Map():
def __init__(self):
""" &quo
hari wrote:
> Am very new to XML, I have a query, Does Python libexpat and EXPAT
> are same or they are diffrent?
Depends on what you mean with "EXPAT". Python's expat module that you can
find in the standard library is the well known non-validating XML parser
originally w
Hi all,
Am very new to XML, I have a query, Does Python libexpat and EXPAT
are same or they are diffrent?
Thanks in advance.
Regards,
Hari
--
http://mail.python.org/mailman/listinfo/python-list
Chris Rebert wrote:
> On Fri, Jan 23, 2009 at 11:19 AM, aha wrote:
>> I've been charged with developing an XML configuration file format,
>> for one of the applications that my company develops.
>> [...]
>> I am still trying to determine the
>> best XML parser API to use. I would love to use XPAT
ay to go, but then I ran across the Recipes of Wai
> Yip Tung
>
> http://code.activestate.com/recipes/534109/
>
>
> and John Bair, Christoph Dietze from the second edition of the Python
> cookbook.
>
> Wai's implementation uses thes SAX parser and John and Christoph
oph Dietze from the second edition of the Python
cookbook.
Wai's implementation uses thes SAX parser and John and Christoph's
implementation uses Expat API.
In the end what I really want is to transform the XML
into an object that looks like
config.component.set
On Sep 11, 4:48 pm, Manuel Ebert <[EMAIL PROTECTED]> wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Ah, well. Don't know whether it meets your aesthetic standards, but:
> >>> my_list = ['tree', 'hug', 'flower', 'hug', 'bear', 'run']
> >>> my_list[0:len(a):2]
> ['tree', 'flower', 'be
lem is that the second
> >> parameter you passed to start_element is not a dictionary at all (the
> >> clue is in the "AttributeError: 'LIST' object" ...).
>
> >> >>> d = ['tree', 'house']
> >> >>> start_elemen
sed to start_element is not a dictionary at all (the
clue is in the "AttributeError: 'LIST' object" ...).
>>> d = ['tree', 'house']
>>> start_element("Thing", d)
Thing :
AttributeError: 'list' object has no attribute
gt;>> d = {'tree': 'hug', 'flower' : 'eat'}
> >>> start_element("Thing", d)
> Thing : flower="eat" tree="hug"
>
> Manuel
>
> On Sep 11, 2008, at 4:21 PM, [EMAIL PROTECTED] wrote:
>
>
>
ng", d)
Thing : flower="eat" tree="hug"
Manuel
On Sep 11, 2008, at 4:21 PM, [EMAIL PROTECTED] wrote:
Hi
I'm new to Python and trying to pick up good, idiomatic usage right
from the offset.
As I was familiar with Expat from C++ (directly and via expatpp) I'm
try
Hi
I'm new to Python and trying to pick up good, idiomatic usage right
from the offset.
As I was familiar with Expat from C++ (directly and via expatpp) I'm
trying to write a little script - using xml.parsers.expat - to search
and replace XML attribute values.
As I want the attribut
Gerth, William D wrote:
Hey all, I’m simply trying to get my feet wet with XML parsing, and I
tried to just do something simple with ElementTree, just throw the XML
tags from a file into a list. The code is as follows (and may be wrong):
...
xml.parsers.expat.ExpatError: no element found:
Hey all, I'm simply trying to get my feet wet with XML parsing, and I
tried to just do something simple with ElementTree, just throw the XML
tags from a file into a list. The code is as follows (and may be
wrong):
import glob
import xml.etree.ElementTree as ET
tree = ET.parse('nameofFileh
On Thu, 28 Feb 2008 12:37:10 -0800, dirkheld wrote:
>> Yes of course: handle the exception instead of letting it propagate to the
>> top level and ending the program.
>
> Ehm, maybe a stupid question... how. I'm rather new to python and I
> never user error handling.
Then you should work through
dirkheld wrote:
> On 28 feb, 08:18, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>> On Wed, 27 Feb 2008 14:02:25 -0800, dirkheld wrote:
>>> Something strange here. The xml file causing the problem has only 361
>>> lines. Isn't there a way to catch this error, ignore it and continu
>>> with t
On 28 feb, 08:18, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Wed, 27 Feb 2008 14:02:25 -0800, dirkheld wrote:
> > Something strange here. The xml file causing the problem has only 361
> > lines. Isn't there a way to catch this error, ignore it and continu
> > with the rest of the othe
On Wed, 27 Feb 2008 14:02:25 -0800, dirkheld wrote:
> Something strange here. The xml file causing the problem has only 361
> lines. Isn't there a way to catch this error, ignore it and continu
> with the rest of the other files?
Yes of course: handle the exception instead of letting it propagate
On 27 feb, 17:18, "Richard Brodie" <[EMAIL PROTECTED]> wrote:
> "dirkheld" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
>
> > xml.parsers.expat.ExpatError: not well-formed (invalid token): line
> > 554, column 20
>
> > I guess that the element I try to read or the XML(which would
"dirkheld" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> xml.parsers.expat.ExpatError: not well-formed (invalid token): line
> 554, column 20
>
> I guess that the element I try to read or the XML(which would be
> strange since they have been created with the same code) can't ben
Hi,
I have written a piece of code that reads all xml files in a directory
in onder to retrieve one element in each of these files. All files
have the same XML structure. After file 123 I receive the following
error :
xml.parsers.expat.ExpatError: not well-formed (invalid token): line
554, column
Wildemar Wildenburger wrote:
> sharan wrote:
>> I've been experimenting with the jclark's expat parser. I compiled it
>> on
>> linux, and it works just great. However, finding tags and data by
>> implementing the callback functions in c language is cumbers
sharan wrote:
> I've been experimenting with the jclark's expat parser. I compiled it
> on
> linux, and it works just great. However, finding tags and data by
> implementing the callback functions in c language is cumbersome.
> Has anybody written code that uses the e
I've been experimenting with the jclark's expat parser. I compiled it
on
linux, and it works just great. However, finding tags and data by
implementing the callback functions in c language is cumbersome.
Has anybody written code that uses the expat callback's in such a wa
Aloha,
Andreas Lobinger wrote:
> Andreas Lobinger wrote:
>> Lawrence D'Oliveiro wrote:
>>> In message <[EMAIL PROTECTED]>, Andreas Lobinger wrote:
Anyone any idea where the error is produced?
> The registered Handler has to return a (integer) value.
> Would have been nice if this had been men
Aloha,
Andreas Lobinger wrote:
> Lawrence D'Oliveiro wrote:
>> In message <[EMAIL PROTECTED]>, Andreas Lobinger wrote:
>>> Anyone any idea where the error is produced?
... to share my findings with you:
def ex(self,context,baseid,n1,n2):
print "x",context,n1,n2
return 1
T
e chapter
e book
Traceback (most recent call last):
File "pbxml.py", line 29, in ?
fromxml(sys.argv[1])
File "pbxml.py", line 24, in fromxml
p.ParseFile(file(fname))
TypeError: an integer is required
which shows me that the error is caused after parsing the /book ...
B
In message <[EMAIL PROTECTED]>, Andreas Lobinger wrote:
> Anyone any idea where the error is produced?
Do you want to try adding an EndElementHandler as well, just to get more
information on where the error might be happening?
--
http://mail.python.org/mailman/listinfo/python-list
Aloha,
i'm trying to write an xml filter, that extracts some info about
an .xml document (with external entities), esp. start elements and
external entities. The document is a DOCBOOK xml and afacs
well formed and passes our docbook toolchain (dblatex etc.).
My parser is (very simple):
[115] scyl
> Character data: u'\n'
> Character data: u'EAFLTQKQKVGELKDDDFEKISELGAGNGGVVFKVSHKPSGLVMARKLIH'
> ...
> End element: sequence
> ...
>
> Is there a way to have the character data together in one string? I
> guess it should not be difficult, but I can't do it. Each time the
> parse reads a line, return a line, and I want to have it in one
> variable.
Any reason you are using expat and not cElementTree's iterparse?
Stefan
--
http://mail.python.org/mailman/listinfo/python-list
I have this code:
import xml.parsers.expat
def start_element(name, attrs):
print 'Start element:', name, attrs
def end_element(name):
print 'End element:', name
def char_data(data):
print 'Character data:', repr(data)
p = xml.parsers.expat.ParserCreate()
p.StartElementHandler = start_e
Fredrik Lundh wrote:
> Gary Robinson wrote:
>
>> We're using xml.sax.xmlreader in our app (http://www.goombah.com,
>> which is written in Python).
>>
>> In Python 2.3.x, does that use the C-language expat under the hood?
>
> yes.
>
>> The reas
Gary Robinson wrote:
> We're using xml.sax.xmlreader in our app (http://www.goombah.com, which
> is written in Python).
>
> In Python 2.3.x, does that use the C-language expat under the hood?
yes.
> The reason I'm asking is because we're wondering if
Hi,
We're using xml.sax.xmlreader in our app (http://www.goombah.com, which
is written in Python).
In Python 2.3.x, does that use the C-language expat under the hood? The
reason I'm asking is because we're wondering if we can speed up the
parsing significantly.
Thanks in
Merci à Frederik et Jarek!
According to your hints I did tests with a different coding and another option
in OpenOffice 'Size optimization for XML format'.
Went fine! - Back to my files from yesterday the same proper converting... uups
Anyway, it's running!
Katja
--
http://mail.python.org/mailman
.expat is a standard module that probably has no errors.
> So what could cause this error message??
Malformed XML document, perhaps. This may be anything, that expat
doesn't like (i.e. wrong encoding, cp1252 declared as latin-1, document
declared as utf-8 but with BOM, and so on).
--
Jarek
Katja Suess wrote:
> may I have a hint what the problem is in my situation?
> Is it a syntax error in sweetone.odt or in xml.parsers.expat?
> xml.parsers.expat.ExpatError: syntax error: line 1, column 0
it's a problem with the file you're parsing (either because it's not a
valid XML file, or bec
Hi,
may I have a hint what the problem is in my situation?
Is it a syntax error in sweetone.odt or in xml.parsers.expat?
Same problem with different file instead of sweetone.odt means that it's not
the file that has a syntax error.
xml.parsers.expat is a standard module that probably has no errors
I needed to set Entity Parsing, such as
parser.SetParamEntityParsing( expat.XML_PARAM_ENTITY_PARSING_ALWAYS )
--
http://mail.python.org/mailman/listinfo/python-list
I have a simple Kid template document:
http://www.w3.org/1999/xhtml";
xmlns:py="http://purl.org/kid/ns#";
>
... (snip)
This runs as expected but now I would like to load a DTD without
tampering with this xml file
In the expat parser __init__ after setting other hand
On 7/19/05, Bernhard Herzog <[EMAIL PROTECTED]> wrote:
> This sounds like this bugreport on sourceforge:
> http://python.org/sf/1075984
Thanks! I applied the workaround posted by `bos' and things seem to work now.
--
Steve Juranich
Tucson, AZ
USA
--
http://mail.python.org/mailman/listinfo/pyth
Steve Juranich <[EMAIL PROTECTED]> writes:
> I'm running into problems where Python and VTK both ship with their
> own distribution of the Expat parser. As long as you never use the
> Python XML package, everything is fine. But if you try using the
> Python XML parser aft
I'm running into problems where Python and VTK both ship with their
own distribution of the Expat parser. As long as you never use the
Python XML package, everything is fine. But if you try using the
Python XML parser after doing an `import vtk', a nice little message
saying "Seg
"""
> Most examples in the book do not include such a declaration and yet
are
> properly rendered by Internet Explorer.
> Is it mandatory and why is it that Expat crashes on it?
It's not mandatory but it's probably good practice to make the document
self-contain
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Most examples in the book do not include such a declaration and yet are
> properly rendered by Internet Explorer.
> Is it mandatory and why is it that Expat crashes on it?
It's not mandatory but it's proba
yet are
properly rendered by Internet Explorer.
Is it mandatory and why is it that Expat crashes on it?
Alain
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> I use Elementtree to parse an elementary SVG file (in fact, it is one
> of the examples in the "SVG essentials" book). More precisely, it is
> the fig0201.svg file in the second chapter.
> The contents of the file are as follows (i hope it will be rendered
> correctly):
Armin Steinhoff wrote:
>
>
> Hi all,
>
> is it possible to get the name of an empty element specified
> by ... the expat parser seems only to recognize
> the form
>
> Regards
>
> Armin
Ok ... found the root of the problem. The expat parser is OK
Hi all,
is it possible to get the name of an empty element specified
by ... the expat parser seems only to recognize
the form
Regards
Armin
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I use Elementtree to parse an elementary SVG file (in fact, it is one
of the examples in the "SVG essentials" book). More precisely, it is
the fig0201.svg file in the second chapter.
The contents of the file are as follows (i hope it will be rendered
correctly):
http://www.w3.org/TR/2001/RE
I am playing around with jabberpy, and on a lark decided to try to freeze
one of the included samples, test_client.py
The freeze/build worked fine, but when I attempted to run the resulting
binary, I got an error hinting that it couldn't find parsers.expat:
canal:/home/chris/build% ./test_client
69 matches
Mail list logo