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 4236086
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:35:26+00:00 2026-05-21T02:35:26+00:00

Editing to specify more clearly the scenario. I have to write a xml file,

  • 0

Editing to specify more clearly the scenario.

I have to write a xml file, the info comes from several beans (not even whole bean, jsut subset of some of them), some of the beans contain lists etc. So I cannot just give xstream one root bean and let it write the xml. Also some formatting might need to fulfill some conditions, but the previous issue is the one

Right now I am using JDOM to create the doc in memory, and eventually I use a XMLOutputter to write the doc to a file.

But the beans I want to write can have very large lists of other beans etc, and the memory used can be quite high.

So I suspect there should be a better way in terms of memory?
I already create the xml for some beans inside the larger bean with xstream and append them as Elements to the JDOM.

I was hoping the same way its more memory efficient to parse xml using a pull parser, the same could be apply to writing xml.

  • 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-21T02:35:26+00:00Added an answer on May 21, 2026 at 2:35 am

    Let me get this straight:
    You start off with a tree of beans. You wish to use these to construct an XML document following their structure but with its own syntax/schema so simple bean XML serialization is out of the question…

    If that is so, JAXB as recommended by Blaise Doughan is a good suggestion. If, however, you require a much finer control over the XML formatting, you need to do some highly specific serialization, or perhaps you wish to remove some bean references while creating the XML to allow garbage collection during the execution, then the Streaming API for XML (StAX) might be what you need. You can write XML constructs to a stream with it.

    http://download.oracle.com/javase/6/docs/api/javax/xml/stream/package-summary.html

    Sorry if it isn’t exactly what you meant. If I’m getting it wrong, could you give us a small usage scenario?

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

Sidebar

Related Questions

I have one scenario in which I want to apply both form editing and
Did anyone know how to write Check makefile.am if we have more than *.c
I'm editing an HTML file in NetBeans 7.0. Is there a way to specify
Editing a RichTextBox control's text (more specifically, modifying selection font/color) programmatically seems to be
When editing Silverlight XAML in Visual Studio 2008, the Document Outline panel is not
I am currently editing a file, and I'm using irb to test the api:
I have the following code. Uri outputFileUri = Uri.fromFile( new File(path +/image01.jpg) ); camera_intent
I have a grayscale icon that I'm editing with Photoshop with a transparent background,
I have an ASP.NET MVC view for editing a model object. The edit page
I have a web application that's based on Spring and the application contexts, applicationContext.xml

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.