my dog learned polymorphism*
The moose likes Object Relational Mapping and the fly likes POJO not generating for the xsd which contains enumeration list with jaxb tool. Its urgent please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "POJO not generating for the xsd which contains enumeration list with jaxb tool. Its urgent please " Watch "POJO not generating for the xsd which contains enumeration list with jaxb tool. Its urgent please " New topic
Author

POJO not generating for the xsd which contains enumeration list with jaxb tool. Its urgent please

rameshdilse kumar
Greenhorn

Joined: Jun 14, 2011
Posts: 2
Hi,

I am getting the below error while running it local machine in Jdeveloper.

DefaultValidationEventHandler: [ERROR]: attribute "unitOfMeasure" has a bad value: the value is not a member of the enumeration.
Location:
2011-06-10 16:16:53 ERROR [main] - DATA:Error parsing the input XML - attribute "unitOfMeasure" has a bad value: the value is not a member of the enumeration.

In the xml schema the enumeration list is as follows, it is an example.

<xsd:complexType name="Quant">
<xsd:simpleContent>
<xsd:extension base="xsd:float">
<xsd:attribute name="unitOfMeasure" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="RM"/>
<xsd:enumeration value="GK"/>
<xsd:enumeration value="SH"/>
<xsd:enumeration value="FEB"/>
<xsd:enumeration value="KAL"/>
<xsd:enumeration value="AAA"/>
<xsd:enumeration value="BBB"/>
<xsd:enumeration value="NNN"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>

The new item I added in the schema is "NNN".
When any value in the xml comes with "NNN", then it is giving the error (the value is not a member of the enumeration.), which I mentioned above.


The Pojo (java) file is generated as follows.Please note, It doesn't have any enumeration list of elements, but still it is parsing the values other than "NNN" in the enumeration list.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//

// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v1.0.6-01/24/2006 06:08 PM(kohsuke)-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.06.09 at 05:50:23 PM GMT+05:30
//


package nh.nfp.beans;


/**
* Java content class for QuantityAmountType complex type.
* <p>The following schema fragment specifies the expected content contained within this java content object. (defined at file:/D:/jaxb-ri-1.0.6/bin/bill.1.1.xsd line 402)
* <p>
* <pre>
* <complexType name="QuantityAmountType">
* <simpleContent>
* <extension base="<http://www.w3.org/2001/XMLSchema>float">
* <attribute name="unitOfMeasure">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="RM"/>
* <enumeration value="GK"/>
* <enumeration value="SH"/>
* <enumeration value="FEB"/>
* <enumeration value="KAL"/>
* <enumeration value="AAA"/>
* <enumeration value="BBB"/>
* <enumeration value="NNN"/>
* </restriction>
* </simpleType>
* </attribute>
* </extension>
* </simpleContent>
* </complexType>
* </pre>
*
*/
public interface QuantityAmountType {


/**
* Gets the value of the value property.
*
*/
float getValue();

/**
* Sets the value of the value property.
*
*/
void setValue(float value);

/**
* Gets the value of the unitOfMeasure property.
*
* @return
* possible object is
* {@link java.lang.String}
*/
java.lang.String getUnitOfMeasure();

/**
* Sets the value of the unitOfMeasure property.
*
* @param value
* allowed object is
* {@link java.lang.String}
*/
void setUnitOfMeasure(java.lang.String value);

}



Let me know for more information.

hanks in advance,
Ramesh
rameshdilse kumar
Greenhorn

Joined: Jun 14, 2011
Posts: 2
Sorry to forget I am generating the POJOs as mentioned in the below line .

C:\> xjc -d C:\ppp -p nfp.beans bill.xsd

Thanks in advance
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: POJO not generating for the xsd which contains enumeration list with jaxb tool. Its urgent please
 
Similar Threads
API for Reading XML Schema
Why you should avoid Notation Declarations ?
extending a complexType
Simple Type Inheritance
xml:lang and XML Schema