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

  • Home
  • SEARCH
  • 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 6203441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:55:05+00:00 2026-05-24T04:55:05+00:00

I have 10 schemas under different namespaces, each with a complexType and associated element

  • 0

I have 10 schemas under different namespaces, each with a complexType and associated element that is a substitution for an element called ‘Report’, for example:

<xsd:element name="MyReport" type="foo:MyReportType" substitutionGroup="bar:Report"/>

<xsd:element name="Report" abstract="true"/>

When I unmarshal an XML document that has all 10 reports in it, only 5 are found when I do the following:

JAXBContext context = JAXBContext.newInstance("com.foo.bar");
Unmarshaller unmarshaller = context.createUnmarshaller();
//get root node of xml
JAXBElement<ReportPackage> package = unmarshaller.unmarshal(new StreamSource(new File("example.xml")));
ReportPackage rp = package.getValue();
ReportSection reports = rp.getReports();
List<JAXBElement<?>> reportList = reports.getReport();
//iterate through the 10 reports
for (int i = 0; i < reportList.size(); i++) {
    JAXBElement rep = reportList.get(i);
    ...
}

It does not matter the order of the reports or number of reports within the xml. The same 5 of the 10 types of reports are consistently found. I’ve used the reference implementation 2.24u1 and 2.1.10 (JDK 6 version) of JAXB, both to no avail. It appears that the substitutionGroup is ignored. Any help would be much appreciated!

  • 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-24T04:55:06+00:00Added an answer on May 24, 2026 at 4:55 am

    Try to create JAXB context this way: JAXBContext.newInstance("package1:package2:package3:...") where packageXs are packages where your ObjectFactories are.

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

Sidebar

Related Questions

I have two XML files with two different XSD schemas and different namespaces. They
We have 18 databases that should have identical schemas, but don't. In certain scenarios,
I have a large ADO.Net dataset and two database schemas (Oracle) with different constraints.
Have a look at this very simple example WPF program: <Window x:Class=WpfApplication1.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
In Silverlight/XAML you have namespaces such as: xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml and so elements have namespaced attributes
I have an XML schema that includes multiple addresses: <xs:element name=personal_address maxOccurs=1> <!-- address
I have a data warehouse containing typical star schemas, and a whole bunch of
I have a really simple WPF UserControl: <UserControl x:Class=dr.SitecoreCompare.WPF.ConnectionEntry xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml x:Name=connEntry BorderBrush=Navy BorderThickness=1
I have a XML schema that I will need to create Java classes for.
I have an XML schema that represents a product in a DB, and I

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.