XSD/JAXB question

I'm just starting out on using XSD/JAXB, and I was wondering how best to approach this:
<likes>
  <like val="color">red</like>
  <like val="number">7</like>
</likes>That is, the value of the val attribute determines the type of content that the like element should accept. For example:
<xs:simpleType name="colors">
  <xs:restriction base="xs:string">
    <xs:enumeration value="red"/>
    <xs:enumeration value="orange"/>
    <xs:enumeration value="yellow"/>
    <xs:enumeration value="green"/>
  </xs:restriction>
</xs:simpleType>
<xs:simpleType name="numbers">
  <xs:restriction base="xs:int">
    <xs:minInclusive value="3"/>
    <xs:maxExclusive value="20"/>
  </xs:restriction>
</xs:simpleType>But how to use the attribute value to determine the acceptable element content? I have managed to use union to define element content that is a union of acceptable input types, but since this is not restricted by the attribute, you could end up with invalid XML like:
<likes>
  <!-- invalid xml when content is a union of types -->
  <like val="color">7</like>
  <like val="number">red</like>
</likes>Any takers?
Thanks, Neil

<xs:element name="likes">
<xs:complexType>
<xs:sequence>
<xs:sequence>
<xs:element name="like" type="colors"/>
</xs:sequence>
<xs:sequence>
<xs:element name="like" type="numbers"/>
</xs:sequence>
</xs:sequence>
</xs:complexType>
</xs:element>
thanks,
Deepak

