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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:37:08+00:00 2026-06-12T16:37:08+00:00

I’m using XJC to generate Java classes from the HTNG Payment Systems schemas, available

  • 0

I’m using XJC to generate Java classes from the HTNG Payment Systems schemas, available in the /schemas directory of this zip.

If I run XJC without passing the -p parameter, generation works fine, and classes are generated under the org.htng._2009b package:

$ cd schemas
$ xjc -mark-generated -no-header -target 2.1 -npa .

All I want to do is change the package name of the generated classes to something more project appropriate, e.g. com.justin.htng:

$ cd schemas
$ xjc -mark-generated -no-header -target 2.1 -npa -p com.justin.htng .

However, doing this breaks JAXB generation spectacularly, throwing collision errors on almost every element. I can work around this by generating the classes via the first method, and then refactoring them to the com.justin.htng package, but that’s not very maintainable and doesn’t port well to the maven-jaxb2-plugin.

Can someone explain why this is happening, and if there is a way to work around it with XJC? I feel like if JAXB works via the first method, it should work via the second, since all that needs to be done is a simple String substitution for the package name. I suppose I could use the second method and handle all of the collisions via an .xjb bindings file, but that would be tedious given the number of errors.

  • 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-12T16:37:09+00:00Added an answer on June 12, 2026 at 4:37 pm

    When I run

    xjc -mark-generated -no-header -target 2.1 -npa .
    

    I get two sets of generated classes, one in the package named generated and the other in org.htng._2009b. The HTNG_CommonTypes.xsd schema doesn’t have a targetNamespace, so when it is compiled directly its types will end up in the generated package. But HTNG_CommonTypes is also imported by the other schemas, which do declare a targetNamespace. When the common types are compiled in the imported case, they end up in org.htng._2009b.

    Now if you specify the -p option to xjc, that overrides the namespace-to-package mapping for all namespaces, so both the namespaced and non-namespaced types get mapped to the same package, hence the name clashes.

    I suspect the correct solution here is simply not to compile the CommonTypes schema independently, but only to compile the ones that import it. The following works for me:

    xjc -mark-generated -no-header -target 2.1 -npa -p com.justin.htng HTNG_P*.xsd
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
this is what i have right now Drawing an RSS feed into the php,

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.