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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:59:07+00:00 2026-05-25T05:59:07+00:00

I want to have something below to save in the xml file Question0 :

  • 0

I want to have something below to save in the xml file

Question0 : What is ur name?
 Answer0: Tina
   Question0.0 : What are your hobbies?
           Answer0.0.0 : reading 
               Question0.0.0.0 :What do you like in reading.?
                      Answer0.. : .....
           Answer0.0.1 : Dancing
               Question0.0.0.1 :which dance do you like?

 Answer1:Roger 
   ...........same question answer as above.

There can be nested question below an answer but below a question there can only be answers.

What will be the proper way to write into xml suing java. I can’t think of a way….? Step by step solution to me will be great as I am new to java.

  • 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-25T05:59:08+00:00Added an answer on May 25, 2026 at 5:59 am

    The easiest way is probably to use JAXB.

    It consists in writing JavaBeans holding the information (in your case, a Question and an Answer class, with the Question class holding a list of answers, and the answer class holding a (sub-)question).

    Then, you ave to annotate the classes to tell JAXB how to map the JavaBean properties to XML attributes or elements.

    And then you have to get a Marshaller which will transform your JavaBean tree into an XML document.

    The following page has a short tutorial over these steps. Googling for JAXB will lead you to a more exhaustive documentation: http://www.vogella.de/articles/JAXB/article.html#jaxb

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

Sidebar

Related Questions

I have the table like something like below, I use this to save the
I want to have something like this below: template <class T> struct Container{ public:
I have something like ali123hgj. i want to have 123 in integer. how can
I want to parse a html content that have something like this: <div id=sometext>Lorem<br>
I want to have a route that looks something like: www.abc.com/companyName/Controller/Action/Id However, all the
I want to have a template class that looks something like what I have
I want to have on my page something like This page last refreshed on:
I want to have 3 divs aligned inside a container div, something like this:
I want to paste something I have cut from my desktop into a file
I have to make something like an accordion, but I want it to fade

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.