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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:51:19+00:00 2026-05-26T13:51:19+00:00

I have a set of xsd files for different data types. In the Java

  • 0

I have a set of xsd files for different data types. In the Java world, what is the best way to generate a list of the properties of the types?

e.g. with these two files.

file: customer.xsd

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="customer">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="number" type="xs:integer"/>
      <xs:element name="name" type="xs:string"/>
      <xs:element name="address" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
</xs:schema>

file: order.xsd

<?xml version="1.0" encoding="ISO-8859-1" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="customer">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="orderid" type="xs:integer"/>
      <xs:element name="customer" type="xs:string"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
</xs:schema>

I’d like to do two things

1. a Java application which reads in the XSD and processes then (somehow?). So when you run the program it can print the properties out

> java -jar printtypes.jar -f customer.xsd
> number : Integer
> name : String
> address : String

2. some kind of transformation which generates a new file

file: customer.properties

<propertylist>
<prop>
 <name> orderid </name>
 <type> integer </type>
</prop>
<prop>
 <name> customer </name>
 <type> string</type>
</prop>
</propertylist>

I tried to implement the program in (1) above using java reflection to interrogate Java classes generated by JAXB.
This created an instance of the class and interrogated the values and fields, but it does not work where values are composed of a sequence that is empty. There is no way to get back to the original type of the value due to type erasure. You end up with an empty ArrayList of something, but you don’t know what.

I’m from the C++ work so I’m a bit lost with all this Java technology at the moment. My Google powers have failed me – most of the JAVA/XSD posts I’ve seen talk about validation which is not what I want to do.

  • 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-26T13:51:20+00:00Added an answer on May 26, 2026 at 1:51 pm

    You might want to look into XSOM, its a project that will ingest your XML schema and produce objects that you can traverse and produce your desired results.

    http://xsom.java.net/userguide.html

    Parsing schema by hand can be really tricky because there can be different ways to say basically the same thing.

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

Sidebar

Related Questions

I have a set of xsd files and I need to generate java classes
When generating java beans from xsd files I would like to have the default
I have a XSD file, from which I want to generate C# and Java
I have a set of XSD files each having the following structure: message_i.xsd <xs:complexType
I have set the eclipse java formatter to wrap lines that exceed 120 characters
I have set a background on the data-role=page element like so <div data-role=page style=background:
I have set of flat files (114 files) each file is named with database
I have set onItemClicklistener on my custom list view but onItemClicklistener not working I
Suppose we have some .xml files containing, amongst other things, MIDI note data. Since
I have a set of classes which hold only data (no operations have been

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.