Similar Messages

  • Basic JAXB Question

    hi,
    this is probably a stupid question but how can I simply generate java classes based on an XSD using JAXB. I've been browsing some tutorials but this part is never really explained except for using some script called xjc. This script however seems to be included in the webservices-package and not in the jaxb-library which I find a bit wierd, I don't understand why everytime you're in a jaxb-tutorial or such you're actually just in some chapter of a webservices-tutorial.
    Anyway I would like to generate classes based on an XSD-schema without download & installing webservices which I neither want or need. Isn't there a main-class in jaxb which does this (like in castor) or an ant-script or ... ?
    Any help is very appreciated,
    tx,
    Stijn

    Actually JAXB itself is not doing that. If you install JWSD(Java webservices pack) there is JAXB library in it along with a compiler called XJC. you can directly create java files from XSD using xjc by simply typing
    C:\>xjc myxsd.xsd
    JAXB library provides some functions to access this DOM.
    Marshaller class helps to create XML document from these classes generated and UnMarshaller does the reverse.
    If you need more help mail to me
    [email protected]

  • JAXB question

    DB Structure
    Parent Table - Incident --> Child Table - IncidentCharges --> Child Table of IncidentCharges --> IncidentChargeWeapons
    Container
    Oracle Containers for JAVA(OC4J)
    We have a schema (Incident.xsd) which comprises of our entire database structure. We unmarshalled the schema using JAXB to Java classes and interfaces .
    It created 2 .java classes and 2 .java interfaces for each high level tag . for eg for our Incident tag it created a Incident interface and a IncidentType Interface
    and also it created 2 classes IncidentImpl and IncidentTypeImpl . The IncidentTypeImpl has all the get and set properties we require eg. getIncidentType,
    setIncidentType,getIncidentNumber,setIncidentNumber,getOccuranceDate,setOccuranceDate etc.
    Our objective is to create a JSP page which has form fields to enter data which use these JAXB generated classes get and set properties. In other words
    we want to bind the JSP form fields to these JAXB generated classes. And once these JAXB objects are populated we want to marshal it and create a XML file with the data from those JAXB . Our database would then consume the generated XML. We tried creating a simple incident form with just 3 fields IncidentType,Occurance date and Incident Number and tried to bind these fields with the properties from IncidentTypeImpl classes using the <jsp:usebean> tag . When we deployed it to our container and tried to load the Incident.jsp page , it would not load up . Only when we cleared all the bindings it loaded up .
    Then we tried another workaround (just to get it working. Not a preferred approach) . We created another simple JAVA bean(not JAXB generated beans) which has set and get properties for the form fields and bound the form fields to it.
    On submitting the JSP page we called a servlet which takes data from our created bean and transfers it to the JAXB generated IncidentTypeImpl bean. When we deployed this the jsp page loads up and also our bean is filled with data . But the servlet bombs with this error below.
    500 Internal Server Error
    java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext
    at Servlets.IncidentServlet.doPost(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:765)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
    at java.lang.Thread.run(Thread.java:534)
    We have 2 questions .
    1. Can a JSP page be bound directly to this JAXB generated bean in pretty much the same way as we bind it to our own bean ? (We would like to do this so that we dont have to create duplicate classes which mirror the JAXB generated classes.)
    2. Is there something special we have to do to deploy this application to recognize the JAXB classes. Do we have to deploy some jar file for it to recognize those classes ?

    Nevermind, I have then answer to my question - use this flag - use-runtime <pkg> : suppress the generation of the impl.runtime package and simply

  • Xsd extension question

    Hello, I have a question about the extension of complex Types by xsd.
    Can I use polymorphism with the extension of complex Types.
    By example, I define a xml schema
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">
    <xsd:element name="basic" type="basic">
    <xsd:annotation>
    <xsd:documentation>Comment describing your root element</xsd:documentation>
    </xsd:annotation>
    </xsd:element>
    <xsd:complexType name="basic">
    <xsd:sequence>
    <xsd:element name="basicElement" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="derivedBasic">
    <xsd:complexContent>
    <xsd:extension base="basic">
    <xsd:sequence>
    <xsd:element name="derivedElement" type="xsd:integer"/>
    </xsd:sequence>
    </xsd:extension>
    </xsd:complexContent>
    </xsd:complexType>
    </xsd:schema>
    Then my question is, can i use in an xml document which depends on the xml schema the complexType derivedBasic when a basic type is required. (Perhaps i can use a typecast or something).
    I need this, because i want to make a xsd representation of an uml model and want to check dataexchange based on xml.
    Thanks for your help
    Andreas

    If it was me I would post such questions in the XML forum.
    If I understand the question it is not possible.
    In general you cannot describe all possible data validation using only an XSD.

  • XSD:Pattern Question

    SQL*Plus: Release 11.2.0.2.0 Production on Thu Jan 13 15:25:04 2011
    Copyright (c) 1982, 2010, Oracle. All rights reserved.
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE 11.2.0.2.0 Production
    TNS for 64-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    I'm putting together a simpler test case for this, but I figured I'd start by asking the question and seeing if the answer is simple...
    I have an XML document with the date elements:
                    <documentDate>20080808</documentDate>
                    <entryDate>2009-09-22</entryDate>the documentDate is defined as PartialDateType.
         <xsd:simpleType name="PartialDateType">
              <xsd:restriction base="xsd:string">
                   <xsd:pattern value="\d{4}|\d{6}|\d{8}"/>
              </xsd:restriction>
         </xsd:simpleType>When I try to validate the document, I get
    “literal "20080808" is not valid with respect to the pattern”.
    If I shorten the date to "2008", the document validates.
    What part of <xsd:pattern value="\d{4}|\d{6}|\d{8}"/> do I not understand?

    Workaround is to reverse the pattern.. See below
    c:\xdb>sqlplus / as sysdba
    SQL*Plus: Release 11.2.0.2.0 Production on Wed Jan 19 13:55:30 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> set echo on
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/oracle as sysdba
    Connected.
    SQL> --
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> def USERNAME = XDBTEST
    SQL> --
    SQL> def PASSWORD = &USERNAME
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user XDBTEST cascade
    User dropped.
    Elapsed: 00:01:40.47
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to XDBTEST identified by XDBTEST
    Grant succeeded.
    Elapsed: 00:00:00.08
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user XDBTEST default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> set long 100000 pages 0 lines 256 trimspool on timing on
    SQL> --
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> var SCHEMAURL VARCHAR2(700)
    SQL> var XMLSCHEMA CLOB
    SQL> var INSTANCE CLOB
    SQL> --
    SQL> begin
      2    :SCHEMAURL:= 'http://xmlns.example.com/testcase.xsd';
      3    :XMLSCHEMA :=
      4  '<?xml version="1.0" encoding="UTF-8"?>
      5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
      6     <xs:element name="T1" type="T1_TYPE"/>
      7     <xs:complexType name="T1_TYPE">
      8             <xs:sequence>
      9                     <xs:element name="TEST" type="PartialDateType"/>
    10             </xs:sequence>
    11     </xs:complexType>
    12     <xs:simpleType name="PartialDateType">
    13             <xs:restriction base="xs:string">
    14                     <xs:pattern value="\d{8}|\d{6}|\d{4}"/>
    15             </xs:restriction>
    16     </xs:simpleType>
    17  </xs:schema>';
    18  end;
    19  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> declare
      2    V_XML_SCHEMA xmlType := XMLType(:XMLSCHEMA);
      3  begin
      4    DBMS_XMLSCHEMA.registerSchema
      5    (
      6      SCHEMAURL        => :SCHEMAURL,
      7      SCHEMADOC        => V_XML_SCHEMA,
      8      LOCAL            => TRUE,
      9      GENBEAN          => FALSE,
    10      GENTYPES         => FALSE,
    11      GENTABLES        => FALSE,
    12      ENABLEHIERARCHY  => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE,
    13      OPTIONS          => DBMS_XMLSCHEMA.REGISTER_BINARYXML
    14    );
    15  end;
    16  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:04:26.10
    SQL> create table TEST_TABLE of XMLTYPE
      2  XMLTYPE STORE AS SECUREFILE BINARY XML
      3  XMLSCHEMA "http://xmlns.example.com/testcase.xsd" ELEMENT "T1"
      4  /
    Table created.
    Elapsed: 00:00:00.70
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9" is not valid with respect to the pattern
    Elapsed: 00:00:06.08
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99" is not valid with respect to the pattern
    Elapsed: 00:00:06.70
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999" is not valid with respect to the pattern
    Elapsed: 00:00:07.67
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:24.30
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99999" is not valid with respect to the pattern
    Elapsed: 00:00:08.02
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:11.60
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9999999" is not valid with respect to the pattern
    Elapsed: 00:00:05.60
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:06.18
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31061: XDB error: XML event error
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999999999" is not valid with respect to the pattern
    Elapsed: 00:00:05.61
    SQL> DROP TABLE TEST_TABLE PURGE
      2  /
    Table dropped.
    Elapsed: 00:00:00.14
    SQL> call dbms_xmlSchema.deleteSchema(:SCHEMAURL)
      2  /
    Call completed.
    Elapsed: 00:00:00.06
    SQL> declare
      2    V_XML_SCHEMA xmlType := XMLType(:XMLSCHEMA);
      3  begin
      4    DBMS_XMLSCHEMA.registerSchema
      5    (
      6      SCHEMAURL        => :SCHEMAURL,
      7      SCHEMADOC        => V_XML_SCHEMA,
      8      LOCAL            => TRUE,
      9      GENBEAN          => FALSE,
    10      GENTYPES         => TRUE,
    11      GENTABLES        => FALSE,
    12      ENABLEHIERARCHY  => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    13    );
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.87
    SQL> create table TEST_TABLE of XMLTYPE
      2  XMLTYPE STORE AS OBJECT RELATIONAL
      3  XMLSCHEMA "http://xmlns.example.com/testcase.xsd" ELEMENT "T1"
      4  /
    Table created.
    Elapsed: 00:00:00.07
    SQL> create trigger DO_VALIDATION
      2  before insert
      3  on TEST_TABLE
      4  for each row
      5  begin
      6   :new.object_value.schemavalidate();
      7  end;
      8  /
    Trigger created.
    Elapsed: 00:00:00.06
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.39
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.52
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.50
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:05.95
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "99999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.53
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:05.40
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>9999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "9999999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.37
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>99999999</TEST></T1>') )
      2  /
    1 row created.
    Elapsed: 00:00:05.74
    SQL> insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
      2  /
    insert into TEST_TABLE values ( XMLTYPE('<T1><TEST>999999999</TEST></T1>') )
    ERROR at line 1:
    ORA-31154: invalid XML document
    ORA-19202: Error occurred in XML processing
    LSX-00333: literal "999999999" is not valid with respect to the pattern
    ORA-06512: at "SYS.XMLTYPE", line 354
    ORA-06512: at "XDBTEST.DO_VALIDATION", line 2
    ORA-04088: error during execution of trigger 'XDBTEST.DO_VALIDATION'
    Elapsed: 00:00:05.49
    SQL>

  • AQ - XSD Schema Questions

    What I am looking to do is use BPEL for messaging (and manipulation of said messages) in the backend for data synchronization to disparate sources.
    Currently, we are investigating the following:
    Oracle 9i DB with a stored procedure that accepts a number of parameters (or XML Document in CLOB format), processes the document (updates, typically), and before returning, writing the output XML document to an AQ setup on that DB instance.
    BPM (installed on an OAS 10g server instance) would be utilizing the AQ adapter to dequeue this message for processing through the orchestration.
    This is where our difficulty begins. The message the SP generates is based on an enterprise schema (EBOD - currently), which is a relatively robust XSD. Currently, we're looking how to get the AQ adapter to pick up this message (should it be a clob?) off the queue and essentially cast it into our schema that we've imported into the BPM. We haven't had much success doing this so far. Implementing a ADT that is "typed" in the 9i DB by retyping the entire schema is unacceptable, for obvious reasons.
    I think what we're looking to do is take this clob and essentially "cast" it into a message format defined by our schema. Maybe there is a better way to tackle this problem, by using something besides a CLOB (XMLType isn't supported yet, but even then... would that solve our problem?), but I am unsure. We need the message in a manipulatable form in order to call additional web services (that have differing interfaces) by extracting certain elements and passing those. Additionally, we may wish to do some business logic, routing, etc.
    I can clarify what I'm looking to do, but basically 9i DB Stored Proc writes an XML doc to an AQ. BPEL is monitoring said AQ, picks up the CLOB (that type for now) and casts the message to it's schema that we've loaded (no transformation necessary, the schema is for the specific XML doc - ie. the doc validates to that schema) and we basically go forward and process the rest of the orchestration based on this message.
    Can anyone help me with this approach? Any other suggestions?

    Hi Todd,
    The AQ Adapter allows the user to pick a CLOB field within an ADT as the payload and supply a schema for its definition.(pick "Field within Object" for the Business Payload in the AQ Adapter wizard)
    Your 9i DB Store Proc would write to the queue which is defined based on the ADT, with xml payload stored in the CLOB field. The BPEL process would be able to pick up this payload thru the AQ Adapter.
    There is a sample illustrating this scenario in the installation.
    integration\orabpel\samples\tutorials\124.AQAdapter\ADT_with_CLOB_Payload
    Note the sample also uses payload header which is defined by the ADT structure to access fields other than the payload field. The use of headers is optional.
    Let me know if this is what you're looking for.

  • JAXB generated code gives deprecation warnings on compile

    I have a schema that was previously had its binding generated using jwsdp 1.3. I recent;y made some minor changes to the schema and also upgraded to jwsdp 1.5. I made all the required changes to my environmental varibles on my system (acutal no other version of jwsdp was every installed on this box). xjc generates the code without issue:
    xjc -p my.package myxsd.xsd
    When I build my software using an ant script I get hundreds of warnings such as the following:
    [javac] c:\sandbox\code\my\package\ObjectFactory.java:499: warning: com.sun.xml.bind.GrammarInfo in com.sun.xml.bind has been deprecated
    Has anyone seen anything like this, or know what may cause such a problem? I have check all of the jars that my build file calls and they are of the correct version (this so called deprecated package exists in jaxb-impl.jar)
    Any help would be appricated. Thnx.

    JAXB questions should be better directed to the users list of http://jaxb.dev.java.net/
    you should subscribe to the 'users' mailing list, then post a question there.
    Thank you!

  • JAXB External Customizations

    Hello all,
    I've been trying to build a JAXB external customizations file that covers several schemas simultaneously. The JWS 2.0 tutorial mentions the following regarding an external customizations file ...
    You can have a single binding file that contains customizations for multiple schemas,
    or you can break the customizations into multiple bindings files; for example:
    xjc schema1.xsd schema2.xsd schema3.xsd -b bindings123.xjb
    xjc schema1.xsd schema2.xsd schema3.xsd -b bindings1.xjb -b
    bindings2.xjb -b bindings3.xjb
    Note that the ordering of schema files and binding files on the command line
    does not matter, although each binding customization file must be preceded by
    its own -b switch on the command line.
    The JAXB documentation says that the external file format is as follows:
    <jxb:bindings schemaLocation = "xs:anyURI">
    <jxb:bindings node = "xs:string">*
    <binding declaration>
    <jxb:bindings>
    </jxb:bindings>
    where schemaLocation is of the form schemaLocation="some-schema.xsd"
    My question is, how do I reference multiple schemas inside the same customizations file? Everything I've tried to date has failed except creating separate customizations files for each schema. Thanks In Advance.
    - John

    Hi.
    I have already read it. I don't know how to define wsdlLocation (main wsdl or another wsdl?) inside example jaxb bindings. I have tried something like
    <jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <jxb:bindings wsdlLocation="path.to.my.main.wsdl" node="//xs:complexType[@name='objectFactory']">
          <jxb:class name="MyObjectFactory" />
       </jxb:bindings>
    </jxb:bindings> and I'm getting error
    [ERROR] XPath evaluation of "//xs:complexType[@name='objectFactory']" results in
    empty target node
      line 2 of file:myBinding.xjb

  • XSD validation: wrong behaviour for mixed=false

    Based on XSD report.xsd demo file, I experienced mixed="false" attribute of complex type.
    <element name="purchaseReport">
    <complexType mixed="false">
    Such an attribute forbids text nodes in purchaseReport elements.
    So such XML data should be rejected by XSDSetSchema tool:
    <purchaseReport
    xmlns="http://www.example.com/Report"
    xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.example.com/Report report.xsd"
    period="P3M" periodEnding="1999-12-31">
    invalidchar
    <regions>
    However it passes Oracle schema validation, which is not expected.
    It is rejected by XMLSpy, which is expected.
    I didn't find such a bug report.
    Does someone has a clue?
    Tx,
    François Loison

    Hi Mark,
    Thanks for your response for the confirmation of the bug.
    Before we created this thread, we tested our case in Stylus Studio using the following XSD Validators:
    - Saxonica 9.4.0.6
    - Saxonica 9.4.0.6 for XSD 1.1
    - Xalan Java 2.7.0
    - .NET Framework XML Parser
    - Xerces-J Validator 2.11.0 for XSD 1.1
    All of them worked properly for the XML and XSD in question.
    By the way, on the subject of the Oracle XML DB and XSD 1.1, any plans to support it?
    Oracle 12c ?!
    We will open an SR and provide it here. So you will be able to open a bug for this issue.

  • Unexpected element - JAXB

    We have 4 huge (similar) schemas that i compiled and successfully unmarshalled one xml file with validation turned off.
    Problems that I am facing are
    1) When I turn on validation, i run in StackOverFlow exception - tried all sorts of memory settings - no luck.
    2) When i tried to unrmarshal another XML file that is conforming to 2nd schema, i am getting error messages "Unexpected element".
    XML file is well-formed and valid (validated with XML spy).
    My understanding is that JAXB wouldn't validate XML file stucture against scheme when validation is turned off. Why is JAXB validating the structure of the XML document?
    Java file:
    Main class
    MyValidationEventHandler veh = new MyValidationEventHandler();
    JAXBContext jc = JAXBContext.newInstance( "org.tgslc.advweb.xmlbinding.response:org.tgslc.advweb.xmlbinding.response.FFEL:org.tgslc.advweb.xmlbinding.response.core:org.w3._2001.xmlschema" );
    Unmarshaller u = jc.createUnmarshaller();
    u.setValidating(false);
    u.setEventHandler(veh);
    System.out.println("isValidating : " + u.isValidating());
    org.tgslc.advweb.xmlbinding.response.CommonRecordCommonline request =
    (org.tgslc.advweb.xmlbinding.response.CommonRecordCommonline)u.unmarshal( new FileInputStream( FILE_NAME ) );
    org.tgslc.advweb.xmlbinding.response.FFEL.TransmissionDataType trans = request.getTransmissionData();
    displayTransmissionDataType( trans );
    class MyValidationEventHandler implements ValidationEventHandler
    public boolean handleEvent(ValidationEvent arg0)
    System.out.println(arg0.getMessage());
    return true;
    }

    JAXB questions should be better directed to the users list of http://jaxb.dev.java.net/
    you should subscribe to the 'users' mailing list, then post a question there.
    Thank you!

  • JAXB and ClassCastException

    Hi all,
    When I try to unmarshal a XML document, I get a ClassCastException. I've listed the details below. I've also searched the forums on this one but can't seem to find any answer (maybe I've missed it somewhere). I appreciate any help or hints anyone can offer.
    XMLSchema: OrganizationalUnit.xsd
    JAXB Generated classes: OrganizationalUnit.java, OrganizationalUnitType.java etc.
    UnmarshallingCode:
    JAXBContext jc = JAXBContext.newInstance("com.myproject.unitinfo");
    Unmarshaller unmarshaller = jc.createUnmarshaller();
    unmarshaller.setValidating(true);
    String filename = JOptionPane.showInputDialog("Filename:");
    OrganizationalUnit unit = (OrganizationalUnit)unmarshaller.unmarshal(new FileInputStream( filename ) );
    System.out.println("Participant ID:" + unit.getUnitID() );The above code generates the following error:
    ClassCastException caught.
    com.iwise.process.jaxb.unitinfo.impl.OrganizationalUnitImpl
    java.lang.ClassCastException: com.iwise.process.jaxb.unitinfo.impl.OrganizationalUnitImpl
         at com.iwise.process.test.TestClient.saveParticipant(TestClient.java:58)
         at com.iwise.process.test.TestClient.main(TestClient.java:33)
    TIA, Claire

    What was wrong with your package structure? I'm running into a similar problem where one XML doc/schema combo parses great, but another throws the java.lang.ClassCastException.

  • JAX-WS binding files problem

    Hi,
    I'm trying to generate client code from WSDL with wsimport maven goal. I can generate the code, but I have this specific problem which I'm trying to solve by jaxb and jaxws external binding files.
    In my src/main/resources/wsdl directory I have
    - three WSDL files (let's say A.wsdl, B.wsdl, C.wsdl)
    - two XSD files(X.xsd, Y.xsd)
    All these files share the same targetNamespace.
    A.wsdl includes X.xsd through
    <xsd:include schemaLocation="X.xsd" />
    B.wsdl and C.wsdl include Y.xsd in the same manner.
    Since X.xsd and Y.xsd types are generated into one package, the ObjectFactory is overwritten.
    I'd like to generate X.xsd types into one package and Y.xsd types into another. I've not been able to exploit jaxb and jaxws binding to do that.
    Is this possible when X.xsd and Y.xsd have the same targetNamespace?
    The idea is shown in this binding file (it's not correct, but I've tried many combinations of these declarations without success)
    <jaxws:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
         xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <jaxb:bindings shcemaLocation="../main/resources/wsdl/X.xsd">
              <jaxb:schemaBindings>
                   <jaxb:package name="package_x" />
              </jaxb:schemaBindings>
         </jaxb:bindings>
         <jaxb:bindings shcemaLocation="../main/resources/wsdl/Y.xsd">
              <jaxb:schemaBindings>
                   <jaxb:package name="package_y" />
              </jaxb:schemaBindings>
         </jaxb:bindings>
    </jaxws:bindings>
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi Ram Swami,
    When I try to add services reference by using this:
    https://www.sunat.gob.pe/ol-ti-itcpgem-beta/billService?wsdl, it generates a baiscHttpBinding in my client config file, so could you please try to use the baiscHttpBinding in your client config file for instead to see if it works? The following article
    is about accessing Java service(Jax-WS) from C#.net, please try to check it:
    http://gayandenzil.blogspot.jp/2012/07/write-web-service-using-jax-ws-and.html .
    Besides, this forum is used to discuss the questions about the WCF Web Service, for the questions about the others web services, please try to post in this forum:
    http://forums.asp.net/28.aspx/1?WCF+ASMX+and+other+Web+Services .
    Thanks for your understanding.
    Best Regards,
    Amy Peng
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • PI 7.1 Operation mapping - Multiple message mapping - one to many issue

    Dear Experts,
    I am facing this issue in PI 7.1 and I beleive i did similar one in PI 7.0 successfully.
    I have an operation mapping with two message mappings.
    The occurence of source message of operation mapping is 1
    The occurence of target message of operation mapping is 0..unbounded
    Corresponding i configured two message mappings
    For message mapping-1
    Source message occurence = 1  and Target message occurence = 1
    For message mapping-2
    Source message occurence = 1  and Target message occurence = 0...unbounded
    When i test message mappings individually they are working good. But when i test it in operation mapping, the operation mapping is not working..as it is not able to convert single occurence output of message mapping -1 to the second message mapping-2.
    Any suggestions?
    Thanks.

    The message that i get when testing in operation mapping:
    Runtime Exception when executing application mapping program com/sap/xi/tf/_MM_MessageMapping_1_; Details: com.sap.aii.mappingtool.tf7.IllegalInstanceException; Cannot create target element /ns0:MT_MessageMapping_1_TargetMessageType/RECORDSET. Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD
    My question is, has somebody mapped similar scenario in your environment? If yes, can you please provide details.
    Operation mapping :  1 to 0..unbounded
    Message Mapping1: 1 to 1
    Message Mapping2: 1 to 0...unbounded

  • XBRL Reporting

    I want to load XBRL taxonomy into Oracle GL.
    I visited http://www.xbrl.org/FRTApproved/ --> XBRL US GAAP Taxonomy 2009
    But don't know which files to download for US GAAP taxonomy.
    Can any one tell me which files I should download which can be loaded into Oracle GL?
    Any help is appreciated.
    -Devidas

    Yes I checked that link.
    Under "Taxonomy schema file" there are 4 .xsd files.
    http://taxonomies.xbrl.us/us-gaap/2009publicreview/non-gaap/country-2008-10-31.xsd
    http://taxonomies.xbrl.us/us-gaap/2009publicreview/non-gaap/country-std-2008-10-31.xsd
    http://taxonomies.xbrl.us/us-gaap/2009publicreview/non-gaap/country-ent-2008-10-31.xsd
    http://taxonomies.xbrl.us/us-gaap/2009publicreview/non-gaap/country-all-2008-10-31.xsd
    Then in row "References to other XBRL modules" there are 2 files.
    http://www.xbrl.org/2005/xbrldt-2005.xsd
    http://www.xbrl.org/2006/xbrldi-2006.xsd
    My question is do we need to upload these 6 files?
    -Devidas

  • Web service: parameter types

    Hi,
    We made an ABAP webservice with input parameters.
    In the WSDL the type of the parameters is:
    - <wsdl:message name="ZTestWebService2">
    <wsdl:part name="Costcenter" type="n0:char10" />
    The type ‘char10’ is defined like:
    - <xsd:simpleType name="char10">
    - <xsd:restriction base="xsd:string">
      <xsd:maxLength value="10" />
      </xsd:restriction>
      </xsd:simpleType>
    Question is: is there a way to influence the creation of this types, so that the type is not referring to ‘n0:char10’ but to something like ‘char’ and that the length is also defined in the part name ? Something that is more Java friendly and will not create code for complex types on the client-side ?
    Thanks,
    Rolf.

    HI,
    No u cant change this parameter dynamically after the release of web service.
    When u will release the webservice for a RFC,the WSDL file will be generated.That time it will generate the files for every parameter types which are used in the RFC.
    If u want increase this value length,Then u hv to increase the lenght of the parameter in RFC and then release the web service.So that it will come here.
    Bcause in webservice lenght will not allow more that the lenghth which u gave in RFC.
    Regs
    Manas Ranjan Panda

Maybe you are looking for

  • My Macbook Pro is running very slow-what's going on?

    Problem description: My Mac Pro is running really slow. The little pinwheel is constantly going. I checked my storage on the computer and I still have 319 GB left. What’s going on? EtreCheck version: 2.1.8 (121) Report generated March 24, 2015 9:28:3

  • How to add blank line below the table/row whenever there is no data

    Hello Everyone, I have a table in my report template like below:- Children / Dependents: Name / Comments: Grandchildren: Name / Comments: Son John Daughter Smith Daughter Laura Son Kevin Son Bill None NA When i run the report I need to achieve the fo

  • Automatic Workflow Customisation

    Hi, I have a question related to EHSM system configuration. I have read in a configuration document that during Automatic Workflow Customisation the following setting is required to be done. In SWU3 T Code, Under Maintain Defination Environment, ther

  • How do I get in touch with somebody from the iTunes store?

    I'm in a band called Boys Night Out, and we recently released a digital EP called "Fifty Million People Can't Be Wrong" through the iTunes store. The first track on the release has been titled improperly and I'm curious as to how I would go about hav

  • Avoiding attributes when using transform class

    Hi, One more help pls!!!!! When I use transform class and create an XML file, it creates with attributes for the nodes. For exapmle, <MessageOwner type="type" name="name"> How do I avoid this type and name attributes????? Thanx and Regards, Gayathri.