Dynamic declaration of XSD datatype in Java

Hi,
I am writing a dynamic client for invoking web service solely based on the information from their wsdl documents. Suppose the service uses some customized datatype defined with XSD. Assume I have those datatypes in Java class already. Now I can parse the wsdl document to get the name of a specific datatype of an input part. But how can I declare an object of that datatype in Java with the name of that datatypestored in a variable? One possible solution is to compare it against all possible datatype names, like
if (name.equals("string") {
String myObject = new String();
}else if (name.equals("integer") {
Integer myInteger = new Integer();
But obviously this isn't a practical solution since thedatatypes are so many, not even mention user defined ones.
Can anyone giveme some suggestion? Thanks a lot.
Yu

Class.forName(String name)
The Java Tutorial� - Trail: The Reflection API

Similar Messages

  • Dynamic Declarative Component managed bean returned null

    Hi,
    In a project from an application a DDC component is defined. This component uses a managed/backing bean with view scope.
    Using this component inside this project is working fine. This component should be used in other view controller projects, and here where the problems are.
    This project(let's call it Common) is deployed as ADF Library jar, and used in the other V-C projects.
    The big problem is that the managed bean defined for the logic of this component is not 'reacheable'.
    (Another problem is that the attribute value is not seen as its EL expression but as string, for this i found a workaround.)
    In project Common the adfc-config.xml file:
    <adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
      <managed-bean id="__4">
        <managed-bean-name id="__2">ExtendedShuttle</managed-bean-name>
        <managed-bean-class id="__1">com.xyz.portal.taskflow.common.extendedshuttle.ExtendedShuttle</managed-bean-class>
        <managed-bean-scope id="__3">view</managed-bean-scope>
      </managed-bean>
    </adfc-config>A part from component declaration:
          <af:table var="row" rowBandingInterval="0" id="ta"
                                  rowSelection="multiple" columnStretching="last"
                                  disableColumnReordering="true" fetchSize="-1"
                                  binding="#{viewScope.ExtendedShuttle.allItemsTable}"
                                  value="#{viewScope.ExtendedShuttle.allModel}"
                                  partialTriggers="::dc_cb5 ::dc_cb3"
                                  filterVisible="true"/>The root exception is :
    javax.el.PropertyNotFoundException: Target Unreachable, 'ExtendedShuttle' returned null
    This exception is throw on com.sun.faces.application.ApplicationImpl.createComponent when *#{viewScope.ExtendedShuttle.allItemsTable}* is evaluated.
    Caused By: javax.faces.FacesException: javax.el.PropertyNotFoundException: Target Unreachable, 'ExtendedShuttle' returned null
         at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:262)
         at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:222)
         at javax.faces.webapp.UIComponentClassicTagBase.createFacet(UIComponentClassicTagBase.java:510)
         at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:661)
         at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1142)
         at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.doStartTag(UIXComponentELTag.java:70)
         at oracle.adfinternal.view.faces.taglib.UIXTableTag.doStartTag(UIXTableTag.java:41)
         at oracle.adfinternal.view.faces.unified.taglib.data.UnifiedTableTag.doStartTag(UnifiedTableTag.java:50)
         at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:50)
    Caused By: javax.faces.FacesException: javax.el.PropertyNotFoundException: Target Unreachable, 'ExtendedShuttle' returned null
         at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:262)
         at javax.faces.webapp.UIComponentELTag.createComponent(UIComponentELTag.java:222)
         at javax.faces.webapp.UIComponentClassicTagBase.createFacet(UIComponentClassicTagBase.java:510)
         at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:661)
         at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1142)
         at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.doStartTag(UIXComponentELTag.java:70)
         at oracle.adfinternal.view.faces.taglib.UIXTableTag.doStartTag(UIXTableTag.java:41)
         at oracle.adfinternal.view.faces.unified.taglib.data.UnifiedTableTag.doStartTag(UnifiedTableTag.java:50)
         at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:50)
    Caused by: javax.el.PropertyNotFoundException: Target Unreachable, 'ExtendedShuttle' returned null
         at com.sun.el.parser.AstValue.getTarget(AstValue.java:88)
         at com.sun.el.parser.AstValue.setValue(AstValue.java:133)
         at com.sun.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:255)
         at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:259)
    Can you help figure it out, why is not working or why the managed bean is not visible in other projects but only in the one where the component is defined?
    Thank you for your time,
    Bogdan
    ps: how can i format the source code, on this fourm?

    Hi Frank,
    Thank you for the answer.
    I must say i'm quite new with ADF technology and maybe my questions are silly.
    Here is a Quote from "Oracle Fusion Developer Guide - Building Rich Internet Application with Oracle ADF" by Frank Nimphius and Lynn Munsinger Chapter 15 page 498:
    "You build dynamic declarative components *instead* of tag library based declarative components, if component resuse is required *only within the application* that has the component defined."
    Maybe i misunderstand the meaning of application from this sentence, but i need this component in several ViewController projects from only one application (ADF application).
    Tag lib declarative component I would not like to have, since the (automtically) build process is not my responsability and it will take some time till is pinpointed, but still is a last resort.
    Anyway two things are strange:
    1. Why the component is still available in other projects(and the beans not)?
    2. Why when a binding variable (for example: of type FaceCtrlHierBinding) has the correct type in the declarative project and in the order projects is of type String and its value is the variable name?
    Example:
    <af:declarativeComponent ...
    AllItems="#{bindings.Action}"
    In project where the component is declared its value is an instance of FacesCtrlHierBinding and in the rest of the projects is of type String with value "Action".
    Once again thank you a lot,
    Bogdan

  • Dynamic declarative component won't work properly within table row

    Hi guys,
    I built a dynamic declarative component which basically consists of an af:inputText surrounded by a af:panelLabelAndMessage tag.
    The component works fine until I put it inside a table column, then none of the attribute values get set.
    The problem seems to be related to the table row binding #{row.binding.Name.inputValue} , if I use a regular binding #{binding.Name.inputValue} it works ok.
    The declarative components attribute is defined as
    <attribute>
        <attribute-name>kbez</attribute-name>
        <attribute-class>java.lang.Object</attribute-class>
    </attribute>and is used as the inputText's value attribute
    <af:componentDef var="attrs" componentVar="component">
        <af:panelLabelAndMessage label="#{attrs.label}" id="dc_plam1"
                                 for="dc_it1" labelStyle="white-space:nowrap;"
                                 showRequired="#{attrs.showRequired}"
                                 rendered="#{attrs.rendered}">
            <af:inputText id="dc_it1" value="#{attrs.kbez}"
                          autoSubmit="true" immediate="false" ...>The component inside a table column is set like this
    <af:declarativeComponent viewId="/WEB-INF/ikb.adf.kreda.basis/mitarbeitersuche/ddc/mitarbeiterLOV.jsff"
                             id="ddc1" label="Mitarbeiter"
                             kbez="#{row.bindings.Kbez.inputValue}"/>My JDeveloper version is 11.1.1.5.
    Am I doing it wrong or is this a bug?
    Any help is appreciated.
    Thank you,
    Achim
    Edited by: Achim Rosenfeld on Mar 8, 2013 8:41 AM

    Hi,
    +#{row.binding.Name.inputValue} , if I use a regular binding #{binding.Name.inputValue} it works ok.+
    Don't think that #{binding.Name.inputValue} works okay in a table because it doesn't stamp the component per row. Actually I don't know if we support dynamic declarative components in a stamped environment (table). I know though that we don't for taglib declarative components in this context.
    Reason why it doesn't work: Tables are stamped at runtime, which means that for better performance, only the generated HTML is reused for each row with different data - not the component. Your component requires itself to be re-created for each row so it can re-read the attribute again. This is not the case in a stameped environment
    Solution: For your particular use case I don't think that a dynamic declarative component is needed as you can add the construct (af:inputText surrounded by a af:panelLabelAndMessage) directly into an af:column tag. The declarative component makes more sense for reuse of layout areas (e.g. custom tabs) that are iterated within an af:forEach (in which case instances of the decalarative components would be created).
    Bottom line: tables stamp their components and as such the attribute property exposed on a DDC doesn't seem to be called for each row, which is by design. This can be considered a bug if there is a use case demanding for a DDC in a table. If this is a requirement for you (and you can't directly add the components to the af:column tag) feel free to file this as a service request with customer support (required a support contract) so development can have a look if the requirement is feasible to implement.
    Frank

  • Dynamic Declare Component cannot find property

    We currently have one main page calls a DDC(Dynamic declarative component) page fragment to create/update a record in database. The main page pass in a key to DDC when it loads DDC. The DDC binds to a view object with bind variable (get value from the passed key and load data from table) and several LOV attributes. Once user clicks submit button in main page, we wish that all the fields displayed in DDC could be committed to a database table to save.
    I use 11.1.1.5.
    In order to assign the bind variable of VO, we wrote a method in Application Module and make it invoked as the first executable when the main page is loaded. The deployment is fine. However, the runtime always thrown some exception to complain it cannot find property definition like this:
    ####<Aug 15, 2011 6:32:24 PM CDT> <Warning> <oracle.adfinternal.view.faces.lifecycle.LifecycleImpl> <curmailts1-corp> <AdminServer> <[ACTIVE] ExecuteThread: '2' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <6b1af60b3a40d50a:-6c52e935:131cfc2d522:-8000-000000000000024c> <1313451144494> <BEA-000000> <ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase RENDER_RESPONSE 6
    javax.el.PropertyNotFoundException: Target Unreachable, 'WorkDescription' returned null
         at com.sun.el.parser.AstValue.getTarget(Unknown Source)
         at com.sun.el.parser.AstValue.isReadOnly(Unknown Source)
         at com.sun.el.ValueExpressionImpl.isReadOnly(Unknown Source)
         at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer._getUncachedReadOnly(EditableValueRenderer.java:486)
         at oracle.adfinternal.view.faces.renderkit.rich.EditableValueRenderer.cacheReadOnly(EditableValueRenderer.java:416)
         at oracle.adfinternal.view.faces.renderkit.rich.LabeledInputRenderer.beforeEncode(LabeledInputRenderer.java:128)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:334)
         at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:767)
         at javax.faces.component.UIComponent.encodeAll(UIComponent.java:937)
         at org.apache.myfaces.trinidad.render.CoreRenderer.encodeChild(CoreRenderer.java:399)
         at oracle.adf.view.rich.render.RichRenderer.encodeChild(RichRenderer.java:2633)
    Questions: 1) Why my method in Application Module not called?
    2) Whether DDC is a right solution for our use case? Any suggestion or sample are welcomed!
    Thanks,

    Hi,
    I appreciate if you can show your code, but before that, make sure if you're following this tip below:
    "Declarative Components are regular JSF components except that they are built as a composite out of existing ADF Faces components. Declarative components cannot have a PageDef file associated with it and instead use value or method attribute to communicate with the consuming page. When creating a declarative component, the attrs implicit object is defined that allow you to reference the component's exposed value attribute from ADF Faces components within.
    An input text field contained in an declarative component may reference a value attribute "compValue" defined on the declarative component by using the following EL
    #{attrs.compValue}
    The declarative component compValue attribute then would us an EL reference like shown next to read/write values from or to the ADF binding layer:
    #{bindings.attribute_name.inputValue}"
    (Oracle ADF Code Corner)
    Regards,

  • Dynamic sizing of RAW datatype

    Hi All,
    I want to read BLOBs out of a table using the DBMS_LOB package
    I would like to do something like...
    my_blob_length := DBMS_LOB.GETLENGTH(my_blob);
    DECLARE
    my_buffer RAW(my_blob_length); -- this is the bit I'm stuck with ;-)
    DBMS_LOB.READ(my_blob, my_blob_length, 0, my_buffer);
    But I don't know how to dynamically size the RAW buffer. Any advice gratefully received.
    Cheers,
    Ewan

    But I don't know how to dynamically size the RAW buffer. Any advice gratefully received.The only way (I can think of) that you can dynamically declare length, precision, or scale for a PL/SQL variable is to do within an anonymous PL/SQL block of Native Dynamic SQL.
    Doing this is probably more of a headache than it is worth - very impractical to code/debug/maintain/scale.
    Michael

  • "Dynamic Declaration/Variable"

    Hi,
    first sorry for my bad english :)
    I have a Problem with Forms Builder 6
    I want to know if it possible to set dynamic declarations inside a loop
    loop_i := 1;
    WHILE loop_i < 10 LOOP
    go_item('GERAET' || to_char(loop_i) || '.Beginn'); --Geraet1.Beginn to Geraet10.Beginn... this works without problems
    if (':GERAET'||to_char(loop_i)||'.Beginn') is null then
    :GERAET || to_char(loop_i) || .Beginn := ('01-JAN-1234'); -- here is my problem
    END LOOP;
    My Problem is in this Line :GERAET || to_char(loop_i) || .Beginn :=
    I cant fill fields dynamic like this. Is there any way to fill Geraet1.Beginn to Geraet10.Beginn with this Loop? I dont know the syntax for declarations with " : " and a dynamic variable
    i hope you understand what i mean :)

    Use the Name_In() and Copy() built-ins (see the online doc)
    Francois

  • XMLBeans: Mapping xsd:int to Java int

    hello,
    I have the following problem with the XMLBean xsd:int to Java Mapping:
    An xsd:int element maps to the Java type int, in the normal case this mapping is ok. But when the xsd:int element is defined as nilable="true" or minoccurs="0" shouldn't it be mapped to the Java Class Integer (because there is no null value for Java int)?
    Is there a way to change the XMLBean mapping to the Integer Class in that case?
    thanks for your help!
    Edited by: mriedo on Jun 10, 2008 2:37 AM
    Edited by: mriedo on Jun 10, 2008 3:22 AM

    Hi danielamadei,
    I'm assuming you are using a project with the schema builder facet enabled. If so, this can be done by using adding an xsdconfig file to your schemas folder with contents like the following:
    ==someFile.xsdconfig==
    <?xml version="1.0" encoding="UTF-8"?>
    <xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config">
    < ! - - (comments get hidden)  this will change the package from noNamespace to foo.bar.baz when no namespace exists -->
    <xb:namespace uri="##any">
      <xb:package>org.openuri.easypo.xsdconfig</xb:package>
    </xb:namespace>
    < ! - - (comments get hidden) this is an alternate way to do this -->
    <xb:namespace>
        <xb:package>foo.bar.baz</xb:package>
    </xb:namespace>
    < ! - - (comments get hidden)  this will change the package name for all elements and types in the namespace http://some.namespace -->
    <xb:namespace uri="http://some.namespace">
        <xb:package>bam.bazzle</xb:package>
    </xb:namespace>
    </xb:config>==
    Here is a link to the xmlbeans FAQ on the subject
    http://wiki.apache.org/xmlbeans/XmlBeansFaq#configPackageName
    Hope this helps,
    -jacobd
    Edited by jacobd at 09/06/2007 4:06 PM

  • Dynamic Declaration

    Hi
    I was looking into a poosibility of making a dynamic declaration refercing a formal parameter. is it possible. below is my code:
    FORM WRITE_DATA  USING P_TYPE   P_SNAME.
      CREATE DATA p_type TYPE (P_SNAME).
    ENDFORM
    Can you pls let me know on how to acheive it

    Hi Prabhu,
    if i understood you correctly, it's not possible what you like to do, because
    create data just gives you a pointer like for the above example, then you can assign the pointer to
    a field symbol that takes over the type of s_name then.
    I'm not sure, but i think what you need is the class
    CL_APAP_TYPEDESCR and it's subclasses like
    CL_ABAP_TYPEDESCR
    --CL_ABAP_DATADESCR
    --CL_ABAP_ELEMDESCR
    --CL_ABAP_REFDESCR
    --CL_ABAP_COMPLEXDESCR
    --CL_ABAP_STRUCTDESCR
    --CL_ABAP_TABLEDESCR
    --CL_ABAP_OBJECTDESCR
           |--CL_ABAP_CLASSDESCR
           |--CL_ABAP_INTFDESCR
    I think it's able to make dynamic declarations like you need then, but i never
    needed it and never used it.
    Kind Regards
    Henner

  • Float value not coming for xml where in xsd datatype is double

    Dear Nandy, Previously i faced same error. Then I Chaned the data type "Double into String i changed in the xsd". Or  "Double into Integer also it will work"  Please changed the data type then run it.  Please let me know. Thanks & RegardsKasireddy+966545281845

    We are using xml as source and xml parser is used. In xsd datatype is double but where in xml value is like-100.0 but after xml parser value is coming 100 though datattype is double. I can see scale is 0. Can anybode tell me how to increase  scale in xml parser or any other way to solve this. Thanks.

  • What happens to dynamically declared variables when I'm not using them?

    Hello, I'm making a game using Flash Pro cc. But I wonder what happens to aTile, which is dynamically declared MovieClip variable through a loop. And each aTile gets the 2 EventListener's.
    for(var i:Number=0; i<pVector.length;i++){
        var aTile:ATile=new ATile();
        aTile.x=pVector[i].x;
        aTile.y=pVector[i].y;
        aTile.gotoAndStop(Math.ceil(Math.random()*Color));
        nVector.push(aTile);
        Spr.addChild(aTile);
        aTile.addEventListener(MouseEvent.CLICK,Clicked,false,0,true);
        aTile.addEventListener(Event.COMPLETE, stop,false,0,true);
         // the current function ends here. what happens to aTile now ?? Is it going to be garbage collected? By the way, this piece of code runs whenever a player starts a new level of my game. And I don't make use of the aTile variable in other functions. I use only the nVector variable. And does declaring a dynamic variable in a loop mean a multiple of them are created? For example, if I loop the piece of code above 5 times, does it mean 5 aTile variables are created? Or each time you declare
    var aTile:ATile=new ATile(); again, does it replace the 'old' aTile with the 'new' aTile and therefore only 1 aTile exists after the loop????

    I feel there is a gap in understanding of using variables by reference vs. by value. You should look it up.
    1. new instructs Flash to create a distinct instance that per se has absolutely nothing to do with aTile variable.
    2. REFERENCE to this new instance is assigned to variable aTile. aTile var is a temporary pointer to instance.
    3. It does not replace old tile - it replaces reference.
    4. If reference to the instance is not stored elsewhere - upon exiting of function this instance will be gced.
    5. By creating another reference to the instance you prevent it from GC. One of the ways you preserve instance is by adding it to display list when using addChild.
    You can look at this this way (it is a lame example but still it illustrates parts of the concept)
    Say you have
    1. basket;
    2. basket is small and can hold only one apple;
    3. table;
    4. an apple;
    5. apple can be placed into the basket or table;
    6. dog who love apples.
    7. Dog is trained not to take apples from baskets but table but is free to eat apples that are on the ground.
    So, once apple is in the basket or on the table - it is safe.
    If you move these entities into the realm of AS3, basket and table become declared variables, apple an instance and dog garbage collector.
    What this example demonstrates is that apple exists independently of basket or table. You can put apple to the basket OR on the table OR you can put apple into basket and place basket onto the table.
    1. Find apple instance (if you know whether apple is in the basket, on the table or in the basket on the table)
    2. Prevent dog from eating apple.
    3. Allow dog to eat it (destroy it when garbage collector kicks in) by assuring that apple is in neither basket or on the table.

  • Dynamic imports of xsd

    Is it possible in BPEL to dynamically import an xsd? If i have a string containing the location (locally) of that xsd or a url passed in as a variable, can I then import this schema and define a variable of that schema type?
    Thanks for your help.

    private static Document loadXSD(String xsdFileID) throws SAXException, IOException {
         String documentName = "com/...youpackage..../"+xsdFileName+".xsd";
         Class c=null;
         try{
              c = Class.forName("load your class");
         }catch(Exception e){
              System.out.println(e.getMessage());
         InputStream instream = c.getClassLoader().getResourceAsStream(documentName);
             InputSource inputsrc = new InputSource(instream);
             DOMParser xParser = new DOMParser();
             xParser.parse(inputsrc);
             Document xDoc = xParser.getDocument();
         return xDoc;
    }

  • How to read and XSD file in java prospective in NWDS

    Hi !!
    anybody can help me that
    how to read and XSD file in java prospective in Netweaver developer Studio
    Regards
    Abhishek Agrahari

    I guess you can make it more clear...

  • Problem with XSD validation in Java 5

    Hi everyone,
    my application creates in memory schema using JDOM. In Java 6 validation runs fine, but in Java 5 (which is the target platform currently) it fails.
    I tried a second test with just parsing an existing XSD document (not created using JDOM) and that works.
    The textual representation of both (file and JDOM generated) are identical. If I replace the XSD file with the JDOM output, the "file test" runs fine, too.
    Here's the test code:
        protected void assertXsdValid(Source xsdSource, InputSource xmlInputSource) throws SAXException, ParserConfigurationException, IOException {
            isValid = true;
            SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
            sf.setErrorHandler(myErrorHandler);
            Schema schema = sf.newSchema(xsdSource); // <<--------- THIS LINE FAILS IN JAVA 5
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setNamespaceAware(true);
            dbf.setSchema(schema);
            DocumentBuilder db = dbf.newDocumentBuilder();
            db.setErrorHandler(myErrorHandler);
            db.parse(xmlInputSource);
            assertTrue(isValid);
        }This is the XSD:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://some.org/metamodel" elementFormDefault="qualified">
      <xs:element name="system">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="name" type="xs:string" />
            <xs:element name="vendor" type="xs:string" />
            <xs:element name="version" type="xs:decimal" />
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>This is the error message I get:
    ERROR: org.xml.sax.SAXParseException: s4s-att-invalid-value: Invalid attribute value for 'type' in element 'element'. Recorded reason: UndeclaredPrefix: Cannot resolve 'xs:string' as a QName: the prefix 'xs' is not declared.
    This is how I call the test code in the JDOM test:
            assertXsdValid(new JDOMSource(xsdDoc), new JDOMSource(xmlDoc).getInputSource());If I change the code to parsing not the JDOMSource, but a StreamSource reading the textual representation of the XSD, it works fine!
            assertXsdValid(new StreamSource(new ByteArrayInputStream(new XMLOutputter().outputString(xsdDoc).getBytes())), new JDOMSource(xmlDoc).getInputSource());But this is not what I want (I expect suboptimal performance with large XSD documents). So, if it works with Java 6, then why doesn't it work with Java 5?
    How can I use the Java 6 JAXP in Java 5?
    Thank you.

    A new user name?
    I can think of ways round your problem but can you first provide a reference that indicates that byte 0x80 is the MS936 encoding for the Euro?
    P.S. This is a forum and the vast majority of participants, including me, have no direct relationship with Oracle so getting definitive answers from Oracle via this forum is unlikely. If you think you have found a bug in 1.5 and/or 1.6, and I am not convinced you have, you need to report it via the bug database. If it is a bug then the response time for a fix is likely to be months rather than days.
    P.P.S No I can't explain why it works in 1.7!

  • Dynamic  Introspection of XSD

    Is there a package/class or open source supporting dynamic introspection of an XML schema? I know there are mechanisms for statically binding Java to XML, but I want/need to dynamically introspect/traverse the schema.

    private static Document loadXSD(String xsdFileID) throws SAXException, IOException {
         String documentName = "com/...youpackage..../"+xsdFileName+".xsd";
         Class c=null;
         try{
              c = Class.forName("load your class");
         }catch(Exception e){
              System.out.println(e.getMessage());
         InputStream instream = c.getClassLoader().getResourceAsStream(documentName);
             InputSource inputsrc = new InputSource(instream);
             DOMParser xParser = new DOMParser();
             xParser.parse(inputsrc);
             Document xDoc = xParser.getDocument();
         return xDoc;
    }

  • Return CLOB datatype to Java

    Hello,
    Does anyone have any examples of how a CLOB datatype can be returned from a stored procedure and used in java?
    Currently we are building up strings and returning a VARCHAR2 datatype, but are running into the 32k size restriction as some of the strings are too long.
    It seems that converting the strings to CLOBs and then returning is the best solution. Has anyone had a similar problem and solved it?
    Regards,
    Eoin

    Create stored procedure like this :
    create or replace procedure getclob(var out clob) as
    str varchar2(20);
    templob CLOB;
    begin
    str :='mystring';
    DBMS_LOB.CREATETEMPORARY(templob, TRUE, dbms_lob.session);
    dbms_lob.write(templob,length(str),1,str);
    var :=templob;
    DBMS_LOB.FREETEMPORARY(templob);
    end;
    java program to call above stored procedure
    import java.sql.*;
    import oracle.jdbc.driver.*;
    class SPLobInJava
    public static void main(String args[]) throws Exception
    DriverManager.registerDriver(new
    oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@insn104:1521:ora9idb", "scott", "tiger");
    CallableStatement cs;
    cs = conn.prepareCall("{call getclob(?)}");
    cs.registerOutParameter(1,java.sql.Types.CLOB);
    cs.execute();
    Clob clob =cs.getClob(1);
    // do whatever you want with the clob
    System.out.println(clob.getSubString(1,5));
    cs.close();
    conn.close();
    }

Maybe you are looking for