473,699 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Using the indent method

dj
Hello All,

I am using elementtree to write an XML document and I am having a hard
time adding the correct indentation.
I have tried using the indent method, but I can not figure out how to
use it. Any suggestions.
Jun 27 '08 #1
1 873

"dj" <d.***********@ gmail.comwrote in message
news:ff******** *************** ***********@f63 g2000hsf.google groups.com...
Hello All,

I am using elementtree to write an XML document and I am having a hard
time adding the correct indentation.
I have tried using the indent method, but I can not figure out how to
use it. Any suggestions.
Using the version of indent() found on
http://effbot.org/zone/element-lib.htm:
>>from xml.etree import ElementTree as ET
x='<a><b /><c /><d>stuff</d><e><f /></e></a>'
e=ET.fromstri ng(x)
ET.dump(e)
<a><b /><c /><d>stuff</d><e><f /></e></a>
>>indent(e)
ET.dump(e)
<a>
<b />
<c />
<d>stuff</d>
<e>
<f />
</e>
</a>

-Mark

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2251
by: vishal | last post by:
hi i am using get method to pass data from one form to another and my value may contain & symbol. so when this is case the value after & sign is truncated which is logically true. so what should i do to solve this problem and if value contain ? symbol then it will make any difference????? i have not checked this but just it came in mind right now so i am
6
1606
by: Keith | last post by:
Is there a way to publish only one file in VS.NET 2003 using FPSE method? In FP client I can select one file at a time to publish. My web is large and it takes too long to publish the whole thing. I am using the FPSE method wthin VS.NET 2003
8
22536
by: aruna | last post by:
to write a c program to find the roots of the equation using bisection method that too using array or pointers
4
35847
by: Velhari | last post by:
Hi all, We all know in GET method upto 2048 characters can be appended into URL. In the Same way what is the limit of sending data to server by using POST Method. Why asking this question is because suppose if i will upload 20GB means it will take time to store it in servers disk, definitely there is a loss of session during this process is going on continued until many days(might be). So definitely there is a limit in data sending...
2
3999
by: =?Utf-8?B?am9obmFicmFoYW0xMDE=?= | last post by:
hello, I'm trying to write a some text to a text file using WriteAllText method. This method works fine but I don't understand how can I use format specifiers to format the text as we use in C i.e "\n" for newline, "\t" for tab,...etc. bye
0
1324
by: 2pt2mill | last post by:
I have been using SharpZipLib for over a year with no problems, but it doesn't support files zipped using compression method 6 (Imploding). This seems to be an older method of compression utilized by PKZIP. Are there other available options anyone knows of to handle these types of decompressions programatically? Thanks in advance
5
13993
by: JohnDriver | last post by:
Hi, I am having a form which has a text box and 3 radio buttons. I am using GET method in Ajax to pass the value. I can pass the value of the textbox fine but how to pass the value of radio button? I searched a few things on Google but I find the javascript below most useful in my case but there is some problem that my code is not running: var test = document.getElementsByName("meal"); for (i = 0; i < test.length; i++) {
0
1083
by: DKn | last post by:
Hi, I am doing shutdown for a remote system using this method InvokeMethod("Win32Shutdown", inParams, null); in C#.Net 2.0. Once the shutdown is done, how to get the status , whether the shutdown is completed or not, As this method InvokeMethod("Win32Shutdown", inParams, null); is asynchronous. not only for shutdown, i want the status for restart also. once the restart is completed how to know that , that is done. Plz any...
2
8923
by: Rakulkumar | last post by:
how can i print the pdf file using binarywrite method in asp.i can print the text file using Response.binarywrite method but i cnat print the pdf files
0
8621
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9041
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7757
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4634
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2013
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.