JAXB binding list of doubles
Hi, I have a problem in binding elements containing a list of doubles. The elements may occur many times. In the generated code, doubles from different elements are returned in the same list. Is there any way to force the creation of a new java type, so that doubles from different elements can be accesed separately?
Example:
XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:element name="main">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="foo" type="foo"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="foo">
<xsd:sequence>
<xsd:element name="bar" type="doubleArray" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="doubleArray">
<xsd:list itemType="xsd:double"/>
</xsd:simpleType>
</xsd:schema>
XML
<?xml version="1.0" encoding="UTF-8"?>
<main xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="forum.xsd">
<foo>
<bar>1 2 3</bar>
<bar>4 5 6</bar>
<bar>7 8 9</bar>
</foo>
</main>Generated code:
* Objects of the following type(s) are allowed in the list
* double
java.util.List getBar();Method getBar returns a list containing all the doubles from all the bar elements, instead of returning a list of objects of type Bar, where each object at its turn contains a list of doubles.
Thank you
Rogier_de_Groot wrote:
So if you wanted to generate an XML document like I wanted to do, you'd use something other then JAXB?I have no idea. I haven't ever had any use for XML-to-Java mappings like that. And I don't know what your requirements are; it seems to me like JAXB would do but you have some complaints which appear in my opinion to be non-critical. I certainly wouldn't start writing a JAXB clone just based on what you posted here. For me, if it works and removes the requirement for me to do 6 months of design and development, I'm willing to overlook a few things.
Similar Messages
-
Can't create a JAXB binding for ejb-jar.xml using xjc
Hi all,
I have been trying to build a JAXB binding for EJB deployment descriptors, mainly because I have to update a hand-cranked ejb-jar.xml file on the fly with some additions that have come from a code generator.
I have tried to use
xjc ejb-jar_2_1.xsd j2ee_1_4.xsd ejb-jar_2_1.xsd
xjc on the schema definitions I found at http://java.sun.com/xml/ns/j2ee/ but I can't get it to work. It produces reams of errors, see below for a short extract.
Of course, someone could put me out of my misery and tell me where to find a binding that someone else has done. I can't be the first chimp on the planet that has wanted to do this!
Any help much appreciated.
errors:
[WARNING] warning: "blockDefault" attribute of <schema> is not supported
line 3 of xml.xsd
[WARNING] warning: "finalDefault" attribute of <schema> is not supported
line 3 of xml.xsd
[WARNING] warning: <key> identity constraint will be ignored by JAXB validation
line 117 of j2ee_web_services_client_1_1.xsd
[WARNING] warning: <key> identity constraint will be ignored by JAXB validation
line 115 of ejb-jar_2_1.xsd
[WARNING] warning: <keyref> identity constraint will be ignored by JAXB validation
line 129 of ejb-jar_2_1.xsd
[WARNING] warning: <key> identity constraint will be ignored by JAXB validation
line 145 of ejb-jar_2_1.xsd
[WARNING] warning: <keyref> identity constraint will be ignored by JAXB validation
line 159 of ejb-jar_2_1.xsdException initializing 'oracle.dbtools.raptor.MonitorJDBCAddin' in extension 'Oracle SQL Developer': oracle.classloader.
util.AnnotatedNoClassDefFoundError:
Missing class: oracle.jdbc.OracleDriverThe Oracle driver is not on the classpath. -
Not able to get ADF select many checkbox working with binding lists
Hi,
I have 2binding lists: list A that holds the selected choices and list B for all the choices. When the user opens the page, a list of checkbox should be displayed all the choices from list B with the saved ones pre-checked from list A. When the user changes the selection, the binding list A should be updated.
I tried to use ADF select many checkbox but could not get it working for this.
There are 2 big issues:
1, can get all the choices from binding list B displayed but not able to pre-check the ones from list A.
2, when the selection changed, not able to updated list A with the new choices
I find some sample but it is talking about saving the selected choices into the managed bean not into binding object and using valueChangeListener. How to implement this in ADF? Please help.
Thanks,
HelenHelen,
I don't think you can do this with a select many checkbox. This component works on one list whereas you want to handle two. You may archive this if you use a managed bean and handle all the list manipulation in java.
Your use case more looks like a select many shuffle (http://docs.oracle.com/cd/E18196_01/11.1.2.0.0/lovs.html).
Timo -
Toad error ORA-01026: multiple buffers of size 4000 in the bind list
Hi All
when iam running explain plan in Toad version 11.5.1.2 the below error coming,
ORA-01026: multiple buffers of size > 4000 in the bind list
i have checked the all possible solutions provided in forums but no luck
I hav changed NLS_LANG parameter in registry for all ORACLE_HOMES but no luck.
Please any solution share us.
Thanks
ShaikHave you referred this thread
https://kr.forums.oracle.com/forums/thread.jspa?threadID=596588
Also you can see MOS Document 18617.1 -
I am testing Zones and Dynamic Resource Pools together on build 55.
Would you let me know how to confirm to which pool a zone is binding.
It is possible to bind a non-global zone to a particular pool with 'poolbind -p poolname -i zoneid id...' command. But I don't see the way how to query the report for zones and pools binding list.
Yoko HasegawaFrom within the zone, you can see what pool you're bound to by simply using
the -q argument to poolbind(1M) with a valid pid, such as "poolbind -q $$".
Alternatively, you can use the pooladm(1M) command with no arguments.
Note that if you don't have pools active, this will result in a "Facility is not active"
message but otherwise you'll see the details about the pool this zone is bound
to.
From the global zone, you can see the actual pool the zone is currently bound
by doing something like "zlogin myzone 'poolbind -q $$'". And you can see
which pool the zone will attempt to bind to the next time it reboots by using
the "zonecfg -z myzone info pool" command.
Does this help? -
Hi All
Im using Webservices in which i need to Bind my XML to Java objects and reverse. Im trying to use JAXB (1.0) Ref Imp from SUN as binding framework. The problem which im facing is that for elements like:
<xs:element name="inputRequests">
<xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" name="inputData" type="data" />
</xs:sequence>
</xs:complexType>
</xs:element>
JAXB genetrates:
1. InputRequest - Interface
2. InputRequestImpl - Class
3. InputRequestType - Interface
4. InputRequestTypeImpl - Class
in InputRequestType it has generated a getter method
public java.util.List getInputData();
but no setter method for 'inputData'.
Can any one help on that how we can set a sequence element in JAXB classes. I even used JAXB 2.0, but faced same issue...
No Setter for a LIST :-(((That method, getInputData() is returning a reference to a List Object that is already instantiated. Once you retrieve the reference, you can invoke all the methods in the List interface, but if there is a way to reassign the reference to refer to a different list, I'm not aware of one.
I believe that limitation is necessary my the nature of JAXB. A JAXB Object, in your case a List, is guaranteed to be marshaled and unmarshaled to XML, if you redefine the reference to some arbitrary List, how could JAXB guarantee its functionality?
I may be way off base here, I'm no JAXB expert by any means.
Rather than redefining the reference to a different List, you have to manipulate the List
...getInputData().clear();
...getInputData().addAll(myRequestList);Right? -
JAXB binding schema type conversions
If your DTD contains something like this:
<!ELEMENT chicken (egg+)>
then JAXB gives you a Chicken class with a method that returns a List of Egg objects.
How can I specify in the binding schema that this collection should be a Hashtable (or other type of collection), not the default List? I think I probably have to write some sort of conversion class, but what is the syntax and how do I get it into my binding schema?Hi you can use the <option> tag at the top-level of your binding schema definition. You can define the default collection type of to be used e.g.
<options default-reference-collection-type="array"/>
Or you can use the collection attribute of most element bindings e.g.
<choice property="entries" collection="array"/>
But only arrays and lists are supported. If you want a different collection type, then you will have to subclass the generated classes and use the Collections class and the collection classes to convert between different collection types.
Hope this helps. -
ICal List view doubling and tripling events on iphone... HELP!
List view worked great for the first month and then 2 recurring events started doubling. In the past week events started tripling. In the other views and on my desktop events are listed correctly, it is only in the list view.
I don't know what is going on and can't find any info on it... am I the only one with this problem?
I really like list view but it's driving me crazy to the point that I can't use it. Any help or advice would be appreciated.
Thank you!!Solution here thanks to Allan Sampson:
http://discussions.apple.com/thread.jspa?threadID=2258232&tstart=0
Message was edited by: jeremy in new york
Message was edited by: jeremy in new york -
Error in Jaxb binding for wsdl document
Hello
below is my wsdl and binding.xjb that I am using. I want to rename the " <element name="getRelatedAssets">" name from 'getRelatedAssets' to 'getRelatedAssetsX'.
But when I run it i got the following error
[ERROR] compiler was unable to honor this property customization. It is attached to a wrong place, or its inconsistent with other bindings.
[ERROR] (the above customization is attached to the following location in the schema)
line 16 of file:/C:/Users/syedf/Documents/Checkers/4842/sample.wsdl
Here is my wsdl:
<wsdl:definitions targetNamespace="http://services.external.dmh.ibm.com"
xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://services.external.dmh.ibm.com" xmlns:intf="http://services.external.dmh.ibm.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://services.external.dmh.ibm.com"
xmlns="http://www.w3.org/2001/XMLSchema" xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://services.external.dmh.ibm.com" xmlns:intf="http://services.external.dmh.ibm.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<complexType name="WsaaAuthToken">
<sequence>
<element name="authToken" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<element name="getRelatedAssets">
<complexType>
<sequence>
<element name="token" nillable="true" type="impl:WsaaAuthToken"/>
<element name="anchorAsset" nillable="true" type="impl:WsaaAssetKey"/>
<element name="relationshipName" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</element>
</wsdl:definitions>
and here is my binding file:
<jaxws:bindings
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
wsdlLocation="C:\Users\syedf\Documents\Checkers\4842\sample.wsdl">
<jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema">
<jaxb:bindings node="//xsd:element[@name='getRelatedAssets']">
<jaxb:property name="getRelatedAssetsX"/>
</jaxb:bindings>
</jaxws:bindings>
</jaxws:bindings>
Can anyone help me out in finding what wrong I am doing.
I appreciate.Well, As I mentioned There is an element named 'getRelatedAssets' and I want to rename it to some other name like 'getRelatedAssetsXXXXX' which would not be in Schema using jax binding.
Note. When I manually change the name to 'getRelatedAssetsXXXXX' in WSDL, it works. but I want to make it using jaxbinding.
Anyways,Thanks for the reply. -
RV325 DHCP static address list and duplicates in unknown IP & MAC Binding List Table
DHCP Manual Bindings are entered and are displayed correctly in the IP & MAC Binding Table.
The error is that there are duplications of the IP address in the Unknown MAC Address List and hitting the Refresh button does nothing.
These duplicates remain in the Unknown table forever. Only a reboot of the router really refreshes the Unknown table.
Any suggestion?The problem has been solved.
All the settings are apparently stored in the open directory database. I had to enable system records and viola there was the extra entry complete with MAC address and IP address. -
How to bind list data to XML Web service request
How do I bind specific columns in a DataGrid to the Web
service request? I'm having trouble finding any documentation that
addresses that specific pattern, i.e. sending a complex list to the
server via a Flex Web service send() command. I'm fairly new to
Flex programming and don't know if what I want to do is possible.
Here what I've been able to do so far.
1. Using a Web service called a service on the server and
retrieved a complex list.
2. Poplulated a DataGrid with the result
3. The user has selected multiple rows from the DataGrid
using a checkbox column
4. The user pressed a button that calls a Web service send().
This Web service should only send data from only two columns and
only for those rows the user has checked.
5. I can loop over the DataGrid and find the selected rows
and put them in another ArrayCollection called 'selectedRows'.
The issue is that I don't know how to bind 'selectedRows' to
the Web service. Right now I'm reading up on "Working with XML" in
the Programming with ActionScript 3.0 chapter. But I'm just fishing
here. No bites yet.Don't bind. Build the request object programatically, as you
are doing with your selectedRows AC, and send(myObject) that.
Tracy -
Hi,
i have a wsdl with such schema: complextype person with elements COLBOBPPHONE, COLBOBPPHONE and COLBOBPEMAIL. wsimport generates than class Person and getters/setters for this elements. I'd like a custom binding, than makes one member in Person named communications. In communications i'd have getters and setters for COLBOBPPHONE, COLBOBPPHONEand COLBOBPEMAIL. Than i would access it by person.getCommunications().getCOLBOBPPHONE(). So i try like this, i created a new complextype:
<complexType name="Communications">
<all>
<element name="telephones" type="ns:COLBOBPPHONE" minOccurs="1"
maxOccurs="1" nillable="true" />
<element name="faxes" type="ns:COLBOBPPHONE" minOccurs="1"
maxOccurs="1" nillable="true" />
<element name="emails" type="ns:COLBOBPEMAIL" minOccurs="1"
maxOccurs="1" nillable="true" />
</all>
</complexType>How to i say in jaxb custom bindings that the elements COLBOBPPHONE, COLBOBPPHONEand COLBOBPEMAIL should be bind to property communications which is class Communications? Is this even possible with jaxb? Maybe i have to use jixb or something else?
for better understanding, is the structure mapping that description follows possible also with jaxb? [jibx structure mapping|http://jibx.sourceforge.net/binding/tutorial/binding-structures.html]
Edited by: juro on Jun 23, 2009 6:50 AMyes. check getter and setter functions.
-
Hi,
I'm using xml and JMS to query a remote system.
One of the values in the remote system that I am interested in is a boolean value. I do not know this field is defaulted in the remote system so I want to use a Boolean object to represent it. I.e I want it to be null is no value is available in the remote system.
Could any of you give me a quick run down on how to go abount doing this or point me to a tutorial.
Is there another way of doing what I am trying to do?
Appreciate any help.
Cheers,
NimHi James,
Yup, I'm trying to process the xml returned by the remote system.
The Boolean is an element and not an attribute:
The schema i am using is shown below:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="accounts" type="AccountsType"/>
<xsd:complexType name="AccountsType">
<xsd:sequence>
<xsd:element name="account" type="Account" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Account">
<xsd:sequence>
<xsd:element name="accountId" type="xsd:string"/>
<xsd:element name="customerId" type="xsd:string"/>
<xsd:element name="totalAmountOwing" type="xsd:decimal"/>
<xsd:element name="amountOwing" type="xsd:decimal"/>
<xsd:element name="totalArrears" type="xsd:decimal"/>
<xsd:element name="paymentExtensionCount" type="xsd:integer"/>
<xsd:element name="paymentHistoryIndicator" type="xsd:string"/>
<xsd:element name="payDate" type="xsd:date"/>
<xsd:element name="directDebitSchedule" type="xsd:boolean"/>
<xsd:element name="easyPaySchedule" type="xsd:boolean"/>
<xsd:element name="billIssueDate" type="xsd:date"/>
<xsd:element name="arrearsDebtAge" type="xsd:integer"/>
<xsd:element name="sourceSystemId" type="xsd:string"/>
<xsd:element name="readFrequency" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
I have access to change the schema. I tried making the boolean an attribute as shown below:
<xsd:element name="easyPaySchedule">
<xsd:complexType>
<xsd:sequence/>
<xsd:attribute name="value" type="xs:boolean"/>
</xsd:complexType>
</xsd:element>
but I could not see the isSetMethod in the jaxb account implementation file.
I changed it back and added minOccurs="0":
<xsd:element name="easyPaySchedule" type="xsd:boolean" minOccurs="0" maxOccurs="1"/>
and started seeing the isSetMethod in the jaxb account implementation class but not the generated account interface.
Next, I used the xjb file below:
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<jxb:bindings schemaLocation="accounts.xsd" node="/xsd:schema">
<jxb:bindings node="//xsd:complexType[@name='Account']">
<jxb:bindings node=".//xsd:element[@name='easyPaySchedule']">
<jxb:property generateIsSetMethod="true"/>
</jxb:bindings>
</jxb:bindings> <!-- node="//xsd:complexType[@name='Account'] -->
</jxb:bindings> <!-- schemaLocation="accounts.xsd" node="/xsd:schema" -->
</jxb:bindings>
and I started seeing the isSet methods in the generated Account interface.
I thought I was in the clear but when I try and run it with the xml below:
<account>
<accountId>11111111111</accountId>
<customerId>2222222</customerId>
<totalAmountOwing>123</totalAmountOwing>
<amountOwing>12</amountOwing>
<totalArrears>0</totalArrears>
<paymentExtensionCount>1</paymentExtensionCount>
<paymentHistoryIndicator>110111001111</paymentHistoryIndicator>
<payDate>2004-10-08+10:00</payDate>
<directDebitSchedule>false</directDebitSchedule>
<easyPaySchedule></easyPaySchedule> <<<<<<------ blank instead of false/true
<billIssueDate>2003-10-08+10:00</billIssueDate>
<arrearsDebtAge>0</arrearsDebtAge>
<sourceSystemId>cise</sourceSystemId>
<readFrequency>Q</readFrequency>
</account>
I start to get the following exception:
javax.xml.bind.UnmarshalException: Unexpected text ""
- with linked exception:
[java.lang.NullPointerException]
Any ideas as to whats going on?
Cheers,
Nim -
Help in Binding list to Flex chart Axis.
Hi!
I am doing chart binding in flex. I have a list with Data. I want to separately bind the Y-Axis of chart and then plot line series according to the data in the list.
Moreover I want to change the background color and border of Data Tip in Flex Chart.
Regards,
Nazzal.See here:
http://livedocs.adobe.com/flex/3/html/help.html?content=charts_types_08.html
There's stuff on data and on customised datatips... -
Jaxb binding where no datatype given.
I have an xml schema that I don't have access to change, it has many elements with no type. The type of each of these should be String, But when I run xjc they com out as AnyTypes.
I have tried creating a binding file with the following at each relevent node:
<jxb:javaType name="java.lang.String"
parseMethod="javax.xml.bin.DatatypeConverter.parseString"
printMethod="javax.xml.bin.DatatypeConverter.printString" />but I get
[exec] [ERROR] Specified conversion customization is not used.
[exec] line 10 of dmv.xjb
[exec] Failed to parse a schema.is there a way for me to do this without editing my schema?bindingStyle is defined in http://java.sun.com/xml/ns/jaxb which I referenced at the top of my bindings files as such:
<jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:bindings schemaLocation="ims_qtiasiv1p2c.xsd" node="/xs:schema">
Maybe you are looking for
-
Migration Assistant has been running since yesterday evening. My Dell is now telling me that its trying to reconnect to my Mac and to ensure they are both using the same network. I have an Ethernet cable plugged in them and they are both on the sam
-
Automatically update 2 dimensional array based on list content
Suppose I have a simple class named SimplePoint class SimplePoint public int x { get; set; } public int y { get; set; } Next I create an ObservableCollection of the class and bind it to a WPF DataGrid via XAML. Each SimplePoint has a distance to each
-
Green flashing downloading arrow on firefox disappeared. How do I get it back
How do I get back the green flashing arrow when downloading
-
Hello Everyone, Is it a good practice to create new objects (stored procedures, tables etc.) or modify and reuse the existing object if that can be done? Regards Regards
-
Air Tunes not working after "8" install.
I have installed iTunes 8 successfully. Everything works great except my ever dependable Air Tunes / Airport EXpress hook-up now does not work. Some Unknown error. I have re-installed iTunes and reconfigured AirPort Express. Nothing. Can someone help