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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:01:31+00:00 2026-05-11T09:01:31+00:00

I am using JibX as a Java Object to XML Binding tool. With it,

  • 0

I am using JibX as a Java Object to XML Binding tool.

With it, I want to have the following output:

<?xml version='1.0' encoding='UTF-8'?> <FEAPService>     <Request>         <Function>aaa</Function>         <SubFunction>bbb</SubFunction>         <Operation>ccc</Operation>     </Request> </FEAPService> 

But I’m getting this:

<?xml version='1.0' encoding='UTF-8'?> <FEAPService>     <Request>         <baseForm> <!-- I DO NOT WANT THIS baseForm TAG -->             <Function>aaa</Function>             <SubFunction>bbb</SubFunction>             <Operation>ccc</Operation>         </baseForm>     </Request> </FEAPService> 

Here’s the JibX binding file:

<binding name='requestBinding_com_struts_form_SpecificForm'>     <mapping name='baseForm' class='com.struts.form.BaseForm'>         <value name='Function' field='function' />         <value name='SubFunction' field='subFunction' />         <value name='Operation' field='operation' />     </mapping>         <mapping name='FEAPService' class='com.struts.form.SpecificForm'         extends='com.struts.form.BaseForm'>         <structure name='Request'>             <structure map-as='com.struts.form.BaseForm' />         </structure>     </mapping> </binding> 

I guess it might be achieved by implementing my own Marshaller, but I’m not sure if that’s the easiest way.

  • 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. 2026-05-11T09:01:32+00:00Added an answer on May 11, 2026 at 9:01 am

    I managed to remove the undesired XML node, there are 2 ways:

    1. the easy way: just use the abstract=’true’ attribute.
    2. the hardcore way: implement your own marshaller.

    1st option:

    <mapping class='com.struts.form.BaseForm' abstract='true'>         <value name='Function' field='function' />         <value name='SubFunction' field='subFunction' />         <value name='Operation' field='operation' />         <value name='doubleField_part1' field='doubleField' serializer='com.struts.form.BaseForm.doubleFieldDeserializer1' />         <value name='doubleField_part2' field='doubleField' serializer='com.struts.form.BaseForm.doubleFieldDeserializer2' />     </mapping> 

    2nd option: implement your own Marshaller:

    public class MyMarshaller implements IMarshaller {     private static final String FUNCTION_ELEMENT_NAME = 'Function';     private static final String SUB_FUNCTION_ELEMENT_NAME = 'SubFunction';     private static final String OPERATION_ELEMENT_NAME = 'Operation';      private String m_uri;     private int m_index;     private String m_name;      public MyMarshaller() {         m_uri = null;         m_index = 0;          m_name = 'Function';     }      public MyMarshaller(String uri, int index, String name) {         m_uri = uri;         m_index = index;         m_name = name;     }      public boolean isExtension(int index) {         return false;     }      public void marshal(Object obj, IMarshallingContext ictx)             throws JiBXException {          // make sure the parameters are as expected         if (!(obj instanceof BaseForm)) {             throw new JiBXException('Invalid object type for marshaller');         } else if (!(ictx instanceof MarshallingContext)) {             throw new JiBXException('Invalid object type for marshaller');         } else {             // start by generating start tag for container             MarshallingContext ctx = (MarshallingContext) ictx;             BaseForm formBean = (BaseForm) obj;              /*              * THIS CODE COULD BE REPEATED FOR ALL FormBean CLASS' ATTRIBUTE USING REFLECTION.              * And to control which attributes should be marshalled the attributes could follow special nomeclatures.              * Ex.              * class FormBean {               *    String marshallable_Function;              *    String non_marshallable_Function;              * }              */              writeTag(ctx, formBean.getFunction(), FUNCTION_ELEMENT_NAME);             writeTag(ctx, formBean.getSubFunction(), SUB_FUNCTION_ELEMENT_NAME);             writeTag(ctx, formBean.getOperation(), OPERATION_ELEMENT_NAME);         }     }      private void writeTag(MarshallingContext ctx, String value, String entryElementName)             throws JiBXException {         ctx.startTag(m_index, entryElementName);         ctx.closeStartContent();         ctx.content(value);         ctx.endTag(m_index, entryElementName);     } } 

    And here is my binding.xml:

    <binding name='requestBinding_com_struts_form_SpecificForm'>     <mapping class='com.struts.form.BaseForm' marshaller='example8.MyMarshaller' />             <mapping name='FEAPService' class='com.struts.form.SpecificForm'>         <structure name='Request'>             <structure map-as='com.struts.form.BaseForm' />         </structure>     </mapping> </binding> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 211k
  • Answers 211k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The severity in sys.messages is not the actual severity they… May 12, 2026 at 10:10 pm
  • Editorial Team
    Editorial Team added an answer I saw this posted elsewhere, but it is exactly what… May 12, 2026 at 10:10 pm
  • Editorial Team
    Editorial Team added an answer Try this rule: RewriteEngine on RewriteRule ^topic/(([0-9]{2})[0-9]*)$ static/$2/$1.html May 12, 2026 at 10:10 pm

Related Questions

I have a XML schema that I will need to create Java classes for.
I am using SQL Server 2005. I have a table with a text column
I am using LINQ to query a generic dictionary and then use the result
I am using Hibernate in a Java application to access my Database and it

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.