473,395 Members | 1,466 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Formatting XMLOutputter problem

2
Hey guys,

I'm currently trying to use xml as a simple storage system. I'm trying to store users that have their username, id, password, etc as their attributes, but I'm trying to format it such that I'd get something that looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<Account>
<Users>
<Mike
name="Mike"
id="1"
marginAccount="100"
/>
<Phil
name="Phil"
id="2"
marginAccount="200"
/>
<Sean
name="Sean"
id="3"
marginAccount="300"
/>
<Cory
name="Cory"
id="4"
marginAccount="400"
/>
<Gary
name="Gary"
id="5"
marginAccount="500"
/>
</Users>
</Account>

How can I set it so that, like in the example shown above, there would be \n and indent before each attribute?

I've taken a look at the Format api, tried messing around with setIndent, setLineSeperator, but to no avail.

Any help would be appreciated.

Thank you, and best regards,
VWind
Nov 11 '07 #1
2 1433
jkmyoung
2,057 Expert 2GB
This is not a standard request. You would pretty much have to overwrite whatever element output method you're using, writing it yourself.

Pseudocode might be as follows:
Expand|Select|Wrap|Line Numbers
  1. if element has no attributes, 
  2.   use standard output method.
  3. else 
  4.   output start tag, 
  5.   foreach attribute child
  6.     add indent 
  7.     output attribute
  8.     add newline
  9.   end foreach
  10.   output rest of element's content
  11. end if
Nov 13 '07 #2
vwind
2
I guess in that case, it's not really worth it.

Thanks,
VWind
Nov 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bernd Oninger | last post by:
When I compile my java source with jdom b10 the compiler tells me that the instrcution XMLOutputter outputter = new XMLOutputter(" ", true); Outputter.output(doc, new FileWriter("t.xml")); is...
3
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
4
by: DBQueen | last post by:
I have a subform which is in Continuous Forms view. I have added a button to the bottom of the page to move to the next record using the button wizard (result: DoCmd.GoToRecord , , acNext). I...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
2
by: Sara | last post by:
The problem: Conditional formatting bold, red when field Value < date() sets the field background to white - always - whether condition is met or not. I want the field unfilled and just red/bold...
10
by: Coleen | last post by:
Hi all :-) I have a weird formatting problem with an HTML table that I am populating using VB.Net and HTML. Here is the snippet of code for the cell I'm trying to format: Dim...
5
by: mic123 | last post by:
I am creating an xml document using XMLOutputter in JAVA, then displaying the xml file in Firefox browser. My problem is that I want to simply display the XML as idented text, but the browser...
8
by: gopal | last post by:
Hi I am trying to write to log file but the formatting of string is not properly aligned in log file result The results looks some thing like this OK move.xml Successful OK ...
14
by: Scott M. | last post by:
Ok, this is driving me nuts... I am using VS.NET 2003 and trying to take an item out of a row in a loosely-typed dataset and place it in a label as a currency. As it is now, I am getting my...
6
by: Tomasz J | last post by:
Hello developers, I bind my TextBox control specyfying a format stored in my application global ApplicationContext object - it has a static string CurrencyFormat property. The problem - this...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.