Solved

How do I create a java map from xsd

Posted on 2008-06-10
3
1,423 Views
Last Modified: 2013-11-18
Hi experts,

I am trying to use xsd to create java class. For example I have class A as followings:

----------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.xxx.com/AAA/entities"
    targetNamespace="http://www.xxx.com/AAA/entities" elementFormDefault="qualified">

    <xs:element name="classA">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="namer" />
                <xs:element ref="value />
                <xs:element ref="myMap" type="xs:string" maxOccurs="unbounded" /> ---> line 00
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

---------------------------------------------------
 How do I modify line 00 so that I can have a hash map in my class? Thanks!


0
Comment
Question by:meow00
3 Comments
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 50 total points
ID: 21754997
Map is not supported. It it were, what would the keys and values be?
0
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 21755708
0
 
LVL 1

Assisted Solution

by:pmartin8
pmartin8 earned 50 total points
ID: 21761112
If you are looking for a quick/easy way to do it.....

Use XStream to deserialize tthe XSD, then build your own map with the object you get from XStream!

I could provide some code if you want!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now