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">
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. -
Extract the "bind" variables for a given query running in 10g.
how can we extract the "bind" variables for a given query running in 10g? The performance of a query may vary based on the parameters supplied to it. For example, a query like the following
SELECT * FROM CUSTOMER_ORDERS WHERE CUSTOMER = :CUST_ID
.might run differently when the :CUST_ID is "123" who may have very few orders versus "456" who may have tens of thousands of orders.
So, if we see a spike in the system due to a query, we need visibility into what the exact query syntax and values are for any database session. We're aware of an Oracle view called V$SQL_BIND_CAPTURE, but what we're finding with this view is that it's only a snapshot of variables that are refreshed on an interval. That view does not give us a live view into what values are being used in the various sessions in realtime.
If someone ould provide us with some SQL (or other means) to do get a realtime view into the SQL and variables currently running in the database, it would be greatly appreciated.In addition to what's been said in the other thread, you could add a layer of logging either in the database or out.
v$sql_bind_capture and the associated ash view dba_hist_sqlbind contain sample data.
You could up the sample rate but it's not advisable - it's still just a sample.
If you're on 11g, this is where adaptive cursor sharing might help.
Not help in finding the values of your binds, but help in using different plans where there is such a skew for different bind values and the plan is perhaps wrong for customer 456.
The problem when you're got such a skew and you're using bind variables is that the two don't really go together.
When the query is next parsed and you've got bind variable peeking enabled, you might get the 123 plan is that is the bind value at parse time and then run into problems for 456 or even vice versa.
See http://jonathanlewis.wordpress.com/2009/05/06/philosophy-1/ for a discussion on binds and histograms which reflects the reasons for using either. -
PO creation where discount is given after taxes for few Vendors
Hi pankaj,
Need a pricing stucture in PO creation where discount is given after taxes for few Vendors.
please give the solution with brief steps.
Regards,
PandiHi,
Take a copy of RA01 in M/06 as YA01(as Discount) and keep it as following;
Cond. class A Discount or surcharge
Calculat.type A Percentage
Cond.category Blank
And Plus/minus - A (Positive)
Use this in Pricing Procedure ( M/08 ) after Gross Price ad Discount conditions (before Subtotal) and assign Subtotal "6" against this condition type.
In OBQ3 - Tax Procedure, assign AltCBV 363 to CST/VAT Condition Type (JIP1/JIP5)
Now check the calculation will happen as following;
Gross Price = 10000 INR
Discount (as -ve/+ve) = 1000 INR
BED 14% = 1400 INR
ECS 2% = 28 INR
SECess 1% = 14 INR
CST 2% = 248.84 INR
Also refer following thread for the same;
[Calculation Procedure; -
ORA-02005: implicit (-1) length not valid for this bind or define datatype
Error received when attempting to login to Portal 3.0.8.9 using Internet Explorer 5.50.4522.1800CO (from Oracle OBI 5.0).
Error does not occur when using Netscape 4.75. However, Netscape pegs CPU between every Portal page. I must maximize/minimize the Windows Task Manager in order for Netscape to move to next Portal page.
Both browsers work with other sites.
ORA-02005: implicit (-1) length not valid for this bind or define datatype
DAD name: portal30
PROCEDURE : PORTAL30.home
URL : http://hostname:port/pls/portal30/portal30.home
PARAMETERS :
============
ENVIRONMENT:
============
PLSQL_GATEWAY=WebDb
GATEWAY_IVERSION=2
SERVER_SOFTWARE=Oracle HTTP Server Powered by Apache/1.3.12 (Win32)
ApacheJServ/1.1 mod_ssl/2.6.4 OpenSSL/0.9.5a mod_perl/1.24
GATEWAY_INTERFACE=CGI/1.1
SERVER_PORT=80
SERVER_NAME=host
REQUEST_METHOD=GET
QUERY_STRING=
PATH_INFO=/pls/portal30/PORTAL30.home
SCRIPT_NAME=/pls
REMOTE_HOST=
REMOTE_ADDR=127.0.0.1
SERVER_PROTOCOL=HTTP/1.1
REQUEST_PROTOCOL=HTTP
REMOTE_USER=
HTTP_CONTENT_LENGTH=
HTTP_CONTENT_TYPE=
HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
HTTP_HOST=host
HTTP_ACCEPT=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword,
application/pdf, */*
HTTP_ACCEPT_ENCODING=gzip, deflate
HTTP_ACCEPT_LANGUAGE=en-us
HTTP_ACCEPT_CHARSET=
HTTP_COOKIE=ses= (removed due to length limitations)
Authorization=
HTTP_IF_MODIFIED_SINCE=
HTTP_REFERER=Hi Matt
Thanks for your help. Here's some extracts from a NUnit test case that I made to show ArrayBinding bombing on VARCHAR2(4000).
private void SetupAdapterAndCommandForArrays()
OracleParameter p9 = new OracleParameter();
p9.OracleDbType = OracleDbType.Varchar2;
p9.ParameterName = ":p_instr_array";
p9.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
p9.ArrayBindSize = new int[]{4000, 4000};
p9.Size = 2;
p9.Direction = ParameterDirection.Input;
p9.ArrayBindStatus = new OracleParameterStatus[]{OracleParameterStatus.Success,OracleParameterStatus.Success};
OracleCommand comm = new OracleCommand();
comm.Connection = new OracleConnection("Data Source=aboded12_local;user id=pcm_app;password=pcm_app");
comm.CommandText = "PCM_OWNER.PKG_DAC_JASON.InsertStringArray";
comm.CommandType = CommandType.StoredProcedure;
comm.Parameters.Add(p9);
da = new OracleDataAdapter();
da.InsertCommand = comm;
da.InsertCommand.Connection.Open();
[Test]
public void TestStringArrayOf4000()
SetupAdapterAndCommandForArrays();
da.InsertCommand.Parameters[0].Value = new string[]{new string(Convert.ToChar("3"),4000), new string(Convert.ToChar("4"), 4000)};
da.InsertCommand.ExecuteNonQuery();
So when I run TestStringArrayOf4000() i get the : Oracle.DataAccess.Client.OracleException : ORA-02005: implicit (-1) length not valid for this bind or define datatype error.
If i run another test i have that sets up an array with less than 4000 this works fine.
any help you can offer is greatly appreciated!
Message was edited by:
[email protected]
Message was edited by:
[email protected] -
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 youRogier_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. -
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. -
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 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? -
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 -
Am having trouble building an external binding file to cope with the following xsd extract
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="urn:hl7-org:v3" xmlns="urn:hl7-org:v3" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hl7="urn:hl7-org:v3" xmlns:xlink="http://www.w3.org/TR/WD-xlink" xmlns:gsd="http://aurora.regenstrief.org/GenericXMLSchema" elementFormDefault="qualified">
<xsd:complexType name="ANY" abstract="true">
<xsd:attribute name="nullFlavor" type="cs_NullFlavor" use="optional"/>
</xsd:complexType>
<xsd:simpleType name="cs_NullFlavor">
<xsd:restriction base="cs">
<xsd:enumeration value="NI"/>
<xsd:enumeration value="NA"/>
<xsd:enumeration value="UNK"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="cs_AddressPartType">
<xsd:restriction base="cs">
<xsd:enumeration value="DEL"/>
<xsd:enumeration value="STTYP"/>
<xsd:enumeration value="STR"/>
<xsd:enumeration value="ADDRK"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="AD" mixed="true">
<xsd:complexContent mixed="true">
<xsd:extension base="ANY">
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="streetName">
<xsd:complexType mixed="true">
<xsd:complexContent mixed="true">
<xsd:restriction base="ADXP">
<xsd:attribute name="partType" type="cs_AddressPartType" fixed="STR"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="streetNameType">
<xsd:complexType mixed="true">
<xsd:complexContent mixed="true">
<xsd:restriction base="ADXP">
<xsd:attribute name="partType" type="cs_AddressPartType" fixed="STTYP"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:simpleType name="cs_BinaryDataEncoding">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="B64"/>
<xsd:enumeration value="TXT"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="BIN" abstract="true" mixed="true">
<xsd:complexContent mixed="true">
<xsd:extension base="ANY">
<xsd:attribute name="representation" type="cs_BinaryDataEncoding" use="optional" default="TXT">
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ED" mixed="true">
<xsd:complexContent mixed="true">
<xsd:extension base="BIN">
<xsd:attribute name="mediaType" type="cs" use="optional" default="text/plain">
</xsd:attribute>
<xsd:attribute name="language" type="cs" use="optional">
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ST" mixed="true">
<xsd:complexContent mixed="true">
<xsd:restriction base="ED">
<xsd:attribute name="mediaType" type="cs" use="optional" default="text/plain">
</xsd:attribute>
<xsd:attribute name="language" type="cs" use="optional">
</xsd:attribute>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="ADXP" mixed="true">
<xsd:complexContent mixed="true">
<xsd:extension base="ST">
<xsd:attribute name="partType" type="cs_AddressPartType">
</xsd:attribute>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:simpleType name="cs">
<xsd:restriction base="xsd:token">
<xsd:pattern value="[^\s]*"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
Above is a very much truncated extract of our xsd file
I get XJC errors around 'streetNameType'
any ideas on a binding definition that works with this ??
ThanksThis is the SAMPLE schema - that includes the earlier post
(ie the earlier post shows datatypes.xsd)
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="urn:hl7-org:v3" xmlns="urn:hl7-org:v3" xmlns:hl7="urn:hl7-org:v3" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:include schemaLocation="datatypes.xsd"/>
<xs:element name="rootTest" type="test.smTest"/>
<xs:complexType name="test.smTest">
<xs:sequence>
<xs:element name="id" type="xs:anySimpleType"/>
<xs:element name="addr" type="AD" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema> -
Jaxb -binding specific elements of schema to class
Is there a way to bind only specific elements from a schema to a class instead of binding everything in the schema. If yes, how do you specify this.
The <class> binding declaration customizes the binding of a schema element.
http://java.sun.com/xml/jaxb/users-guide/jaxb-custom.html#customdesc_class -
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. -
hi friends,
i didn't get implementation classes for xsd during the binding schema.i insatlled Jwsdp2.0and j2sdk1.5.Is any give me me an ideaHi
Go through the sun website for doing so. This would give you a clue as to how to.
http://java.sun.com/xml/jaxb/jaxb-docs.pdf
It teaches you a step by step procedure to go ahead. -
Is it possible to bind a method declartion to an xml schema using JAXB. For instance, want to inforce the command pattern execute method in the JAXB generated clasess.
Hi,
Please post your DTD also.
With out DTD we won't be knowing the Structure of the Document..
For Ex. we don't know how many times element list1 can occur..
-Sateesh
Maybe you are looking for
-
Is it possible to export multitrack EDL as text doc?
I have a complicated 9 track video with corresponding audio from which I would like to create a complete edit decision list (to include clip name, effects, location in sequence, duration, etc.). I would also like to have this EDL exported into eithe
-
I am trying to sync music from my iTunes library on my iMac to my iPhone. I only want selected music but I'm getting unwanted songs. How can I delete those songs on my iPhone or how can I prevent these unwanted songs that have not been selected from
-
Contact sheet II not working in photoshop CS6 or bridge CS6?
I keep getting error messages in photoshop CS6 and Bridge CS6 when trying to create a contact sheet. Does anyone know what the problem might be? The error messages I'm getting are attached.
-
What can I do to keep the music I've purchased now that I am on my 5th computer and need to get another one? All of the computers have been mine and I haven't shared the music.
-
XML construction and tranformation
Hi, I am constructing an XML doc using DocumentBuilderFactory class and adding elements. Once I finished I converted it into String(entire XML) and get the byte equivalent to set it in the servlet response . Evertthing worked fine untill i used crims