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 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

Let me first put the code snippets here. I am just using the ASP.NET
Let's me show first the scenario that is working: I have a HandlerAttribute that
Let's first start with a code snippet to explain the issue: = Haml::Engine.new('#bar= yield').render
I am having difficulties implementing a custom ASP.NET RoleProvider. First off, let me show
I have a list of elemnts (let's say 10) and I only show first
First let me show some code. class User has_and_belongs_to_many :roles named_scope :employees, { :conditions
First let me start off by saying I read on here a lot and
Let me first describe my goal: I have created an object with 3 properties:
First let me say I have read this useful article thoroughly and am using
First let me state that, despite being a fairly new practitioner of TDD, I'm

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.