Re: no line breaks in xml file with elementTree

2010-10-31 Thread Diez B. Roggisch
hackingKK  writes:

> On Sunday 31 October 2010 01:58 PM, Lawrence D'Oliveiro wrote:
>> In message, hackingKK
>> wrote:
>>
>>
>>> I want to know if there is a way to have the ElementTree module write to
>>> an xml file with line breaks?
>>>  
>> Why does it matter? The XML files you generate are not for humans to look
>> at, are they?
>>
>
> So is there a function to generate tags with namespace?

http://lmgtfy.com/?q=element+tree+namespac

--

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: no line breaks in xml file with elementTree

2010-10-31 Thread Stefan Behnel

hackingKK, 31.10.2010 10:04:

On Sunday 31 October 2010 01:58 PM, Lawrence D'Oliveiro wrote:

hackingKK wrote:

Further more, I just was curious why elementtree is not having the
namespace facility?


ElementTree handles namespaces just fine.


So is there a function to generate tags with namespace?


Yes, it's called "Element", as in

el = ET.Element('{http://the.name/space}tag')

Reading the docs helps a lot here.

Stefan

--
http://mail.python.org/mailman/listinfo/python-list


Re: no line breaks in xml file with elementTree

2010-10-31 Thread hackingKK

On Sunday 31 October 2010 01:58 PM, Lawrence D'Oliveiro wrote:

In message, hackingKK
wrote:

   

I want to know if there is a way to have the ElementTree module write to
an xml file with line breaks?
 

Why does it matter? The XML files you generate are not for humans to look
at, are they?
   


So is there a function to generate tags with namespace?

happy hacking.
Krishnakant.

--
http://mail.python.org/mailman/listinfo/python-list


Re: no line breaks in xml file with elementTree

2010-10-31 Thread Lawrence D'Oliveiro
In message , hackingKK 
wrote:

> I want to know if there is a way to have the ElementTree module write to
> an xml file with line breaks?

Why does it matter? The XML files you generate are not for humans to look 
at, are they?

> Further more, I just was curious why elementtree is not having the
> namespace facility?

ElementTree handles namespaces just fine.
-- 
http://mail.python.org/mailman/listinfo/python-list


no line breaks in xml file with elementTree

2010-10-31 Thread hackingKK

Hello all.
I want to know if there is a way to have the ElementTree module write to 
an xml file with line breaks?
I find that when I use the write function from the module on a tree 
object, the resulting file has no line breaks.  I don't want to use 
prittyprint because it is adding extra tabs to the file and they are 
either counted as extra nodes or in case of element.text with 
elementtree, they are rendered as a part of the text, both being 
impractical results.
So is there a middle approach where we can have some  thing similar to 
prityprint but without the extra tabs and yet having a properly line 
breaked xml file?
Further more, I just was curious why elementtree is not having the 
namespace facility?

xml.dom.minidom has a way to generate tags with namespaces.
Any thing similar in elementTree?

happy hacking.
Krishnakant.



--
http://mail.python.org/mailman/listinfo/python-list