473,395 Members | 1,915 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Castor is not marshalling/unmarshalling a Enumeration for me

PPA
Hi Guys

I am really new to XML/XSD and Castor. Could you please help me out
here?

I have following XSD:
-----------------------------XSD
STARTS-----------------------------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:simpleType name="valueType">
<xs:restriction base="xs:string">
<xs:enumeration value="string"/>
<xs:enumeration value="boolean"/>
</xs:restriction>
</xs:simpleType>

<xs:complexType name="param">
<xs:attribute name="name" use="required" type="xs:string"></
xs:attribute>
<xs:attribute name="value" use="required" type="xs:string"></
xs:attribute>
<xs:attribute name="type" use="required" type="valueType"></
xs:attribute>
</xs:complexType>
</xs:schema>
------------------------------XSD
ENDS----------------------------------
I have generated the Java class against this xsd and the class Param
has following attributes

private java.lang.String _name;

private java.lang.String _value;

private com.test.types.ValueType _type;

Now, just to test I created the the java object Param, populate it
with name, value and type and then MARSHALL'ed it. The generated XML
does not have <typetag at all.

Similarly if I create an XML with all three tags, and then unmarshall
it, for Param object, type is coming out to be NULL.

What is that I am missing? Please help.

Regards,
-PPA

Feb 13 '07 #1
1 2315
<xs:attribute name="type" use="required" type="valueType"></
....
Now, just to test I created the the java object Param, populate it
with name, value and type and then MARSHALL'ed it. The generated XML
does not have <typetag at all.
As others keep saying: Don't think in terms of tags; it just messes you
up. Think in terms of elements and attributes. This avoids the confusion
you've just displayed over what "tag" means.

According to your schema, type is defined as an attribute of the param
element. So what you should be seeing is

<param name="something" value="something else" type="whatever"/>

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
Feb 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Christophe Geraud | last post by:
I got the following exception with Castor: "The prefix 'xml' is reserved (XML 1.0 Specification) and cannot be declared." I got this exception using or not a mapping file. Can anyone tell what it...
0
by: Ulf Heyder | last post by:
I use castor-0.9.5 with xerces-2.4.0 to automatically generate classes from XSDs via source generator and un-/marshall JAVA objects to/from XML files. My question is how to tell the castor...
1
by: madhununna | last post by:
I'm trying to parse string data using castor and it looks like the new lines are getting lost. I'm using castor 0.9.4.3 For example: Input <INPUT> First line
0
by: Chris | last post by:
I am using Castor to marshal and unmharshal some objects. I have an object that has a List of strings. I can marshal it without using a mapping file. However, when I try to unmarshal it without...
0
by: manas589 | last post by:
Hi Can any one tell me how to use binding.xml while generating castor bean from an xsd file. i have one xsd file where two element are conflicting. so i thought to use binding file while...
1
by: peary | last post by:
Hi, everyone, I'm writing a program to discover wireless network using Windows Native Wifi API & VB.net. I have to declare the windows API in my VB.net program. The original windows...
0
by: mnsh | last post by:
Hello, I am new to JAXB. So I would like somebody to help me solve this problem. I have a class say Test which contains only a List which has some 6 to 7 user defined objects. I am able to...
2
by: d-42 | last post by:
Hi, I'm pretty sure I've just got a Marshalling problem, but I'm completely stumped. If there is a better newsgroup to post this in, please point me towards it. First I'm trying to use...
1
by: d-42 | last post by:
Hi, I'm pretty sure I've just got a Marshalling problem, but I'm completely stumped. If there is a better newsgroup to post this in, please point me towards it. First I'm trying to use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.