OracleXMLQuery getXMLDOM()

What is wrong with this code?
import oracle.xml.parser.v2.*;
import oracle.xml.sql.query.*;
OracleXMLQuery qry = new OracleXMLQuery( conn, "some simple select statement");
qry.setMaxRows(1);
XMLDocument xmlDoc = qry.getXMLDOM();
Error: (40) incompatible types; found: org.w3c.dom.Document, required: oracle.xml.parser.v2.XMLDocument.
Oracle 8.1.5
XMLParser v2.0.2.10
JDeveloper 3.1
TIA
Owen Thomas

getXMLDOM() returns an org.w3c.dom.Document so assigning it to a variable of type oracle.xml.parser.v2.XMLDocument
import org.w3c.xml.Document;
Document d = getXMLDOM(...);
XMLDocument xd = (XMLDocument)d;
:

Similar Messages

  • Oracle.xml.sql.OracleXMLSQLException when using OracleXMLQuery getXMLDOM()

    Hi!
    I am trying to reuse a code in JDeveloper to get XML from a query. I have copied the code from a method and created a new method with the copied code and changed it. The problem is that when I run the old code I now get following error:
    Ett oförväntat fel har inträffat: Application: FND, Message Name: FND_GENERIC_MESSAGE.
    Tokens: MESSAGE = oracle.xml.sql.OracleXMLSQLException: Det här objektet har stängts.
    Vill du inte att objektet ska stängas automatiskt mellan anropen kan du granska metoden 'keepObjectOpen()'.;
    This means in english something like:
    An unexpected error accoured: Application: FND, Message Name: FND_GENERIC_MESSAGE = oracle.xml.sql.OracleXMLSQLException: This object is closed. If you don't want the object to close automatically between calls you can check method 'keepObjectOpen()';
    the code I'm running is:
    public String punchoutSomething()
    throws Exception
    StringBuffer sqlForXml =new StringBuffer("select pv.*"
    +", cursor(select * from XXPOS_PUNCHOUT_TABLE2 c where c.vendor_id=pv.vendor_id) as contacts"
    +" from XXPOS_PUNCHOUT_TABLE1 pv where vendor_id in (");
    // add all ids
    SuppSummVOImpl vendorView = getSuppSummVO();
    Row row;
    int punchoutCnt=0;
    // vendorView.reset();
    Row[] selectedRows = vendorView.getFilteredRows("SelectStatus","Y");
    for(int i=0;i<selectedRows.length;i++)
    if(punchoutCnt>0)
    sqlForXml.append(",");
    sqlForXml.append(((Number)selectedRows.getAttribute("VendorId")).toString());
    punchoutCnt++;
    if(punchoutCnt==0)
    sqlForXml.append("-1"); // make sql valid, will not return rows
    sqlForXml.append(")");
    // System.out.println(sqlForXml); // DEBUG
    OADBTransaction tx = (OADBTransaction)getOADBTransaction();
    OracleXMLQuery xq = new OracleXMLQuery( tx.getJdbcConnection()
    , sqlForXml.toString()
    xq.setRaiseException(true); // in case of error raise an exception (default
    // is to generate an error document
    xq.setEncoding("UTF-8"); // not necessary?
    xq.useLowerCaseTagNames();
    xq.setRowsetTag("vendors");
    xq.setRowTag("vendors_row");
    //System.out.println(xq.getXMLString()); // DEBUG
    XMLDocument suppl = (XMLDocument)xq.getXMLDOM();
    XSLProcessor xslt = new XSLProcessor();
    InputStream sheetStream = this.getClass().getResourceAsStream("mystylesheet.xsl");
    if(sheetStream==null)
    throw new Exception("Could not load stylesheet");
    XSLStylesheet sheet = xslt.newXSLStylesheet(
    sheetStream
    StringWriter serialize = new StringWriter();
    xslt.processXSL(sheet,suppl,new PrintWriter(serialize));
    String returnXML = serialize.getBuffer().toString();
    // System.out.println("X:"+returnXML); // DEBUG
    sheetStream.close();
    return returnXML;
    ===================
    i've copied the same code into another method and only changed the sql-statment to be used and the stylesheet to use to transform the xml. Is something wrong with that?
    Another question: if the xsl refers to a xsd but wihtout any path where should it be?
    Thanks for the help,
    Patricia

    Actually, having looked at Metalink, seems that although this message may be accurate and correct,
    it has been 'introduced' as part of the 9i JDBC driver.
    So, I used the 8i JDBC driver I happened to have instead and that worked fine.

  • Xsql CURSOR XSQL-017

    Hi everybody.
    I have a problem when I try to run a xsql with my browser.
    I type: http://hostaix433/TremaDesa/XSQL/SEst1.xsql and I get the next message :
    Oracle XDK Java 9.2.0.6.0 Production
    XSQL-017: Unexpected Error Occurred
    java.lang.NoClassDefFoundError: java/util/Map
    at
    at oracle.jdbc.driver.OracleConnection.addClassMapEntry(OracleConnection.java:2849)
    at oracle.jdbc.driver.OracleConnection.addDefaultClassMapEntriesTo(OracleConnection.java:2843)
    at oracle.jdbc.driver.OracleConnection.initializeClassMap(OracleConnection.java:2529)
    at oracle.jdbc.driver.OracleConnection.ensureClassMapExists(OracleConnection.java:2523)
    at oracle.jdbc.driver.OracleConnection.getTypeMap(OracleConnection.java:2829)
    at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:5849)
    at oracle.jdbc.driver.OracleResultSetImpl.getObject(OracleResultSetImpl.java:765)
    at oracle.xml.sql.dataset.OracleXMLDataSetExtJdbc.getColumnTypeObject(OracleXMLDataSetExtJdbc.java:494)
    at oracle.xml.sql.core.OracleXMLConvert.createColNames(OracleXMLConvert.java:1100)
    at oracle.xml.sql.core.OracleXMLConvert.getXML(OracleXMLConvert.java:848)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLDOM(OracleXMLQuery.java:361)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLDOM(OracleXMLQuery.java:308)
    at oracle.xml.xsql.actions.XSQLQueryHandler.handleAction(XSQLQueryHandler.java:246)
    at oracle.xml.xsql.XSQLDocHandler.getDocument(XSQLDocHandler.java:149)
    at oracle.xml.xsql.XSQLPageProcessor.process(XSQLPageProcessor.java:140)
    at oracle.xml.xsql.XSQLServlet.doGet(XSQLServlet.java:60)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
    at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456)
    at org.apache.jserv.JServConnection.run(JServConnection.java:294)
    at java.lang.Thread.run(Thread.java)
    My xsql file :
    <xsql:query connection="bddesa2_trema" xmlns:xsql="urn:oracle-xsql">
    SELECT idse, nombre, modoacceso, nombrepc,
    CURSOR ( SELECT idbus, nombre, puerto, dirdatos, idse
    FROM bus
    WHERE bus.idse = subestacion.idse ) as buses
    FROM subestacion WHERE subestacion.nombre = 'SubTrema'
    </xsql:query>
    I get the error message ONLY when I use de CURSOR statement.
    Somebody could help me?
    Thanks in advanced
    Diego Robatto

    Please refer to the section:Using the CURSOR Operator for Nested Rowsets
    https://myswat.swarthmore.edu/xsql/java/xsql/relnotes.html#ID2602

  • Outofmemory error

    I get the following error sometimes .
    Oracle XSQL Servlet Page Processor 1.0.2.0 (Production)
    XSQL-017: Unexpected Error Occurred
    java.lang.OutOfMemoryError:
    at oracle.jdbc.ttc7.TTIoer.init(TTIoer.java:100)
    at oracle.jdbc.ttc7.Oclose.init(Oclose.java:75)
    at oracle.jdbc.ttc7.TTC7Protocol.close(TTC7Protocol.java:530)
    at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:595)
    at oracle.xml.sql.dataset.OracleXMLDataSetExtJdbc.close(OracleXMLDataSetExtJdbc.java:359)
    at oracle.xml.sql.dataset.OracleXMLDataSetExtJdbc.cursorClose(OracleXMLDataSetExtJdbc.java:838)
    at oracle.xml.sql.core.OracleXMLConvert.convertCursorObject(OracleXMLConvert.java:2144)
    at oracle.xml.sql.core.OracleXMLConvert.convertObject(OracleXMLConvert.java:2023)
    at oracle.xml.sql.core.OracleXMLConvert.convertCursorObject(OracleXMLConvert.java:2138)
    at oracle.xml.sql.core.OracleXMLConvert.convertObject(OracleXMLConvert.java:2023)
    at oracle.xml.sql.core.OracleXMLConvert.convertCursorObject(OracleXMLConvert.java:2138)
    at oracle.xml.sql.core.OracleXMLConvert.convertObject(OracleXMLConvert.java:2023)
    at oracle.xml.sql.core.OracleXMLConvert.convertRow(OracleXMLConvert.java:1925)
    at oracle.xml.sql.core.OracleXMLConvert.getXML(OracleXMLConvert.java:1126)
    at oracle.xml.sql.core.OracleXMLConvert.To_XML(OracleXMLConvert.java:922)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLDOM(OracleXMLQuery.java:322)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLDOM(OracleXMLQuery.java:269)
    at oracle.xml.xsql.actions.XSQLQueryHandler.handleAction(XSQLQueryHandler.java:239)
    at oracle.xml.xsql.XSQLDocHandler.getDocument(XSQLDocHandler.java:129)
    at oracle.xml.xsql.XSQLPageProcessor.process(XSQLPageProcessor.java:140)
    at oracle.xml.xsql.XSQLServlet.doGet(XSQLServlet.java:60)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at com.unify.ewave.servletexec.ServletExec.CallServletService(ServletExec.java)
    at com.unify.ewave.servletexec.ServletExec.processServletRequest(ServletExec.java)
    at com.unify.ewave.servletexec.ServletExec.processServletAlias(ServletExec.java)
    at com.unify.ewave.servletexec.ServletExec.ProcessRequest(ServletExec.java)
    at com.unify.ewave.servletexec.ServletExec.ProcessRequest(ServletExec.java)
    please advise as to what is the problem
    I have also increased the output buffer size
    of servletexe to 2 GB
    thanks
    latha

    I am using ServletExec 3.0 and i have set the output buffer there
    Current JITC: symcjit
    Operating System: Windows NT 4.0 on x86
    Selected Java VM: Sun Classic Sun HotSpot IBMMicrosoft
    JITC: Enabled Disabled
    Minimum Heap Size: 16384 K Bytes
    Maximum Heap Size: 2638400 K Bytes
    Verbose GC: Enabled Disabled
    Verbose: Enabled Disabled
    Class GC: Enabled Disabled
    Security Manager:
    System Output:
    System Error:
    and i am retrieving 30 fields and about 50 rows
    Please help
    latha

  • Problems installing latest XSQL Servlet

    After following the instructions for installing XSQL servlet for Apache with Jserv, I get the following error with a simple sql query.
    Oracle XSQL Servlet Page Processor 9.0.1.0.0 (Production)
    XSQL-017: Unexpected Error Occurred
    java.lang.AbstractMethodError: oracle/jdbc/driver/OracleResultSet.getStatement
    at oracle.xml.sql.dataset.OracleXMLDataSetExtJdbc.(OracleXMLDataSetExtJdbc.java:117)
    at oracle.xml.sql.core.OracleXMLConvert.initObject(OracleXMLConvert.java:345)
    at oracle.xml.sql.core.OracleXMLConvert.getXML(OracleXMLConvert.java:823)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLDOM(OracleXMLQuery.java:364)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLDOM(OracleXMLQuery.java:312)
    at oracle.xml.xsql.actions.XSQLQueryHandler.handleAction(XSQLQueryHandler.java:240)
    at oracle.xml.xsql.XSQLDocHandler.getDocument(XSQLDocHandler.java:132)
    at oracle.xml.xsql.XSQLPageProcessor.process(XSQLPageProcessor.java:134)
    at oracle.xml.xsql.XSQLServlet.doGet(XSQLServlet.java:60)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
    at org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
    at org.apache.jserv.JServConnection.run(JServConnection.java:188)
    at java.lang.Thread.run(Thread.java:475)
    Can anyone help

    I have included the following libs as described in the installation notes
    ie in the jserv.properties file I have
    # Oracle XSQL
    # Oracle XML SQL Utility (XSU)
    wrapper.classpath=C:\xsql\lib\sax2.jar
    wrapper.classpath=/usr/local/src/xdk/lib/xsu12.jar
    # Oracle XSQL Servlet
    wrapper.classpath=/usr/local/src/xdk/lib/oraclexsql.jar
    # Oracle JDBC (8.1.6) -- JDBC 2.0 driver
    wrapper.classpath=/usr/local/src/xdk/lib/classes12.zip
    # Oracle XML Parser V2 (with XSLT Engine)
    wrapper.classpath=/usr/local/src/xdk/lib/xmlparserv2.jar
    # XSQLConfig.xml File location
    wrapper.classpath=/usr/local/src/xdk/xdk/admin
    # FOR Apache FOP Generation, Add
    # wrapper.classpath=C:\xsql\lib\xsqlserializers.jar
    # wrapper.classpath=FOPHOME/fop_bin_0_14_0.jar
    # wrapper.classpath=FOPHOME/lib/w3c.jar
    And in the httpd.conf file I have
    Alias /xsql/ "/usr/local/src/xdk/xdk/"
    Also in the xml config file
    <connection name="promptl">
    <username>******</username>
    <password>******</password>
    <dburl>jdbc:oracle:thin:@192.****:1521:8C</dburl>
    <driver>oracle.jdbc.driver.OracleDriver</driver>
    </connection>
    I think the problem may be with my jdbc file???
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jinyu Wang ([email protected]):
    Have include all the libs like:
    # Oracle XSQL Servlet
    wrapper.classpath=/private/orahome/lib/oraclexsql.jar
    # Oracle JDBC
    wrapper.classpath=/private/orahome/jdbc/lib/classes12.zip
    # Oracle XML Parser V2 (with XSLT Engine)
    wrapper.classpath=/private/orahome/lib/xmlparserv2.jar
    # Oracle XML SQL Components for Java
    wrapper.classpath=/private/orahome/rdbms/jlib/xsu12.jar
    Especially xsu12.jar?<HR></BLOCKQUOTE>
    null

  • XSU expecting oracle/jdbc/OracleConnection

    We're developing a JSF+Spring application using NetBeans 5.5. as the IDE, running under Tomcat (5.5.17), which uses XSU to generate XML from a MySQL database.
    On a linux workstation, the application runs sucessfully under NetBeans using the bundled tomcat server, but the same project built and run on a windows workstation returns java.lang.NoClassDefFoundError: oracle/jdbc/OracleConnection
    at oracle.xml.sql.core.OracleXMLConvert.initObject(OracleXMLConvert.java:365)
    at oracle.xml.sql.core.OracleXMLConvert.getXML(OracleXMLConvert.java:909)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLDOM(OracleXMLQuery.java:414)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLDOM(OracleXMLQuery.java:381)
    at oracle.xml.sql.query.OracleXMLQuery.getXMLDOM(OracleXMLQuery.java:342)
    from the following code
    OracleXMLQuery query = new OracleXMLQuery(getConnection(), sql);
    myClass.setDoc(query.getXMLDOM());
    The getConnection() is from org.springframework.jdbc.core.support.JdbcDaoSupport
    Am I missing some configuration information?
    Thanks
    Andrew

    Re: Anyone able to help me out with this?

  • Converting ResultSet to XML by OracleXMLQuery

    Hello,
    I'm newbie in XML and I have following problem:
    I'm using OracleXMLQuery to convert ResultSet from oracle db to XML document. I'm using getXMLDOM()(from oracle package) to convert this OracleXMLQuery into DOM representation. I can extract node names but all values of the nodes are null's (if I convert the document to string and put it on the screen, the values are connect). Here's my code:
    QracleXMLQuery qry;
    ResultSet rset = (ResultSet)stmt.getObject(1);
    qry = new OracleXMLQuery(conn,rset);
          qry.setRaiseNoRowsException(true);
          qry.setRaiseException(true);
          qry.keepObjectOpen(true);
          qry.useNullAttributeIndicator(true);
    Document d=(Document)qry.getXMLDOM();
            //---to this point all seems to be correct
            // -OracleXMLQuery object stores correct xml document and
            // qry.getXMLDOM() return good Document object
      NodeList nl=d.getElementsByTagName("some_tag_name");
      for(int i=0;i<nl.getLength();i++){
           Node temp=nl.item(i);
           System.out.println(temp.getNodeValue()); //null's
           System.out.println(temp.getNodeName()); //correct name of the string
           }Maybe i'm missing something, as I wrote earlier I'm newbie in XML - I would be very grateful for any help. Thanks in advance!

    Thanks for your reply - it really helped. I have another problem,maybe some of you may help me: I have two DOM documents and I want to join then like this
    Documant a:
    <?xml version = '1.0'?>
    <ROWSET>
         <ROW num="1">
            <attr1>sometext1</attr1>
            <attr2>sometext2</attr2>
            <attr3>sometext3</attr3>
         </ROW>
         <ROW num="2">    
         </ROW>
         <ROW num="3">
         </ROW>
    </ROWSET>Doc b
    <?xml version = '1.0'?>
    <attrib>
      <ROW num="1">
         <atr1>sometext1</atr1>
         <text>othertext1</text>
      </ROW>  
      <ROW num="2">
         <atr2>sometext2</atr2>
         <text>othertext1</text>
      </ROW>
      <ROW num="3">
         <atr3>sometext3</atr3>
         <text>othertext1</text>
       </ROW>
    </attrib>Now I want to insert the whole <attrib>...</attrib> section from document b as a node to document a in for example <ROW num="1">...</ROW> section. I've tried to create Node element form document b (<attrib></attrib>) and use insertBefore() method on Node <ROW num="1"></ROW> but I have a nullpointer exception - well it probably wasn't good idea.I hope my description is clear, I vould be happy for any advice. Thanks in advance

  • OracleXMLQuery not fetching ALL rows

    Problem:
    ======
    For example, if there are 10 rows in the Table, sometimes the XMLQuery sees less than 10 rows. We wrote a small test program with a JDBC query for select count(*) from Table, which always shows 10. So nothing wrong with Connection/Statement settings. They all use DEFAULT settings (READ_COMMITTED, TYPE_FORWARS_ONLY).
    Why does n't XMLQuery see all rows available from the Query?
    Software Version:
    ============
    Oracle 10.1.0.5
    XDK: Oracle XDK 10g
    JAVA 5
    My program:
    =========
    Connection connection = dataSource.getConnection();
    Statement stmt = connection.createStatement(); <-- We tried with TYPE_SCROLL*. Still not working.
    ResultSet rs = stmt.executeQuery("select * from MyTable);
    //1. Query the database with the OracleXMLQuery. Result will be in XML format.
    OracleXMLQuery query = new OracleXMLQuery(connection, rs);
    query.keepObjectOpen(true);
    query.setMaxRows(1); //We don't want to build huge XML DOM for all rows.
    while (rs.next()) { <--- Ideally it should iterate 10 times XMLDocument xmlDoc = (XMLDocument) query.getXMLDOM();          
    System.out.println(xmlDoc);
    if (query.getNumRowsProcessed() > 0) {          
    //Do something here
    Thanks.
    Kanugula.

    I am providing the stack trace. You have more information.
    By the way, what surprises me is "OracleXMLQuery sees 1/2 of the rows only. Means if you have 12 rows, it sees 6 only"
    query= OracleXMLQuery (id=2148)
    conv= OracleXMLConvert (id=2154)
    colCount= 48
    collectTimingInfo= false
    collIdAttrName= null
    collItemTag= "_ITEM"
    colNames= OracleColumnName[48] (id=2376)
    colNamesHash= Hashtable<K,V> (id=2377)
    conn= LogicalConnection (id=2145)
    curCount= 2
    dataHeader= null
    dateFormat= "yyyyMMddhhmmss"
    docTag= null
    docType= 1
    dset= OracleXMLDataSetExtJdbc (id=2378)
    bindPosHash= null
    conn= LogicalConnection (id=2145)
    connUser= null
    cursorCols= int[0] (id=2380)
    dsetList= null
    isConsistent= true
    msg= XSUMesg (id=2166)
    ncharSuported= true
    rmdata= OracleResultSetMetaData (id=2381)
    rowCount= 4
    rset= ScrollableResultSet (id=2147)
    close_statement_on_close= false
    m_allRowsCached= false
    m_autoRefetch= true
    m_beginColumnIndex= 0
    m_cache= OracleResultSetCacheImpl (id=2190)
    m_columnCount= 48
    m_conn= T4CConnection (id=2195)
    m_currentRow= 6
    m_lastRefetchSz= 0
    m_metadata= OracleResultSetMetaData (id=2371)
    m_numRowsCached= 6
    m_refetchRowids= null
    m_refetchStmt= null
    m_rset= OracleResultSetImpl (id=2196)
    m_scrollStmt= T4CStatement (id=2146)
    m_type= 1004
    m_update= 1007
    m_usrFetchDirection= 1000
    m_warning= null
    m_wasNull= 0
    rsetFirstTime= false
    rsetIsExt= true
    rsetVal= true
    sdf= SimpleDateFormat (id=2382)
    stmt= null
    tempS= T4CStatement (id=2146)
    dsetIsExt= false
    DTDString= null
    errTag= "ERROR"
    extException= null
    firstXElemNmIdx= 0
    isNull= "TRUE"
    keepCursor= true
    maxRows= 1
    metaHeader= null
    metaType= 0
    miscFlags= 0
    namesValid= true
    noRowsException= false
    notNull= "FALSE"
    nullAttrId= "NULL"
    objClosed= false
    qstring= null
    raiseException= false
    refAttrName= "REFTYPE"
    rootNodeSupplied= false
    rowCountStr= "num"
    rowIdAttrDt= 2
    rowIdColName= null
    rowIdColNum= 0
    rowsetTag= "ROWSET"
    rowTag= "ROW"
    rset= ScrollableResultSet (id=2147)
    rsetIsExt= true
    skipRows= 0
    styleSheetType= null
    styleSheetURI= null
    tagCase= 0
    tim= null
    tns= null
    updateDateFormat= false
    useColumnLabelAsRoot= false
    useNullAttrId= false
    useTypeForCollElemTag= false
    val= OracleScalarName (id=2379)
    xAttrAfterElem= false
    xAttrIdxs= null
    xElemCnt= 48
    encoding= null
    encSet= false
    xslp= null
    xslt= null

  • XDK getXMLDOM() problem

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import oracle.xml.sql.query.OracleXMLQuery;
    import org.w3c.dom.Document;
    import org.w3c.dom.NodeList;
    I have the following code
    OracleXMLQuery qry = null;
         try{
         qry = new OracleXMLQuery(conn,query);          
         }catch(Exception e){
              System.out.println("XML problem = " + e);
    // structure the generated XML document
    //qry.setMaxRows(2); // set the maximum number of rows to be returned
    qry.setRowsetTag("EMPINFO"); // set the root document tag
    qry.setRowTag("DBROW"); // sets the row separator tag
    // get the XML document in string format
    String xmlString;
         try {
              //xmlString = qry.getXMLString();
              Document xmlDoc = qry.getXMLDOM();
         //System.out.println(" OUTPUT IS:\n"+xmlString);
         //NodeList nodelist = xmlDoc.getElementsByTagName("DBROW");
         NodeList nodelist = xmlDoc.getChildNodes();
         System.out.println("The number of child nodes = " + nodelist.getLength());
    I know the results will have several records(DBROW) but for some reason I only get nodelist length of 1. Am I missing something? I know that the XML is generated but I don' t know if the xmlDoc is generated correctly.
    Any help would be greatly appreciated.
    Message was edited by:
    user539133

    NodeList nodelist = xmlDoc.getChildNodes();
    returns the root document tag EMPINFO, which is only 1 in the XML document.

  • XDK - DTD Generation using OracleXMLQuery

    I have been using (and enjoying) the XDK for the last month. However, I have a problem - I want to generate a DTD for a given RBD table without any associated XML. To date, I have not been able to accomplish this task. I provided a simple example below. When I print the XML using 'qry.getXMLString(true)' the DTD is intact. But, when I generate a DOM from the query and then extract the documentType it contains nulls - In fact, the DTD name is null.
    // Don't care about data, just the DTD
    ResultSet rset = stmt.executeQuery("select * from mytable");
    OracleXMLQuery qry = new OracleXMLQuery(conn,rset);
    qry.setMaxRows(1);
    // OK - prints internal DTD and XML
    System.out.println(qry.getXMLString(true));
    // Get the DOM
    Document doc = qry.getXMLDOM(true);
    DocumentType dt = doc.getDoctype();
    // PROBLEM - Returns null
    System.out.println(dt.getName());
    Thanks for the help.
    Joe

    The DTD class generator supports DOCTYPE. The generate() method "Traverses the DTD with element doctype as root and generates Java classes."
    http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96616/arxml07.htm#1005265

  • Generate nested XML using OracleXMLQuery generates error

    Hello,
    I have oracle 8.1.6 with XSQL 1.0.4 and need to generate XML out of a query that contains the // init the OracleXMLQuery
    OracleXMLQuery qry = new OracleXMLQuery(conn, query);
    // shape the XML doc generated
    qry.setMaxRows(2); // set the maximum number of rows to be returned
    qry.setSkipRows(3); // numbers of rows to skipped
    qry.setRowsetTag("MYDOC"); // set the tags encapsulating the whole doc
    qry.setRowTag("RECORD"); // sets the row separator tag
    qry.setRowIdAttrName("cnt"); // sets the id attribute of the row element
    qry.useNullAttributeIndicator(true); // use attr. to indicate nullness
    qry.useUpperCaseTagNames(); // use upper case tag names
    qry.setErrorTag("ERR"); // tag for errors writen to XML doc
    XMLDocument myXMLDocument = (XMLDocument)qry.getXMLDOM();
    PrintWriter out = response.getWriter();
    myXMLDocument.print(out);
    out.close();null

    I have exactly the same problem by using XSU.
    If somebody solve it already ?
    David, can you please provide more information or small example, how can I extract OracleConnection or Oracle Specific Driver inside the Weblogic App. Server and not generic weblogic.jdbc.rmi.SerialConnection instance.
    I'm using Oracle thinDriver on Oracle8i.
    Thank you in advance.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by David G:
    have seen similar problems with wrapped jdbc driver being passed into Weblogic pool service and then cast back into OracleDriver after getting it back from Weblogic's JNDI DataSource lookup ...the Oracle extensions do not seem to survive Weblogic's jdbc pool services handling. I have gone over to running all my connection pools in Oracle's own namespace jdbc_access:// for JNDI lookups on DataSource pools instead. Much happier. <HR></BLOCKQUOTE>
    null

  • Decode function in OracleXMLQuery

    selectStr = "SELECT DECODE(email,null,'',email), FROM mytable WHERE user_id=\'" + search_id + "\'";
    using this select statement in conjunction with OracleXMLQuery produces the following exception.
    oracle.xml.sql.OracleXMLSQLException: Character ')' is not allowed in an XML tag name.
    any hints why ')' ist not supported?
    null

    solved, renaming the decode function helps
    like
    selectStr = "SELECT DECODE(email,null,'',email) email, FROM mytable WHERE user_id=\'" + search_id + "\'";
    null

  • Null or Empty string  in OracleXMLQuery -  XDK

    Dear all,
    I am using OracleXMLQuery of XDK to construct an XML File from the contents retrieved from the database.
    I see that for columns which have null values or empty string, the corresponding tag is not displayed in the XML File. Instead, even for columns that have empty string I need the tags to be displayed in the following format <tag1> </tag1>
    Kindly let me know if this is possible.

    Ya, I will try that. That seems to be a good idea. Thanks for the response.
    I have one more query. Whenever we add a new column to any table in Oracle, the column name is stored in Upper case. So when we generate XML File from the database, all the tags are either in upper case (or we can use qry.useLowerCaseTagNames() to retrieve the tag names in lower case). But the XSD contains tag names in mixed case. So when validating the XML Document against an XSD, it throws a validation error.
    Is there any way I can avoid this?

  • How to generate PDF output from OracleXMLQuery

    I want to generate a PDF out put from XML by using JSP. For this i writen jsp and xsl. My jsp code works fine if i include html formated xsl and it displays as a text when i pass pdf formated xls.
    Here i am providing my jsp code.
    I don't want to use XSQL, please provide me information ASAP.
    <%@ page import = "java.sql.*,oracle.xml.sql.query.OracleXMLQuery" %>
    <% Connection conn = null;
    Statement stmt = null;
    ResultSet rset = null;
    String dbURL = "jdbc:oracle:thin:@localhost:1521:oracle9i";
    try{
         DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
         conn = DriverManager.getConnection(dbURL, "scott", "tiger");
         stmt = conn.createStatement ();
         rset = stmt.executeQuery ("SELECT * " +
                   "FROM scott.emp ORDER BY ename");
    OracleXMLQuery xq = new OracleXMLQuery(conn, rset); %>
    <% xq.setStyleSheet("emptablefo.xsl"); %>
    <%= xq.getXMLString() %>
    <% } catch (java.sql.SQLException e) {  %>
    SQL error: <%= e %>
    <% }
    finally {
    if (stmt != null) stmt.close();
    if (rset != null) rset.close();
    if (conn != null) conn.close();
    } %>
    Thanks,
    Ramana

    >
    if the report output format is xls this code is generating the pdf output
    >
    looks like pdf is default output in template definition in xml publisher resp
    so for r12 use FND_REQUEST.ADD_LAYOUT as example
    v_request_id   number;
    xml_layout boolean;
    xml_layout := FND_REQUEST.ADD_LAYOUT('XXCUSTOM','XXCONCNAME','en','00','EXCEL');
    v_request_id := fnd_request.submit_request(application => 'XXCUSTOM',
                                               program     => 'XXCONCNAME',
                                               description => NULL,
                                               start_time  => NULL,
                                               sub_request => FALSE,
                                               argument1   => p_date
                                               );also see http://andyblg.wordpress.com/2012/08/23/run-concurrent-program-twice-with-different-layout-r12/

  • Using OracleXMLQuery with Oracle 9i

    Sample code example -
    OracleXMLQuery xmlData = new OracleXMLQuery(conn, sqlQuery);
    String xmlString = xmlData.getXMLString();
    PrintWriter xmlFile.print(xmlString);
    I am able to connect to the database and print out the XML file. I'm querying an object that has a table embedded and everything was printing out okay in 8i, but now it 9i the string data fields in the embedded table are printing out in hexadecimal format. I've been to Sun's web site and in the forum discussions other developers are having the same problems without any know solution.
    Has anyone here came up with a fix?

    I thought that imp, with full=Y option will import everything into this empty dB, no matter There are not any schemes and users that were in the original dB...
    Your understanding is 100% correct, but the question is, how did you take the export? Because, if you have taken full export, you haven't hit this problem. Could you tell us how did you made export?

Maybe you are looking for