Generate XML using JSP

I am trying to create and send an XML file back to browser where XSL will be
applied. I am using wl6.0 sp2
I tried like this
<%@ page contentType="text/xml" %>
<%
out.println("<?xml version=\"1.0\"?>") ;
out.println("<books>");
out.println("<title>") ;
out.println("XML Programming") ;
out.println("</title>") ;
out.println("</books>") ;
%>
But the browser is blank.
Thanks
shaikjava

You haven't provided adequate relevant information. If you need help provide proper relevant details.

Similar Messages

  • Creating XML using JSP

    Hi I want to create a xml using JSP For eg I want to create a report
              and I want to take all the data required for the report from the user
              and want to put all the information in a session and whenever a user
              wants to see the html output I should be able to parse the xml file
              and show it to user.
              I know it is doable but I am confused about storing the data in
              session and concerting that data into XML file any help would be
              great.
              Thanks,
              Preeti
              

    Sounds like you might want to look at XML data binding. Something like JAXB
              or Castor can create an object that can be turned into XML by merely calling
              a single method and probably streamed to Xalan or whatever to create HTML.
              However, don't quote me on this - I am having enough troubles with trying to
              get the compiled Objects to be as I wish. Basically, they both take your
              DTD with an extra file that defines the types to be used in the classes -
              i.e. instead of string int might be used - and which tags to turn into
              classes and general information such as this about the output of your
              classes. You then simply call Unmarshal (for both castor and JAXB) and it
              loads the file from the selected input stream into the created object, you
              edit the object, what ever - store it on the server... and call Marshal to
              get back the xml... as this is all using streams it could be passed to Xalan
              for processing i think...
              Hope I've helped, and answered your question a little!
              "Preeti Sikri" <[email protected]> wrote in message
              news:[email protected]...
              > Hi I want to create a xml using JSP For eg I want to create a report
              > and I want to take all the data required for the report from the user
              > and want to put all the information in a session and whenever a user
              > wants to see the html output I should be able to parse the xml file
              > and show it to user.
              >
              > I know it is doable but I am confused about storing the data in
              > session and concerting that data into XML file any help would be
              > great.
              >
              > Thanks,
              > Preeti
              

  • Generating XML using oracle10g (plsql)

    Hi,
    I have to generate XML using plsql, please somebody help me in this.
    Query is as below.
    First I need to select few columns COL1,COL2 AND COL3 from table let say TEMP1 on the basis of PK_ID.
    this selected columns should be in XML document which I need to return as OUT parameter.
    Now on the basis of COL1 fetched in the above query from TEMP table
    I need to fetch all the columns COL4,COL5 AND COL6 from its child table let say TEMP2 on the basis of COL1.
    Please suggest.

    SQL> select  dbms_xmlgen.getxml('select * from emp where deptno = 10')
      2    from  dual
      3  /
    DBMS_XMLGEN.GETXML('SELECT*FROMEMPWHEREDEPTNO=10')
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <EMPNO>7782</EMPNO>
      <ENAME>CLARK</ENAME>
      <JOB>MANAGER</JOB>
      <MGR>7839</MGR>
      <HIREDATE>09-JUN-81</HIREDATE>
      <SAL>2450</SAL>
      <DEPTNO>10</DEPTNO>
    </ROW>
    DBMS_XMLGEN.GETXML('SELECT*FROMEMPWHEREDEPTNO=10')
    <ROW>
      <EMPNO>7839</EMPNO>
      <ENAME>KING</ENAME>
      <JOB>PRESIDENT</JOB>
      <HIREDATE>17-NOV-81</HIREDATE>
      <SAL>5000</SAL>
      <DEPTNO>10</DEPTNO>
    </ROW>
    <ROW>
      <EMPNO>7934</EMPNO>
      <ENAME>MILLER</ENAME>
    DBMS_XMLGEN.GETXML('SELECT*FROMEMPWHEREDEPTNO=10')
      <JOB>CLERK</JOB>
      <MGR>7782</MGR>
      <HIREDATE>23-JAN-82</HIREDATE>
      <SAL>1300</SAL>
      <DEPTNO>10</DEPTNO>
    </ROW>
    </ROWSET>
    SQL> SY.

  • How to append the declaration tags to generated xml using Xquery

    Hi,
      How to append the declaration tags to generated xml using Xquery.generated XML is like
    <ROOT>
      <CHILD1></CHILD1>
      <CHILD2></CHILD2>
    </ROOT>
    Here I want to append the <?xml version="1.0" encoding="ISO-8859-1"?> and the result xml should be
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <ROOT>
      <CHILD1></CHILD1>
      <CHILD2></CHILD2>
    </ROOT>
    Can anybody help to do this.
    Thanks
    Mani

    First assign this element to a temp variable
    <ROOT>
      <CHILD1></CHILD1>
      <CHILD2></CHILD2>
    </ROOT>
    Now in XQuery expression create a new variable
    <?xml version="1.0" encoding="ISO-8859-1"?>
    $temp

  • Generating XMLs using queries

    Hi All,
    We have a situation as in where we have to generate a XML out of Oracle UCM. I want to know is there any way where i can generate XML using the reaultset of some query.
    Any inputs will be useful..
    Thanks.

    Hi!
    In IdocScript, you can work with the resultset and generate XML as you want ....
    You could also make your own java component that would generate XML.
    Romain.

  • How to send/receive XML using JSP

    Hi,
    I'm new to all this JSP/XML stuff so apologies if this is trivial.
    I'm trying to send an XML file via HTTP POST using JSP. Anyone know how to do this?
    Once the XML has been sent, how do you use JSP to request the XML file? I've figured out how to parse it already.
    Also, is it possible to call xsql directly within JSP?
    Thanks!

    I'm trying to send an XML file via HTTP POST using JSP. Anyone know how to do this?The question is, does anybody understand what you mean by this. Let me take a guess. You want to upload an XML file to a server. If this guess is right, then the answer is don't use JSP to do that. JSP is for generating output to be sent to a client. Use a servlet to handle an upload. And you don't need to write it yourself, there are already several file-upload servlets available on the web.
    Second guess: you have a POST request that asks your server to send an XML file back to the client. If it's a static XML file you don't need a JSP or a servlet or anything, just let your web server handle it just like any other static file. If it's dynamically generated then there's an answer worth giving, but I doubt that this is your question. But if it is, let us know.

  • Reading XML using JSP

    Hi,
    My company just bought a software, which this s/w will generate a HTML file with the XML tags and data inside it.
    I will need to read the XML tags and data inside the HTML file using JSP.
    Does anyone know how to do this?
    Please help mi!!Thanks!

    http://java.sun.com/webservices/docs/1.1/tutorial/doc/index.html

  • Generating XML Using JAVA

    How to generate XML usng java without using following.
    import org.apache.xerces.dom.DocumentImpl;
    import org.apache.xml.serialize.OutputFormat;
    import org.apache.xml.serialize.XMLSerializer;
    XML to be generated is as follows.
    <?xml version="1.0" encoding="UTF-8"?>
    <Modi xmlns:xsi="Modi/Modi1">
    <docConfig>
    <className>PO</className>
    <classDesc>Purchase</classDesc>
    <create>Y</create>
    </docConfig>
    <indexConfig>
    <index sequence="1">
    <shortName>PODATE</shortName>
    <displayName>PO Date</displayName>
    <type>date</type>
    <length>10</length>
    </index>
    </indexConfig>
    </upload>

    Two answers.
    If you want to not use any of the XML-oriented classes, you can use a PrintWriter. Just code:
    PrintWriter pw = new PrinteWriter(whatever);
    pw.println( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );
    etc.If you want to use XML-oriented classes, but just not these 3 (can't imagine why), then use
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    instead of XMLSerializer and OutputFormat, and
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    instead of the DocumentImpl
    Dave Patterson

  • How do I  generate XML using internal variables in a procedure

    I know there is a way to generate XML inside a procedure by querying the database such as
    SELECT XMLELEMENT("Emp",
    XMLFOREST(e.employee_id, e.last_name, e.salary))
    "Emp Element"
    FROM employees e WHERE employee_id = 204;
    Emp Element
    <Emp>
    <EMPLOYEE_ID>204</EMPLOYEE_ID>
    <LAST_NAME>Baer</LAST_NAME>
    <SALARY>10000</SALARY>
    </Emp>
    What I have unsuccessfully been trying to do is to basically do the same thing except using internal variables like
    DECLARE
    l_keytype CONTACTINFO.KEYTYPE%TYPE;
    l_keyvalue CONTACTINFO.KEYVALUE%TYPE;
    l_pricetag CONTACTINFO.PRICATEG%TYPE;
    l_xmlout CLOB;
    BEGIN
    l_keytype := '1';
    l_keyvalue := '3333';
    l_pricetag := '10';
    SELECT XMLELEMENT("ParamSet", .........................this is line 13
    XMLFOREST(l_keytype as "keytype", l_keyvalue as "keyvalue", l_pricetag as "pricetag"))
    "ParamSet Element"
    INTO l_xmlout FROM DUAL;
    DBMS_OUTPUT.PUT_LINE('l_xmlout = ' || l_xmlout);
    end;
    What I'd like it to generate is
    <ParamSet>
    <KEYTYPE>1 </KEYTYPE>
    <KEYVALUE>3333</KEYVALUE>
    <PRICETAG>100</PRICETAG>
    </ParamSet>
    But what I get is a compile error
    Error report:
    ORA-06550: line 13, column 19: (line 13 is SELECT XMLELEMENT("ParamSet", )
    PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got -
    ORA-06550: line 13, column 1:
    PL/SQL: SQL Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    Also, I've been told that one issue with XMLFOREST is that if the value is null it won't generate the XML for it. Not good. I will still need the XML even if it is empty. Please help.

    Darn, Marc beat me. Here was my answer showing an alternative for returning an XMLType, since that is what the query returns as he said.
    DECLARE
       l_keytype    VARCHAR2(5);
       l_keyvalue   VARCHAR2(5);
       l_pricetag   VARCHAR2(5);
       l_xmlout     CLOB;
       l_xmltype    XMLTYPE;
    BEGIN
       l_keytype := '1';
       l_keyvalue := '3333';
       l_pricetag := '10';
       SELECT XMLELEMENT("ParamSet",
                 XMLFOREST(l_keytype as "keytype",
                           l_keyvalue as "keyvalue",
                           l_pricetag as "pricetag")).getClobVal()
         INTO l_xmlout
         FROM DUAL;
       DBMS_OUTPUT.PUT_LINE('l_xmlout = ' || l_xmlout);
       SELECT XMLELEMENT("ParamSet",
                 XMLFOREST(l_keytype as "keytype",
                           l_keyvalue as "keyvalue",
                           l_pricetag as "pricetag"))
         INTO l_xmltype
         FROM DUAL;
       DBMS_OUTPUT.PUT_LINE('l_xmlout = ' || l_xmltype.getClobVal());
    end;Here is a link to Oracle's on-line documentation
    http://www.oracle.com/technetwork/indexes/documentation/index.html
    so that you can pick your version and search for XMLElement and XMLForest to see their difference as well as listening to us.

  • Generating XML using Varray or Pl/SQL table

    I am trying to convert an old plsql procedure to generate XML data. The program is getting all the data to report from various sources to a pl/sql table.
    Is there any way to directly convert data into xml from plsql table ??
    Here is the plsql table defination
    TYPE Emp_rec IS RECORD ( Batch_name VARCHAR2(240)
    ,Employee_name VARCHAR2(240)
    ,Employee_number VARCHAR2(240)
    ,Element_name VARCHAR2(240)
    ,Bee_value NUMBER
    ,Ele_scr_value NUMBER
    TYPE emp_data IS TABLE OF Emp_rec
    INDEX BY BINARY_INTEGER;
    E emp_data;
    And i am trying to get xml using following code:
    FOR i IN E.FIRST.. E.LAST
    LOOP
    SELECT
    XMLConcat (
    XMLELEMENT(
    "batch",
    XMLFOREST(
    E(i).Batch_name AS "Batch_name",
    E(i).Employee_number AS "Employee_number",
    E(i).Element_name AS "Element_name"
    INTO l_xml
    FROM dual;
    end loop;
    I am not sure whether this can actually be done or not. I have option to write the xml file manually to output ; but just wondering whether this method of getting xml is correct or not ? If yes, then how can we use plsql table data and merge it into a single XML file
    Please let me know your views and opinions.
    Thanks
    Ankur

    I am trying to convert an old plsql procedure to generate XML data. The program is getting all the data to report from various sources to a pl/sql table.
    Is there any way to directly convert data into xml from plsql table ??
    Here is the plsql table defination
    TYPE Emp_rec IS RECORD ( Batch_name VARCHAR2(240)
    ,Employee_name VARCHAR2(240)
    ,Employee_number VARCHAR2(240)
    ,Element_name VARCHAR2(240)
    ,Bee_value NUMBER
    ,Ele_scr_value NUMBER
    TYPE emp_data IS TABLE OF Emp_rec
    INDEX BY BINARY_INTEGER;
    E emp_data;
    And i am trying to get xml using following code:
    FOR i IN E.FIRST.. E.LAST
    LOOP
    SELECT
    XMLConcat (
    XMLELEMENT(
    "batch",
    XMLFOREST(
    E(i).Batch_name AS "Batch_name",
    E(i).Employee_number AS "Employee_number",
    E(i).Element_name AS "Element_name"
    INTO l_xml
    FROM dual;
    end loop;
    I am not sure whether this can actually be done or not. I have option to write the xml file manually to output ; but just wondering whether this method of getting xml is correct or not ? If yes, then how can we use plsql table data and merge it into a single XML file
    Please let me know your views and opinions.
    Thanks
    Ankur

  • Generate xml using FOR XML PATH from table with hierarchy

    I need to create xml from a table like:
    EL1 EL2 EL3 Attr01 Attr02 Attr03 Attr04
    E10,    ,    ,a,b,c,d
    E10,E1010,    ,a,b,c,d
    E10,E1010,E101010,a,b,c,d
    E10,E1010,E101020,a,b,c,d
    E10,E1010,E101030,a,b,c,d
    E10,E1020,    ,a,b,c,d
    E10,E1020,E102010,a,b,c,d
    E20,    ,    ,a,b,c,d
    E20,E2010,    ,a,b,c,d
    E20,E2010,E201010,a,b,c,d
    E20,E2020,    ,a,b,c,d
    E20,E2020,E202010,a,b,c,d
    E20,E2020,E202020,a,b,c,d
    The hierarchy is EL1--EL2--EL3, and the 3 columns should be elements of xml;
    The other for columns Attr01,Attr02,Attr03,Attr04 should be attributes of xml;
    The actual table could have more than 500 rows(there are many values for El1,EL2,and EL3). 
    The expected xml should like:
    <root>
      <E10 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
        <E1010 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
          <E101010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
          <E101020 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
          <E101030 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
        </E1010>
        <E1020 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
          <E102010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
        </E1020>
      </E10>
      <E20 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
        <E2010 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
          <E201010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
        </E2010>
        <E2020 Attr01="a" Attr02="b" Attr03="c" Attr04="d">
          <E202010 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
          <E202020 Attr01="a" Attr02="b" Attr03="c" Attr04="d" />
        </E2020>
      </E20>
    </root>
    I create a sample Src table:
    CREATE TABLE Src
    EL1 VARCHAR(10),
    EL2 VARCHAR(10),
    EL3 VARCHAR(10),
    Attr01 VARCHAR(10),
    Attr02 VARCHAR(10),
    Attr03 VARCHAR(10),
    Attr04 VARCHAR(10)
    GO
    INSERT INTO Src
    (EL1,EL2,EL3,Attr01,Attr02,Attr03,Attr04
     SELECT 'E10','','','a','b','c','d'
     UNION SELECT 'E10','E1010','','a','b','c','d'
     UNION SELECT 'E10','E1010','E101010','a','b','c','d'
     UNION SELECT 'E10','E1010','E101020','a','b','c','d'
     UNION SELECT 'E10','E1010','E101030','a','b','c','d'
     UNION SELECT 'E10','E1020','','a','b','c','d'
     UNION SELECT 'E10','E1020','E102010','a','b','c','d'
     UNION SELECT 'E20','','','a','b','c','d'
     UNION SELECT 'E20','E2010','','a','b','c','d'
     UNION SELECT 'E20','E2010','E201010','a','b','c','d'
     UNION SELECT 'E20','E2020','','a','b','c','d'
     UNION SELECT 'E20','E2020','E202010','a','b','c','d'
     UNION SELECT 'E20','E2020','E202020','a','b','c','d'
    GO
    I tried to use FOR XML PATH to generate xml for the sample data. When the records increase to a few hundreds, it's not a good idea.
    Here is my script:
    SELECT
    (SELECT Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    ,( SELECT
    Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    ,( SELECT
    Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    FROM Src
    WHERE EL3 = 'E101010'
    FOR XML PATH('E101010'),TYPE
    ) AS 'node()'
    ,( SELECT
    Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    FROM Src
    WHERE EL3 = 'E101020'
    FOR XML PATH('E101020'),TYPE
    ) AS 'node()'
    ,( SELECT
    Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    FROM Src
    WHERE EL3 = 'E101030'
    FOR XML PATH('E101030'),TYPE
    ) AS 'node()'
    FROM Src
    WHERE EL2 = 'E1010' AND (EL1 <>'' AND EL3 ='')
    FOR XML PATH('E1010'),TYPE
    ) AS 'node()'--1010
    ,( SELECT
    Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    ,( SELECT
    Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    FROM Src
    WHERE EL3 = 'E102010'
    FOR XML PATH('E102010'),TYPE
    ) AS 'node()'
    FROM Src
    WHERE EL2 = 'E1020' AND (EL1 <>'' AND EL3 ='')
    FOR XML PATH('E1020'),TYPE
    ) AS 'node()'--1020
    FROM Src
    WHERE EL1 = 'E10' AND (EL2 ='' AND EL3 ='')
    FOR XML PATH('E10'),TYPE) 'node()'
    ,(SELECT Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    ,( SELECT
    Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    ,( SELECT
    Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    FROM Src
    WHERE EL3 = 'E201010'
    FOR XML PATH('E201010'),TYPE
    ) AS 'node()'
    FROM Src
    WHERE EL2 = 'E2010' AND (EL1 <>'' AND EL3 ='')
    FOR XML PATH('E2010'),TYPE
    ) AS 'node()'--2010
    ,( SELECT
    Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    ,( SELECT
    Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    FROM Src
    WHERE EL3 = 'E202010'
    FOR XML PATH('E202010'),TYPE
    ) AS 'node()'
    ,( SELECT
    Attr01 AS '@Attr01'
    ,Attr02 AS '@Attr02'
    ,Attr03 AS '@Attr03'
    ,Attr04 AS '@Attr04'
    FROM Src
    WHERE EL3 = 'E202020'
    FOR XML PATH('E202020'),TYPE
    ) AS 'node()'
    FROM Src
    WHERE EL2 = 'E2020' AND (EL1 <>'' AND EL3 ='')
    FOR XML PATH('E2020'),TYPE
    FROM Src
    WHERE EL1 = 'E20' AND (EL2 ='' AND EL3 ='')
    FOR XML PATH('E20'),TYPE) AS 'node()'
    FOR XML PATH(''),ROOT('root')
    If I get a few hundreds of rows, how huge the script should be. Does anyone have better solution for this? Thanks.
    Tao

    wBob,
    Thanks! And sorry for late feedback.
    The XSD requires the xml structures like the following
    <Schools>
    <School01>Some school</School01>
    <School02>Some other school</School02>
    </Schools>
    I have to use the number in the element name. 
    Right now I just use the nested FOR XML PATH, although I have to write thousand lines code.
    Thanks anyway.
    Tao
    Tao

  • Generate XML using package xmlgen

    I have the following query:
    select employ_id, last_name, first_name, salary from employ;
    I need generate xml like this:
    <row>
    <employ>
    <employ_id last_name="Dennis" First_name="david">1</employ>
    <salary>6</salary>
    </employ>
    </row>
    How can I get it using xmlgen package? Thanks.
    null

    No, you will not be able to do that. The
    problem is that the columns of the db table
    are mapped to XML elements rather then
    attributes. Your best bet at achieving your
    goal is that after you get your xml document
    from the XSU, you transform it using XSLT.
    The Oracle Parser does include the xsl processor.
    visar
    ps.: Today, when using XSU's java API, you can directly get a DOM tree representation of the XML document, which then you can pass directly to the XSL processor and transform it; unfortunately, the PL/SQL API (i.e. xmlgen) doesn only return a string (i.e. lob) representation of the XML doc. So you have to use the PL/SQL Parser to parse it, get it in the DOM format, and only then can you transform it. The good news is that I was assured that in the future the XMLGEN will have a call to get the XML doc in DOM rep.

  • Generate XML using Java

    Hi all,
    How can I genrate a XML document using Java? What are the imports that I have to use? Also please tell me about JAXP and in what way it can be used to generate an XML
    Please Help me with examples..
    Thanks in advance

    You can generate xml with dom like this
    try {
         DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
         DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
         Document document = docBuilder.newDocument();
         Element element = document.createElement("<your_tag_name>"); // creares tag
         element.setAttribute("key", "value"); // adds an attribute to your tag
         Text text = document.createTextNode("some text"); // creates "some text node"
         element.appendChild(text); // adds text to our tag for ex. <your_tag_name>some text</your_tag_name>
         CDATASection cdata = document.createCDATASection("cdata text");
         element.appendChild(cdata); // appends it to element
         document.appendChild(element); // if you want to add this element *** root element
         // or
         root.appendChild(element); // where  root is another Element object
    } catch (ParserConfigurationException e) {
         e.printStackTrace();
    }

  • Generating xml using PL/SQL taking a lot of space in TEMP tablespace

    We wrote a stored procedure that generate xml which will be stored in a CLOB column. Environment is 9i on Windows 2003.
    The gnerated xml is about 800K. In the procedure there is one big cursor that will retrieve 200 records of 55 fields and many other small dynamic cursors that open and close here and there. The fields are pretty small. Biggest ones are like varchar2(30). The query for the big cursor does using union and need sorting.
    Can anyone explain why it takes about 15G of TEMP tablespace to accomplish this job and is there a way to avoid this?

    The version is Enterprise Edition 9.2.0.1.0.
    Below is the query.
    SELECT ROWNUM + ( SELECT NVL(MAX(WQX_ACTIVITY_GEN_ID), 0) FROM WQX_ACTIVITY ) as WQX_ACTIVITY_GEN_ID
         , A.ACTIVITYIDENTIFIER2            as ACTIVITY_IDENTIFIER
         , (SELECT MAX(O.ORGANIZATION_NAME) FROM SYS_ORGANIZATION O WHERE O.ORGANIZATION_ID = 111242)  as ORGANIZATION_NAME
         , (SELECT MAX(P.PROJECT_IDENTIFIER) FROM SYS_PROJECT P WHERE P.PROJECT_ID = 111242) as PROJECT_IDENTIFIER
         , A.ACTIVITYTYPECODE               as ACTIVITY_TYPE_CD
         , A.ActivityMediaName              as ACTIVITY_MEDIA_NAME
         , A.ActivityMediaSubDivisionName   as MEDIA_SUB_DIVISION
         , A.ActivityStartDate              as ACTIVITY_START_DATE
         , CASE WHEN A.ActivityStartTime is not NULL THEN
                     substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00'
                WHEN A.ActivityStartTime is NULL THEN ''
           END as ACTIVITY_START_TIME
    --   , substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00' as ACTIVITY_START_TIME
         , A.ACTIVITYENDDATE                as ACTIVITY_END_DATE
         , CASE WHEN A.ACTIVITYENDTIME is not NULL THEN
                     substr(A.ACTIVITYENDTIME,1,2)||':'||substr(A.ACTIVITYENDTIME,3,2)||':00'
                WHEN A.ACTIVITYENDTIME is NULL THEN ''
           END as ACTIVITY_END_TIME
    --   , substr(A.ACTIVITYENDTIME,1,2)||':'||substr(A.ACTIVITYENDTIME,3,2)||':00' as ACTIVITY_END_TIME
         , A.TIMEZONECODE1                  as TIME_ZONE_CD
         , A.ActivityRelativeDepthName      as RELATIVE_DEPTH_NAME
         , NULL                             as DEPTH_HEIGHT_MEASURE
         , NULL                             as DEPTH_HEIGHT_UNIT
         , 111242              as MONITORING_LOC_ID
         , A.ACTIVITYCOMMENTTEXT            as COMMENT_
         , A.SamplerName                    as SAMPLER_NAME
         , A.ActivityArea                   as ACTIVITY_AREA
         , A.ReportingRound                 as REPORTING_ROUND
         , A.SamplePanel                    as SAMPLEPANEL
         , A.DataIncludedinReport           as DATA_INCLUDED_IN_REPORT
         , A.FlowStatusIndicator            as FLOW_STATUS_IND
         , A.SampleChainOfCustody           as SAMPLE_COC
         , A.ActivitySeason                 as ACTIVITY_SEASON
         , A.RunoffImpact                   as RUNOFF_IMPACT
         , (111242)            as MONI_LOC_ID
         , (SELECT MAX(B.MONI_LOC_IDENTIFIER) FROM WQX_MONITORING_LOC B WHERE B.MONI_LOC_IDENTIFIER = A.MONITORINGLOCATIONIDENTIFIER) as MONI_LOC_IDENTIFIER
         , 111242                     as PROJECT_ID
         , NULL                             as BIO_ASSEMB_SAMPLED_NAME
         , NULL                             as BIO_TOXICITY_TEST_TYPE
         , A.METHODIDENTIFIER1              as SAMPLE_COLLECT_METHOD_IDENTIFI
         , A.METHODIDENTIFIERCONTEXT1       as SAMPLE_COLLECT_METHOD_CONTEXT
         , A.METHODNAME1                    as SAMPLE_COLLECT_METHOD_NAME
         , NULL                             as SAMPLE_COLLECT_QUALIFIER_TYPE
         , A.METHODDESCRIPTIONTEXT1         as SAMPLE_COLLECT_DESC
         , A.SampleCollectionEquipmentName  as SAMPLE_COLLECT_EQUIP_NAME
         , A.SAMPLECOLLECTIONEQUIPMENTTXT   as SAMPLE_COLLECT_EQUIP_DESC
         , A.METHODNAME2                    as SAMPLE_PREP_METHOD_NAME
         , A.METHODIDENTIFIER2              as SAMPLE_PREP_METHOD_IDENTIFIER
         , A.METHODIDENTIFIERCONTEXT2       as SAMPLE_PREP_METHOD_CONTEXT
         , NULL                             as SAMPLE_PREP_QUALIFIER_TYPE
         , A.METHODDESCRIPTIONTEXT1         as SAMPLE_PREP_DESC
         , A.SampleContainerTypeName        as SAMPLE_CONTAINER_TYPE
         , A.SampleContainerColorName       as SAMPLE_CONTAINER_COLOR
         , A.ChemicalPreservativeUsedName   as CHEM_PRESERVATIVE_USED
         , A.ThermalPreservativeUsedName    as THERMAL_PRESERVATIVE_USED
         , A.SAMPLETRANSPORTSTORAGEDESC     as SAMPLE_TRANS_STORAGE
         , A.AnalysisStartTime              as AnalysisStartTime
         , A.AnalysisEndTime                as AnalysisEndTime
         , A.MethodSpeciationName           as MethodSpeciationName
         , A.ResultLaboratoryCommentCode    as ResultLaboratoryCommentCode
         , A.UnidentifiedSpeciesIdentifier  as UnidentifiedSpeciesIdentifier
      FROM TMP_CHEMACTIVITYRESULTS A
    WHERE A.SUBMISSION_ID = 111242
       AND A.ACTIVITYIDENTIFIER2 NOT IN
         ( SELECT ACTIVITY_IDENTIFIER FROM WQX_ACTIVITY )
    UNION
    SELECT X.WQX_ACTIVITY_GEN_ID                                             as WQX_ACTIVITY_GEN_ID
         , A.ACTIVITYIDENTIFIER2                                             as ACTIVITY_IDENTIFIER
         , (SELECT MAX(O.ORGANIZATION_NAME) FROM SYS_ORGANIZATION O WHERE O.ORGANIZATION_ID = 111242)  as ORGANIZATION_NAME
         , (SELECT MAX(P.PROJECT_IDENTIFIER) FROM SYS_PROJECT P WHERE P.PROJECT_ID = 111242) as PROJECT_IDENTIFIER
         , NVL(A.ACTIVITYTYPECODE, (SELECT MAX(ACTYP_CD) FROM REF_ACTIVITY_TYPE WHERE TO_CHAR(ACTYP_UID) = TO_CHAR(X.ACTIVITY_TYPE_CD))) as ACTIVITY_TYPE_CD
         , NVL(A.ActivityMediaName, X.ACTIVITY_MEDIA_NAME)                   as ACTIVITY_MEDIA_NAME
         , NVL(A.ActivityMediaSubDivisionName, X.MEDIA_SUB_DIVISION)         as MEDIA_SUB_DIVISION
         , NVL(A.ActivityStartDate, TO_CHAR(X.ACTIVITY_START_DTTM, 'YYYY-MM-DD')) as ACTIVITY_START_DATE
         , CASE WHEN A.ActivityStartTime is not NULL THEN
                     substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00'
                WHEN A.ActivityStartTime is NULL THEN ''
           END as ACTIVITY_START_TIME
    --   , NVL((substr(A.ActivityStartTime,1,2)||':'||substr(A.ActivityStartTime,3,2)||':00'), TO_CHAR(X.ACTIVITY_START_DTTM, 'HH24:MI:SS')) as ACTIVITY_START_TIME
         , NVL(A.ACTIVITYENDDATE, TO_CHAR(X.ACTIVITY_END_DTTM, 'YYYY-MM-DD'))     as ACTIVITY_END_DATE
         , NVL(A.ACTIVITYENDDATE, TO_CHAR(X.ACTIVITY_END_DTTM, 'HH24:MI:SS'))     as ACTIVITY_END_TIME
         , NVL(A.TIMEZONECODE1, X.TIME_ZONE_CD)                              as TIME_ZONE_CD
         , NVL(A.ActivityRelativeDepthName, X.RELATIVE_DEPTH_NAME)           as RELATIVE_DEPTH_NAME
         , X.DEPTH_HEIGHT_MEASURE                                            as DEPTH_HEIGHT_MEASURE
         , X.DEPTH_HEIGHT_UNIT                                               as DEPTH_HEIGHT_UNIT
         , NVL(111242, X.MONITORING_LOC_ID)                     as MONITORING_LOC_ID
         , NVL(A.ACTIVITYCOMMENTTEXT, X.COMMENT_)                            as COMMENT_
         , NVL(A.SamplerName, X.SAMPLER_NAME)                                as SAMPLER_NAME
         , NVL(A.ActivityArea, X.ACTIVITY_AREA)                              as ACTIVITY_AREA
         , NVL(A.ReportingRound, X.REPORTING_ROUND)                          as REPORTING_ROUND
         , NVL(A.SamplePanel, X.SAMPLEPANEL)                                 as SAMPLEPANEL
         , NVL(A.DataIncludedinReport, X.DATA_INCLUDED_IN_REPORT)            as DATA_INCLUDED_IN_REPORT
         , NVL(A.FlowStatusIndicator, X.FLOW_STATUS_IND)                     as FLOW_STATUS_IND
         , NVL(A.SampleChainOfCustody, X.SAMPLE_COC)                         as SAMPLE_COC
         , NVL(A.ActivitySeason, X.ACTIVITY_SEASON)                          as ACTIVITY_SEASON
         , NVL(A.RunoffImpact, X.RUNOFF_IMPACT)                              as RUNOFF_IMPACT
         , (111242)                                             as MONI_LOC_ID
         , (SELECT MAX(B.MONI_LOC_IDENTIFIER) FROM WQX_MONITORING_LOC B WHERE B.MONI_LOC_IDENTIFIER = A.MONITORINGLOCATIONIDENTIFIER) as MONI_LOC_IDENTIFIER
         , 111242                                                      as PROJECT_ID
         , X.BIO_ASSEMB_SAMPLED_NAME                                         as BIO_ASSEMB_SAMPLED_NAME
         , X.BIO_TOXICITY_TEST_TYPE                                          as BIO_TOXICITY_TEST_TYPE
         , NVL(A.METHODIDENTIFIER1, X.SAMPLE_COLLECT_METHOD_IDENTIFI)        as SAMPLE_COLLECT_METHOD_IDENTIFI
         , NVL(A.METHODIDENTIFIERCONTEXT1, X.SAMPLE_COLLECT_METHOD_CONTEXT)  as SAMPLE_COLLECT_METHOD_CONTEXT
         , X.SAMPLE_COLLECT_METHOD_NAME                                      as SAMPLE_COLLECT_METHOD_NAME
         , X.SAMPLE_COLLECT_QUALIFIER_TYPE                                   as SAMPLE_COLLECT_QUALIFIER_TYPE
         , NVL(A.METHODDESCRIPTIONTEXT1, X.SAMPLE_COLLECT_DESC)              as SAMPLE_COLLECT_DESC
         , NVL(A.SampleCollectionEquipmentName, X.SAMPLE_COLLECT_EQUIP_NAME) as SAMPLE_COLLECT_EQUIP_NAME
         , NVL(A.SAMPLECOLLECTIONEQUIPMENTTXT, X.SAMPLE_COLLECT_EQUIP_DESC)  as SAMPLE_COLLECT_EQUIP_DESC
         , NVL(A.METHODNAME2, X.SAMPLE_PREP_METHOD_NAME)                     as SAMPLE_PREP_METHOD_NAME
         , NVL(A.METHODIDENTIFIER2, X.SAMPLE_PREP_METHOD_IDENTIFIER)         as SAMPLE_PREP_METHOD_IDENTIFIER
         , NVL(A.METHODIDENTIFIERCONTEXT2, X.SAMPLE_PREP_METHOD_CONTEXT)     as SAMPLE_PREP_METHOD_CONTEXT
         , X.SAMPLE_PREP_QUALIFIER_TYPE                                      as SAMPLE_PREP_QUALIFIER_TYPE
         , NVL(A.METHODDESCRIPTIONTEXT1, X.SAMPLE_PREP_DESC)                 as SAMPLE_PREP_DESC
         , NVL(A.SampleContainerTypeName, X.SAMPLE_CONTAINER_TYPE)           as SAMPLE_CONTAINER_TYPE
         , NVL(A.SampleContainerColorName, X.SAMPLE_CONTAINER_COLOR)         as SAMPLE_CONTAINER_COLOR
         , NVL(A.ChemicalPreservativeUsedName, X.CHEM_PRESERVATIVE_USED)     as CHEM_PRESERVATIVE_USED
         , NVL(A.ThermalPreservativeUsedName, X.THERMAL_PRESERVATIVE_USED)   as THERMAL_PRESERVATIVE_USED
         , NVL(A.SAMPLETRANSPORTSTORAGEDESC, X.SAMPLE_TRANS_STORAGE)         as SAMPLE_TRANS_STORAGE
         , NVL(A.AnalysisStartTime, '')                                      as AnalysisStartTime
         , NVL(A.AnalysisEndTime, '')                                        as AnalysisEndTime
         , NVL(A.MethodSpeciationName, '')                                   as MethodSpeciationName
         , NVL(A.ResultLaboratoryCommentCode, '')                            as ResultLaboratoryCommentCode
         , NVL(A.UnidentifiedSpeciesIdentifier, '')                          as UnidentifiedSpeciesIdentifier
      FROM TMP_CHEMACTIVITYRESULTS A
           JOIN WQX_ACTIVITY X ON A.ACTIVITYIDENTIFIER2 = X.ACTIVITY_IDENTIFIER
    WHERE A.SUBMISSION_ID = 111242;

  • How can I send request to the server through XML using JSP

    How can I send XML request to the server using JSP and servlets

    Ajax may be the one way.

Maybe you are looking for

  • Is it possible to extract data from a Safari cookie?

    Hello, I need to recover a FedEx tracking number that I entered in Safari, and I'm hoping that perchance it was stored somehow in a cookie when I entered the number. It appears that I have a few cookies from FedEx in the list of cookie files on my co

  • PDF File Size Reduction

    Currently, I am using Adobe Reader XI, but am looking for a version that allows for the reduction of the PDF file size.  This is especially useful when e-mailing documents.  Can anyone suggest the best version to keep the editing functions (ex. PDF t

  • PSE 10 one program for two computers

    Hello; my question is, it possible to use my PSE 10 that is installed on my PC and use it on my laptop via a home network ? downloading the program onto my PC is not an option. I once had it installed I had to replace my drive thus using the two allo

  • Sending invoices and  reminders to clients thru e-mail messages

    Hi I would like to know if there is a standard functinality in Receivables module to send invoices and reminders to client via e-mail? I there is please inform where i can get some information, if not please advise in a few words how we can customise

  • After HDD exchange Satellite A200-1YW began to turn off

    Hi! I have a problem with Toshiba Satellite A200-1YW. After changing the hard drive (company) I got my notebook repaired, but a day later he began to turn off the notebook Connected to the power.A When the battery is not off, or When it is plugged in