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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:45:47+00:00 2026-05-23T22:45:47+00:00

Just as an example, lets say I have a customerX.xml file that I’ve unmarshalled

  • 0

Just as an example, lets say I have a customerX.xml file that I’ve unmarshalled using JAXB (or XStream) already.

I update phone number of this customer in my Java object and then marshal the content back to the same customerX.xml

Here’s
an old jaxb example of xml update, from 2003..There might be a better way though.

Questions

Will marshaling write all contents of the file, though I’m just updating a single element? If yes, then is there a better way to marshal and update a specific element of an XML file using JAXB or XStream?

How do I make a marshalling operation thread safe, in case multiple threads might marshal to the same XML file?

  • 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-23T22:45:47+00:00Added an answer on May 23, 2026 at 10:45 pm

    Will marshaling write all contents of the file, though I’m just updating a single element?

    Yes. The marshaller doesn’t know or care how much you changed, all it cares about is the state of the objects at the time of marshalling.

    is there a better way to marshal and update a specific element of an XML file using JAXB or XStream?

    Not really. If you need to update fragments of the data, then the data really should be stored as separate files, rather than as one big file.

    How do I make a marshalling operation thread safe, in case multiple threads might marshal to the same XML file?

    Using regular java thread synchronization techniques (i.e. using synchronized methods, or using the locking facilities in java.util.concurrent).

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

Sidebar

Related Questions

Let's just say I have an XML file that looks like this: <?xml version=1.0
Lets say I have the following jQuery plugin (this is just an example to
Lets say I have the following xml (a quick example) <rows> <row> <name>one</name> </row>
Lets say I have this class (just as an example): internal class Packet {
Usually I was doing something like that (just a example): using (Stream xmlStream =
For example, I want just the filename of a file in a field. Say
For example, lets say I have an entity called user and an entity called
The background... Lets say I have a class called cars. We are just going
Lets say I have a WCF service that a client can use to receive
Just a very general question, that not only applies to this example. Let's say

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.