Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3497322
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:21:23+00:00 2026-05-18T12:21:23+00:00

What is the best performance solution for XML generation. My goal is to build

  • 0

What is the best performance solution for XML generation.

My goal is to build a few simple XMLs from code. I am going to implement simple custom StringBuffer based implementation of XML Builder. From other side there are several libraries like http://code.google.com/p/java-xmlbuilder/ and http://code.google.com/p/xmltool/ which has nice DSL but I guess lack on performance.

Since my goal is build simple enough XMLBuilder with great performance I think I will build custom solution. It will featuring:

  • Nice Java-based DSL for XML constructs (adding tags basically)
  • Great StringBuffer based performance.
  • String data escape handling when adding XML tags.
  • Auto-indent

Please suggest if I am wrong on performance expectations and its probably better to use ready-made libraries.

UPDATE. Why I think the performance of standard xml builders is not very good.

Standard XML builders uses Document Builder Factory and works with classes behind the scenes. Also these classes optimized to fit all users. For example I don’t need namespace support etc.

<?xml version="1.0" encoding="utf-8">
<root>
 <testdata>value</testdata>
</root>
</xml>

Consider very simple XML code above. If you build with standard tools it will involve so many work just to make this simple XML. I consider that it’s better to just generate it by myself using String.

UPDATE 2. Performance requirement is that code should do as many things as required to generate simple XML and not more.

UPDATE 3. Thanks everyone for great comments! Now I understand better what I need and that my initial goal was not set very correctly with word “performance”. My true goal is to use simple enough solution with convenient DSL to describe the XML structure and generate the XML output.

I will use plain Java objects as DSL for XML and generate XML using XStream library which is pretty straightforward solution.

UPDATE 4. JAXB. I discussed XStream vs JAXB and found that JAXB is faster than XStream. Plus I already use JAXB in my project and I like its standard annotations. I change my mind and will go with JAXB for now because XStream was originally heavily developed at the time when JAXB was not so good as today.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T12:21:24+00:00Added an answer on May 18, 2026 at 12:21 pm

    I will suggest something very controversial but still …

    Make profiling and performance tests with both libraries.

    If you don’t have time for that, assuming something is slow would be the wrong choice in my opinion.
    Because if it turns out that it actually is not slow, it would save you a lot of time to use an already built and supported library/framework.

    Another thought.
    You will need to test your completed high performance solution against the solutions already available anyway, to check if it is really high performance. So I would strongly suggest measuring the performance of the libraries available before starting your own.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In your opinion and from a performance point of view, what is the best
For best performance, is it better to use a virtual IDE HDD or virtual
Which of the following has the best performance? I have seen method two implemented
I'm trying to find out the most efficient (best performance) way to check date
I know that primary keys based on Guids do not have the best performance
http://msdn.microsoft.com/en-us/library/system.object.gethashcode(VS.80).aspx says: For the best performance, a hash function must generate a random distribution
What is the best (regarding performance) way to compute the critical path of a
What is the best way (performance wise) to paginate results in SQL Server 2000,
Which MVC-framework is the best option (performance/ease of development) for a web application, that
When requesting hardware for a WebLogic server, what hardware would best improve its performance?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.