Steven D'Aprano wrote:
> On Fri, 01 Feb 2008 07:51:56 +1100, Ben Finney wrote:
>
>> Steven D'Aprano <[EMAIL PROTECTED]> writes:
>>
>>> On Fri, 01 Feb 2008 00:40:01 +1100, Ben Finney wrote:
>>>
Quite apart from a human thinking it's pretty or not pretty, it's
*not valid XML* if the XML de
On Fri, 01 Feb 2008 07:51:56 +1100, Ben Finney wrote:
> Steven D'Aprano <[EMAIL PROTECTED]> writes:
>
>> On Fri, 01 Feb 2008 00:40:01 +1100, Ben Finney wrote:
>>
>> > Quite apart from a human thinking it's pretty or not pretty, it's
>> > *not valid XML* if the XML declaration isn't immediately a
On Sat, 02 Feb 2008 07:24:36 +0100, Stefan Behnel wrote:
> Steven D'Aprano wrote:
>> The same way it knows that "> encoding. If the parser knows that the hex bytes
>>
>> 3c 3f 78 6d 6c
>>
>> (or 3c 00 3f 00 78 00 6d 00 6c 00 if you prefer UTF-16, and feel free
>> to swap the byte order)
>>
>> m
Steven D'Aprano wrote:
> The same way it knows that " encoding. If the parser knows that the hex bytes
>
> 3c 3f 78 6d 6c
>
> (or 3c 00 3f 00 78 00 6d 00 6c 00 if you prefer UTF-16, and feel free to
> swap the byte order)
>
> mean "
> then it can equally know that bytes
>
> 20 09 0a
>
> a
On Thu, 31 Jan 2008 18:35:17 +0100, Stefan Behnel wrote:
> Hi,
>
> Steven D'Aprano wrote:
>> On Fri, 01 Feb 2008 00:40:01 +1100, Ben Finney wrote:
>>
>>> Quite apart from a human thinking it's pretty or not pretty, it's *not
>>> valid XML* if the XML declaration isn't immediately at the start of
Ivan Illarionov wrote:
>> Also, for XML documents, they were probably thinking that the
>> documents will be machine-generated most of the time. As far as I can
>> tell, they were right in that.
>
> If anybody has to deal with human-generated XML/HTML in Python it may
> be better to use something
> Also, for XML documents, they were probably thinking that the
> documents will be machine-generated most of the time. As far as I can
> tell, they were right in that.
If anybody has to deal with human-generated XML/HTML in Python it may
be better to use something like http://www.crummy.com/softw
Diez B. Roggisch wrote:
> Ricardo Aráoz schrieb:
>> Diez B. Roggisch wrote:
>>> Ricardo Aráoz schrieb:
Thanks Ivan, it seems a elegant API, and easy to use.
I tried to play a little with it but unfortunately could not get it off
the ground. I kept getting
>>> root = et.fromstring
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> On Fri, 01 Feb 2008 00:40:01 +1100, Ben Finney wrote:
>
> > Quite apart from a human thinking it's pretty or not pretty, it's *not
> > valid XML* if the XML declaration isn't immediately at the start of the
> > document http://www.w3.org/TR/xml/#sec-p
Stefan Behnel wrote:
> Steven D'Aprano wrote:
>> On Fri, 01 Feb 2008 00:40:01 +1100, Ben Finney wrote:
>>
>>> Quite apart from a human thinking it's pretty or not pretty, it's *not
>>> valid XML* if the XML declaration isn't immediately at the start of the
>>> document http://www.w3.org/TR/xml/#sec
Hi,
Steven D'Aprano wrote:
> On Fri, 01 Feb 2008 00:40:01 +1100, Ben Finney wrote:
>
>> Quite apart from a human thinking it's pretty or not pretty, it's *not
>> valid XML* if the XML declaration isn't immediately at the start of the
>> document http://www.w3.org/TR/xml/#sec-prolog-dtd>. Many XML
Steven D'Aprano schrieb:
> On Fri, 01 Feb 2008 00:40:01 +1100, Ben Finney wrote:
>
>> Quite apart from a human thinking it's pretty or not pretty, it's *not
>> valid XML* if the XML declaration isn't immediately at the start of the
>> document http://www.w3.org/TR/xml/#sec-prolog-dtd>. Many XML
>>
On Fri, 01 Feb 2008 00:40:01 +1100, Ben Finney wrote:
> Quite apart from a human thinking it's pretty or not pretty, it's *not
> valid XML* if the XML declaration isn't immediately at the start of the
> document http://www.w3.org/TR/xml/#sec-prolog-dtd>. Many XML
> parsers will (correctly) reject
Ben Finney wrote:
> Steve Holden <[EMAIL PROTECTED]> writes:
>
>> Diez B. Roggisch wrote:
>>> Ricardo Aráoz schrieb:
doc = """
>>> It's not allowed to have a newline before the
>>>
>>> Put it on the line above, and things will work.
>>>
>> If you don't think that looks pretty enough ju
Steve Holden <[EMAIL PROTECTED]> writes:
> Diez B. Roggisch wrote:
> > Ricardo Aráoz schrieb:
> >> doc = """
> >>
> >
> > It's not allowed to have a newline before the
> >
> > Put it on the line above, and things will work.
> >
> If you don't think that looks pretty enough just escape the first
Diez B. Roggisch wrote:
> Ricardo Aráoz schrieb:
>> Diez B. Roggisch wrote:
>>> Ricardo Aráoz schrieb:
Thanks Ivan, it seems a elegant API, and easy to use.
I tried to play a little with it but unfortunately could not get it off
the ground. I kept getting
>>> root = et.fromstring
Ricardo Aráoz schrieb:
> Diez B. Roggisch wrote:
>> Ricardo Aráoz schrieb:
>>> Thanks Ivan, it seems a elegant API, and easy to use.
>>> I tried to play a little with it but unfortunately could not get it off
>>> the ground. I kept getting
>> root = et.fromstring(doc)
>>> Traceback (most recent
Diez B. Roggisch wrote:
> Ricardo Aráoz schrieb:
>> Thanks Ivan, it seems a elegant API, and easy to use.
>> I tried to play a little with it but unfortunately could not get it off
>> the ground. I kept getting
> root = et.fromstring(doc)
>> Traceback (most recent call last):
>> File "", line
Ricardo Aráoz schrieb:
> Ivan Illarionov wrote:
> from xml.etree import ElementTree as et
> from decimal import Decimal
>
> root = et.parse('file/with/your.xml')
> debits = dict((debit.attrib['category'],
> Decimal(debit.find('amount').text)) for debit in root.findall('debi
Ivan Illarionov wrote:
from xml.etree import ElementTree as et
from decimal import Decimal
root = et.parse('file/with/your.xml')
debits = dict((debit.attrib['category'],
Decimal(debit.find('amount').text)) for debit in root.findall('debit'))
for cat, amount
>>> from xml.etree import ElementTree as et
>>> from decimal import Decimal
>>>
>>> root = et.parse('file/with/your.xml')
>>> debits = dict((debit.attrib['category'],
>>> Decimal(debit.find('amount').text)) for debit in root.findall('debit'))
>>>
>>> for cat, amount in debits.items():
... print
Hi,
Ricardo Aráoz wrote:
> I don't know zit about xml, but I might need to, and I am saving the
> thread for when I need it. So I looked around and found some 'real'
> XML document (see below). The question is, how to access s from
> s (any category) but not s.
>
> doc = """
>
>
> expenses: jan
> What about :
>
> doc = """
>
>99
>
>
>42
>
> """
That's not an XML document, so what about it?
Stefan
--
Ok Stefan, I will pretend it was meant in good will.
I don't know zit about xml, but I might need to, and I am saving the
thread fo
Ricardo Aráoz wrote:
> What about :
>
> doc = """
>
>99
>
>
>42
>
> """
That's not an XML document, so what about it?
Stefan
--
http://mail.python.org/mailman/listinfo/python-list
Diez B. Roggisch wrote:
> Simon Pickles schrieb:
>> Hi
>>
>> Can anyone suggest a really simple XML reader for python? I just want to
>> be able to do something like this:
>>
>> xmlDoc = xml.open("file.xml")
>> element = xmlDoc.GetElement(&q
check the implementation of XMLNode class here
http://hsivonen.iki.fi/group-feed/flickrapi.py
HTH
N
On Jan 27, 2008 11:05 PM, Simon Pickles <[EMAIL PROTECTED]> wrote:
> Hi
>
> Can anyone suggest a really simple XML reader for python? I just want to
> be able to do something lik
"Simon Pickles" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi
>
> Can anyone suggest a really simple XML reader for python? I just want to
> be able to do something like this:
>
> xmlDoc = xml.open("file.xml")
> element = xmlDoc.
Simon Pickles schrieb:
> Hi
>
> Can anyone suggest a really simple XML reader for python? I just want to
> be able to do something like this:
>
> xmlDoc = xml.open("file.xml")
> element = xmlDoc.GetElement("foo/bar")
>
> ... to read the
Hi
Can anyone suggest a really simple XML reader for python? I just want to
be able to do something like this:
xmlDoc = xml.open("file.xml")
element = xmlDoc.GetElement("foo/bar")
... to read the value of:
42
Thanks
Simon
--
Linux user #458601 - http://counter
29 matches
Mail list logo