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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:39:04+00:00 2026-06-15T19:39:04+00:00

I am reading some XML data (FXG files if you are familiar with them).

  • 0

I am reading some XML data (FXG files if you are familiar with them).

Part of the data has varying tag names:

<varying_name1 scaleX="1.0046692" x="177.4" y="74.2"/>
<varying_name2  scaleX="1.0031128" x="171.9" y="118.9"/>    

I have created a class named Transforms to represent the data within the varying tag name segment. In my JAXB class to hold the data I have:

@XmlAnyElement(lax=true)    
@XmlJavaTypeAdapter(TransformAdapter.class)    
protected List<Transform> transforms;

In my Adapter, I attempt to unmarshal the data:

JAXBContext context = JAXBContext.newInstance(Transform.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
Transform result = (Transform) unmarshaller.unmarshal(v);

However, my code throws an exception here because the root name on my element varies. It is not a constant. I get:

unexpected element (uri:"http://ns.adobe.com/fxg/2008", local:"m6_mc"). Expected elements are (none)

How can I get it to just unmarshal my data as if the root element had the name it expected?

  • 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-15T19:39:06+00:00Added an answer on June 15, 2026 at 7:39 pm

    By default a a JAXB (JSR-222) implementation will determine the class to unmarshal based on the root element. This is matched with metadata provided via an @XmlRootElement or @XmlElementDecl annotation.

    Alternately you one of the unmarshal methods that take a class parameter. This tells JAXB what class you wish to unmarshal to. The result of the unmarshal will be an instance of JAXBElement that in addition to the Java object will contain root element info in case you need it.

    JAXBContext context = JAXBContext.newInstance(Transform.class); 
    Unmarshaller unmarshaller = context.createUnmarshaller(); 
    Transform result = unmarshaller.unmarshal(v, Transform.class).getValue();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading some data from an XML format and putting it in my classes
I'm reading data from XML files into a strong typed DataSet . The data
I am reading some data stored in Xml format in SQL Server database and
I many, many .xml files and i need to extract some co-ordinates from them.
I'm reading some XML with PHP and currently using the DOMDocument class to do
What is the difference between XML and SOAP? I've been reading some introductory articles
i've been reading through the linq to xml documentation in msdn and some other
I have some Javascript that is reading in some XML. There is an older
I'm reading some data like speed and curent location using a single ton class....I'm
I get this error when reading some data from an SQL column then converting

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.