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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:31:21+00:00 2026-06-09T08:31:21+00:00

I was able to use the XML as external meta-data by following the article

  • 0

I was able to use the XML as external meta-data by following the article here. However, Moxy is marshalling the properties that are neither annotated nor specified in the external XML meta-data. Below is the e.g. How to avoid this behavior? I tried using xml-mapping-metadata-complete="true" but it didn’t help.

Class with new prefix property added (removed other properties for brevity)

public class Customer
{
    private String prefix;

    public void setPrefix(String prefix)
    {
        this.prefix = prefix;
    }

    public String getPrefix()
    {
        return prefix;
    }
}

meta-data xml

<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm" package-name="blog.bindingfile">
   <xml-schema namespace="http://www.example.com/customer" element-form-default="QUALIFIED" />
   <java-types>
      <java-type name="Customer">
         <xml-root-element />
         <xml-type prop-order="firstName lastName address phoneNumbers" />
         <java-attributes>
            <xml-element java-attribute="firstName" name="first-name" />
            <xml-element java-attribute="lastName" name="last-name" />
            <xml-element java-attribute="phoneNumbers" name="phone-number" />
         </java-attributes>
      </java-type>
      <java-type name="PhoneNumber">
         <java-attributes>
            <xml-attribute java-attribute="type" />
            <xml-value java-attribute="number" />
         </java-attributes>
      </java-type>
   </java-types>
</xml-bindings>

output

<customer xmlns="http://www.example.com/customer">
   <first-name>Jane</first-name>
   <last-name>Doe</last-name>
   <address>
      <street>123 A Street</street>
   </address>
   <phone-number type="work">555-1111</phone-number>
   <phone-number type="cell">555-2222</phone-number>
   <prefix>pre</prefix>
</customer>
  • 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-09T08:31:22+00:00Added an answer on June 9, 2026 at 8:31 am

    To omit the prefix property from your marshalled XML, you should declare it as transient in your bindings file:

      ...
      <java-type name="Customer">
         <xml-root-element />
         <xml-type prop-order="firstName lastName address phoneNumbers" />
         <java-attributes>
            <xml-element java-attribute="firstName" name="first-name" />
            <xml-element java-attribute="lastName" name="last-name" />
            <xml-element java-attribute="phoneNumbers" name="phone-number" />
            <xml-transient java-attribute="prefix" />
         </java-attributes>
      </java-type>
      ...
    

    By default, JAXB will map any public fields, so since there was no explicit “annotation” on the prefix field, it is mapped in the default way.

    xml-mapping-metadata-complete="true" means “Ignore any annotations found in the Java class and use this bindings file as the sole source of mapping information — do not augment any existing annotations.”

    Hope this helps,
    Rick

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

Sidebar

Related Questions

I have an app that needs to be able use either an sqlite3 datebase
I have an external xml file that I am loading in my views.py file
I'm planning to use XML for database purpose. Only thing I was able to
I've been testing use of XML::Simple with perl. I am able to print out
I am able to use WebGrid in any controller like: var grid = new
The init() is able to use the parameter passed to it in this example:
I was able to use the code in this answer to access a value
Is anyone able to use Scala IDE in Eclipse with syntax highlighting showing different
I want to be able to use a wildcard in string::find and then fetch
I want to be able to use mklink to create symbolic links on my

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.