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

  • Home
  • SEARCH
  • 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 6015993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:55:10+00:00 2026-05-23T02:55:10+00:00

Let me first show you the xml structure: <config> <engine> <eid>1</eid> <somechild>text</somechild> <somemodechild> <subchild>subchbild</subchild>

  • 0

Let me first show you the xml structure:

<config>

   <engine>
     <eid>1</eid>
     <somechild>text</somechild>
     <somemodechild>
       <subchild>subchbild</subchild>
     <somemorechild>
   </engine>
     <eid>1</eid>
     <somechild>text</somechild>
     <somemodechild>
       <subchild>subchbild</subchild>
     <somemorechild>
   </engine>
   <engine>
     <eid>1</eid>
     <somechild>text</somechild>
     <somemodechild>
       <subchild>subchbild</subchild>
     <somemorechild>
   </engine>
   </engine>
     <eid>1</eid>
     <somechild>text</somechild>
     <somemodechild>
       <subchild>subchbild</subchild>
     <somemorechild>
   </engine>
   <engine>
     <eid>1</eid>
     <somechild>text</somechild>
     <somemodechild>
       <subchild>subchbild</subchild>
     <somemorechild>
   </engine>

</config>

Here <config> is the root element. I have to create a GUI to edit xml element. I have done it, using JSP and have a made a GUI for each <engine> in the same page, go the each user can edit a particular <engine> and then save the <config> elements, and to save the changes to that particular <engine> tag i am using eid to segregate the particular <engine>.

Now, I want to rewrite the particular <engine> being edited in a separate xml file. How can I achieve it using jdom?

  • 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-23T02:55:11+00:00Added an answer on May 23, 2026 at 2:55 am

    Not sure if I correctly understand your requirements:
    You have a xml file (file A) above as posted above and another xml file (file B) containing only one engine-node.

    If you have a unique ID (eid?) in file A parse it into your DOM and then replace the node where the eid matches the eid in file B.

    To find the engine in file A that matches the eid in file B, you could use XPath.

    Node aEID = xp.evaluate("/config/engine[eid='3']"); 
    Node bEID = docB.getRoot();
    

    then you would remove aEID from your first DOM

    docA.remove(aEID);
    

    and add bEID

    docA.getRoot().add(bEID);
    

    (the code above is not meant to compile)

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

Sidebar

Related Questions

I am having difficulties implementing a custom ASP.NET RoleProvider. First off, let me show
First let me show some code. class User has_and_belongs_to_many :roles named_scope :employees, { :conditions
First let me say that I really feel directionless on this question. I am
Let me state first: I know that any user that wants to run a
Let's say the first N integers divisible by 3 starting with 9. I'm sure
Let's say I have 3 point clouds: first that has 3 points {x1,y1,z1}, {x2,y2,z2},
Alright let me explain my situation first: I am part of an organization that
First, let's get the security considerations out of the way. I'm using simple authentication
First off, let me start off that I am not a .net developer. The
First of all, let's define a few tables: Users table will store information about

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.