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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:07:34+00:00 2026-06-05T08:07:34+00:00

i get xml content like this: <data> <randomtagname> <name>….</name> <description>…..</description> <description>…..</description> </randomtagname> <anotherrandomtagname> <name>….</name>

  • 0

i get xml content like this:

<data>
   <randomtagname>
      <name>....</name>
      <description>.....</description>
      <description>.....</description>
   </randomtagname>
   <anotherrandomtagname>
      <name>....</name>
      <description>.....</description>
   </anotherrandomtagname>
   <thirdridiculousrandomtagname>
      <name>....</name>
      <description>.....</description>
      <description>.....</description>
   </thirdridiculousrandomtagname>
       .
       .
       .
</data>

is it possibe to create an annotated java class and use jaxb to un-/marshall this file without using @XmlAnyElement??

  • 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-06-05T08:07:35+00:00Added an answer on June 5, 2026 at 8:07 am

    It looks like a list of Objects to me. Make a java class that has a

     List<Object> data

    variable. You should not need the annotation for that.

    Basically you want your xml interface to be generic enough to accept a list of different objects which may have different fields. Once this interface accepts a list of java objects, its up to your java code to determine what they are and cast them to correct class type. Use instanceOf for that part. Some of this is described in java generics where you can pass in any Object, but you have to determine what it is to cast it. I think as long as its sent over in its real class form, instanceof will work. You wouldnt send over a list of Objects, you would send a list of things like String, Integer, or custom classes like Myclass1, Myclass2. Then once you read that list use instanceof to determine the object type of each object in the list, is it instance of String, Myclass1, Myclass2, etc… And cast appropriately.

    Reading your question closer I may be missing what you really need to know. Maybe this link hasbsomething that would help. jaxb help

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

Sidebar

Related Questions

I'm working with XML data from an application where we get XML like this:
Let's say I have xml structure like this <root> <element>some content</element> <element>some content 2</element>
I've XML data in an other SWF file. I get the data through this:
I have written simple code to get content from xml file to php. $xml
I am loading an XML file using jQuery $.get. after loading the content, i
I'm just wondering when using CDATA in XML if i get the text content
I get an XML string from a certain source. I create a DOMDocument object
I am using XmlReader.Create to retrieve data from an RSS xml file. Then I
I am trying to write XML data using Stax where the content itself is
I have this data coming from a XML: var searched = from c in

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.