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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:45:12+00:00 2026-05-14T01:45:12+00:00

I have created an XML schema (foo.xsd) and used xjc to create my binding

  • 0

I have created an XML schema (foo.xsd) and used xjc to create my binding classes for JAXB. Let’s say the root element is collection and I am writing N document objects, which are complex types.

Because I plan to write out large XML files, I am using Stax to write out the collection root element, and JAXB to marshal document subtrees using Marshaller.marshal(JAXBElement, XMLEventWriter). This is the approach recommended by jaxb’s unofficial user’s guide.

My question is, how can I validate the XML while it’s being marshalled? If I bind a schema to the JAXB marshaller (using Marshaller.setSchema()), I get validation errors because I am only marshalling a subtree (it’s complaining that it’s not seeing the collection root element”). I suppose what I really want to do is bind a schema to the Stax XMLEventWriter or something like that.

Any comments on this overall approach would be helpful. Basically I want to be able to use JAXB to marshal and unmarshal large XML documents without running out of memory, so if there’s a better way to do this let me know.

  • 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-14T01:45:12+00:00Added an answer on May 14, 2026 at 1:45 am

    Some Stax implementations seem to be able to validate output. See the following answer to a similar question:

    Using Stax2 with Woodstox

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

Sidebar

Related Questions

I have a BizTalk schema that looks something like this: <Root> <Header> <SomeData></SomeData> <Detail>
I have created a feature, a publishing site, in Visual Studio to MOSS -
I have the following: Schema create_table mouldings, :force => true do |t| t.string suppliers_code
I have an xml in which one of the elements has an attribute that
I'm having a hard time figuring out the correct schema (to validate the structure
I use Spring Security 3.0.3.RELEASE. I would like to create a custom authentication processing
could not find anything on this, wondering if anyone knew about this or a
I've got some DataTables with an ID column with AutoIncrement enabled both on the
High bounty for the following Q: Hello, Here is what I tried on Ubuntu
For a project I am working on, I am trying to do the following

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.