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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:28:18+00:00 2026-06-17T04:28:18+00:00

I have an issue with the marshalling on my JAXB and don’t quite understand

  • 0

I have an issue with the marshalling on my JAXB and don’t quite understand why.
When I marshall out the data and add it to the xml file, all is correct except it imports the XML coding at the top.

Example of before:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FlightDetails xmlns="http://xml.netbeans.org/schema/Shows">
    <FlightDetailsCollection>
        <DestinationCity>France</DestinationCity>
        <ExtraInfo>Free Wifi</ExtraInfo>
        <Date>2009-03-09</Date>
        <Fare>
            <CurrencyName>GBP</CurrencyName>
            <CurrencyFare>60.0</CurrencyFare>
        </Fare>
    </FlightDetailsCollection>
</FlightDetails>

Then when I add the marshalled data it appears as so:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FlightDetails xmlns="http://xml.netbeans.org/schema/Shows">
    <FlightDetailsCollection>
        <OriginCity>London</OriginCity>
        <DestinationCity>France</DestinationCity>
        <AirlineBrand>Ryan Air</AirlineBrand>
        <ExtraInfo>Free Wifi</ExtraInfo>
        <Date>2009-03-09</Date>
        <Fare>
            <CurrencyName>GBP</CurrencyName>
            <CurrencyFare>60.0</CurrencyFare>
        </Fare>
    </FlightDetailsCollection>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FlightDetails xmlns="http://xml.netbeans.org/schema/Shows">
    <FlightDetailsCollection>
        <OriginCity>Germany</OriginCity>
        <DestinationCity>France</DestinationCity>
        <AirlineBrand>Virgin Air</AirlineBrand>
        <Date>2009-03-09</Date>
        <Fare>
            <CurrencyName>GBP</CurrencyName>
            <CurrencyFare>200.0</CurrencyFare>
        </Fare>
    </FlightDetailsCollection>
</FlightDetails>

As you can see it’s added the following before putting it into the XML file.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<FlightDetails xmlns="http://xml.netbeans.org/schema/Shows">

How would I be able to stop it from including the encoding and schema name? In debug it seems to be only containing the needed information so I cant trace it. I presume it was JAXB adding it in, however could be wrong.

Many thanks,

  • 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-17T04:28:19+00:00Added an answer on June 17, 2026 at 4:28 am

    You can do the following to omit the XML declaration:

    Marshaller marshaller = jc.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
    

    I would create a StAX XMLStreamWriter to wrap your output and keep marshalling to that which will help manage your namespace declarations and add a root element.

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

Sidebar

Related Questions

I have an issue while getting the file name with out extension from a
Have an issue with marshall and unmarshall readers and writers. So here it is.
I have an issue. I am getting data from a MySQL database, and make
I have issue with Spring 's OpenSessionInViewFilter . My web.xml config looks like that:
I have issue about convert XML to Java Object , in here i use
I have issue to disable/enable validators for newly add row to gridview which is
Seems like everyone have issue accessing local machine or internet etc from emulator. All
I have an issue using JaxB in Netbeans 7.1.2. I have auto-generated my classes
I have issue with letters when posting data to server NSString *url = [NSString
I was trying to add the XML schema to an existing EJB project. JAXB

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.