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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:44:46+00:00 2026-05-26T23:44:46+00:00

I have 2 questions on how how to parse a specific aspect of this

  • 0

I have 2 questions on how how to parse a specific aspect of this XML in JAXB with annotations.

Assuming I have a FosterHome class defined…

1) For the “Children” tag, is there a way to contain the properties within a “Children” class without having to create a separate “Info” class?

2) Since the perperties of the “Info” tag are related to “ChildList” also, should I be having two Child classes one without Info and one with Info? Or is there a better way?

Im trying to find the best way to parse this. Please refer to this posting for current set of classes: How do I parse this XML in Java with JAXB?

<FosterHome>
<Orphanage>Happy Days Daycare</Orphanage>
<Location>Apple Street</Location>
<Families>
    <Family>
        <ParentID>Adams</ParentID>
        <ChildList>
            <ChildID>Child1</ChildID>
            <ChildID>Child2</ChildID>
        </ChildList>
    </Family>
    <Family>
        <ParentID>Adams</ParentID>
        <ChildList>
            <ChildID>Child3</ChildID>
            <ChildID>Child4</ChildID>
        </ChildList>
    </Family>
</Families>
<Children>
    <ChildID>Child1</ChildID>
    <Info>
       <Age>6</Age>
       <FavColor>Blue</FavColor>
    </Info>
    <ChildID>Child2</ChildID>
    <Info>
       <Age>8</Age>
       <FavColor>Red</FavColor>
    </Info>
    ...
</Children>
</FosterHome>
  • 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-26T23:44:46+00:00Added an answer on May 26, 2026 at 11:44 pm

    To answer #1, you might want to use MOXy. With that, you can use @XPath to get the age and favColor. In fact, @Blaise Doughan is the person you might want to talk to (he answered your previous post) because he’s the team lead for that MOXy project…. pretty active in this forum too. Here’s an example of the usage similar to yours: With MOXy and XPath, is it possible to unmarshal a list of attributes?

    As for #2, your XML structure looks weird. If you are allowed to change the XML, I would add the the child age and favorite color together with the child name, something like this:-

    ...
    <Family>
        <ParentID>Adams</ParentID>
        <ChildList>
            <ChildID name="Child1" age="6" favColor="Blue"/>
            <ChildID name="Child2" age="8" favColor="Red"/>
        </ChildList>
    </Family>
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a specific format XML document that I will get pushed. This document
In order to stop this being subjective, I have a couple of specific questions
I have a question in parsing XML. How can I parse out the value
I have questions about System.Threading.ThreadStart Class : where can I find its specifications (
I've looked but didn't find previous questions specific enough, so sorry if this is
I have a question web application which allows users to ask questions on specific
I didn't find much in tutorials on this specific question.. So I have a
I am trying to use jQuery to parse an in-memory XML document. This works
New to Python, have a simple, situational question: Trying to use BeautifulSoup to parse
I am going to be making a small user system but I have questions.

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.