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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:31:39+00:00 2026-05-30T21:31:39+00:00

I loaded some large data as xml format into a string in my program

  • 0

I loaded some large data as xml format into a string in my program (from mysql) and when I save this string into an out.xml, just about 500 record stored.
How do I save a large string or other data into a file in xml format or any other format?

Here is my Code :

    String xmlString = doExportIntoString();
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    InputSource source = new InputSource(new StringReader(xmlString));
    Document document =factory.newDocumentBuilder().parse(source);        
    TransformerFactory tf = TransformerFactory.newInstance();
    Transformer transformer = tf.newTransformer();
    Result result = new StreamResult(new File("C:\\xmlFile.xml"));
    Source s = new DOMSource(document);
    transformer.transform(s, result);
  • 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-30T21:31:40+00:00Added an answer on May 30, 2026 at 9:31 pm

    Here is a correct version of the code above:

    BufferedWriter out;
    try {
        out = new BufferedWriter(new FileWriter("out.txt"));
        out.write("aString");
    } catch (IOException e) {
        throw new RuntimeException(e);    
    } finally {
        if (out != null) {
            try { out.close(); } catch (IOException e) {}
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I had some XML such as this loaded into an XDocument object: <Root>
If a large module is loaded by some submodule of your code, is there
I have a plugin that is loaded by this application.. This plugin calls some
While looking into some webGL examples (mostly Three.js based examples) I noticed large models
I am trying to make an asynchronous request to get some data from my
I'm trying to parse large XML files (>3GB) like this: context = lxml.etree.iterparse(path) for
Preamble: I'm working at heavy-loaded applicaion that produces large data arrays. I wrote the
I have to do read an Large InputStream comming from a URL. I loaded
I loaded some content in a DIV with AJAX. Then, i loaded different content
I created a database in PostgreSQL with encoding = 'UTF8', and loaded some UTF8

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.