Generating XML from Database using XSQL

Hi ,
I have been using Reports as an intermidiate to generate XML (by giving concurrent program o/p type as XML). Now, i want it to be done from SQL or PL/SQL. I am able to achieve this using XSQL functions. I placed the SQL in a .sql file and registered it as a concurrent program. It was giving me XML output.
I have two problems here.
1. How can i know whether i have generated valid xml or not?
2. When i am linking this concurrent program to XML Publisher, publisher is not able to read thie output from the concurrent prograam. It is erroring out. Why?
Thanks
sap

Save the XML file - try to open it with IE and/or Firefox.
If that doesn't work you know already something is wrong.
You may try to cut&paste it into notepad and save as UTF-8.
Then try it out with the Template Builder for Wrod.
If you can't figure it out and run the report with a SMALL dataset six (ie. 1)
and post it here.

Similar Messages

  • Generating XML from database

    I'm a total newbie in XML DB and need advice on generating XML from database.
    The situation is the following: there is a legacy web application which uses an XML document as a configuration file. This document conforms to some well-defined schema. For instance:
    <config>
         <title value="TITLE" />
         <subtitle value="SUBTITLE" />
         <style url="default.css" />
         <widgets>
              <widget id="1" opened="true" />
              <widget id="2" opened="false" />
         </widgets>
    </config>
    It contains portions of static data which are common for all users as well as dynamic personal data.
    Dynamic data comes from two sources:
    1) security considerations (for instance, not all widgets are available for some users) - thus the "master" configuration content must be filtered, but not otherwise modified;
    2) user preferences (for instance, user can set widget2 to be opened by default) - thus values of some attributes must be different for each user. When the user saves her preferences, the entire document with new values is posted back to server.
    We want to try to store user preferences, apply security and generate personalized configuration documents using XML DB.
    So we need advice on storage models and generation procedures - which should be more efficient and easy to support or extend.
    Please note, that there is no requirement to actually store data as XML.
    Thanks in advance!
    P.S.: Sorry for the incomplete initial post.
    Edited by: WxD on 27.09.2010 11:45

    Hi,
    See this link for more details
    http://www.stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10790/xdb13gen.htm

  • Generating XMLs from CSVs using DOM parser......

    Hi,
    I am trying to generate XMLs from CSV files using DOM parser. XMLs are getting generated but the problem is that i am using Encoding "ISO-8859-1" but XMLs are getting generated in UTF-8 encoding.
    Please refer to the code below and advice. (where are the code tags gone ????? )
    Source domSource = new DOMSource(document);
    ByteArrayOutputStream xmlStream = new ByteArrayOutputStream();
    Result result = new StreamResult(xmlStream);
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.transform(domSource, result);
    xmlStream.close();
    generatedXml = new String(xmlStream.toByteArray(), "*ISO-8859-1*");

    Use transformer.setOutputProperty(OutputKeys.ENCODING, "ISO-8859-1") to specify the character set.

  • Generate report from database using .xsl style sheet

    I am trying to view test result histories for specific uut serial numbers.
    We are logging all test data to the default access database template that was provided with Teststand.
    Is there a method of generating reports from the database that match the format of those generated at runtime?
    I was surprised to find that the default access database did not contain any gui or pre-made reports matching the xsl style sheets chosen in the report options dialog.
    My database skills are weak, I am able to browse the raw data and I see the relationships between some of the tables, but the prospect of recreating one of the xml report formats in access seems daunting. Am I missing something? what is the best way to print a uut report from test data stored in access?

    Hello msears,
    Thank you for posting on the NI Discussion Forums.  Unfortunately there are no tools available in TestStand for directly converting an Access database to a formatted .xsl report.  It is possible to have a step in a sequence that reads the information from the database, and create the .xsl report as if it had been generated at sequence run-time, by writing those values directly to Locals.ResultList.  Admittedly, this would require some knowledge of Microsoft Access, and the ability to write a program that will extract information from the database, in order to include it as a step in the sequence.
    Is there anything stopping you from creating a formatted .xsl report when the sequence is run (instead of trying to create it from previous data stored in an Access database)?
    Chris_G
    Sr Test Engineer
    Medtronic, Inc.

  • Generate database schema in XML from database structure

    hi
    I want to generate the entire database schema in XML from database structure. (Same feature is provided by Altova XMLSpy).
    It would be great if there was some API that does the process of parsing the database structure and generating the XML automatically. A similiar feature is provided by Apache DdlUtils' API, but a stable version is not yet available...
    Please help!
    Thanks in advance.

    Nikhil,
    There is a wealth of information available on the Internet regarding the XML capabilities of the Oracle database.
    Have you done an Internet search for "SQL XML Oracle"?
    Good Luck,
    Avi.

  • Question regarding Polling data from database using DB Adapters in BPEL

    Hi,
    I have the following question regarding Polling data from database using DB Adapters in BPEL -
    If I am selecting data from multiple tables/view to ultimately generate hierarchical xml document, is there a way that I specify polling all of these tables/views. Is polling limited only to one table/view?
    Thanks
    Ravi

    Hi Ravi,
    your question seems to have been answered for the question of polling a set of tables with one as the root, and getting back a hierarchical xml representing multiple related tables.
    However you can also poll for changes to both the root table and its related tables. Not sure if this was your question or the one already answered. If the former please check out the sample
    bpel/samples/tutorials/122.DBAdapter/advanced/polling/PollingForChildUpdates
    Thanks
    Steve

  • Generating XML from SQL queries and saving to an xml file?

    Hi there,
    I was wondering if somebody could help with regards to the following:
    Generating XML from SQL queries and saving to a xml file?
    We want to have a procedure(PL/SQL) that accepts an order number as an input parameter(the procedure
    is accessed by our software on the client machine).
    Using this order number we do a couple of SQL queries.
    My first question: What would be our best option to convert the result of the
    queries to xml?
    Second Question: Once the XML has been generated, how do we save that XML to a file?
    (The XML file is going to be saved on the file system of the server that
    the database is running on.)
    Now our procedure will also have a output parameter which returns the filename to us. eg. Order1001.xml
    Our software on the client machine will then ftp this XML file(based on the output parameter[filename]) to
    the client hard drive.
    Any information would be greatly appreciated.
    Thanking you,
    Francois

    If you are using 9iR2 you do not need to do any of this..
    You can create an XML as an XMLType using the new SQL/XML operators. You can insert this XML into the XML DB repository using DBMS_XDB.createResource. You can then access the document from the resource. You can also return the XMLType containing the XML directly from the PL/SQL Procedure.

  • Generating XML from SQL queries and saving to a xml file?

    Hi there,
    I was wondering if somebody could help with regards to the following:
    Generating XML from SQL queries and saving to a xml file?
    We want to have a stored procedure(PL/SQL) that accepts an order number as an input parameter(the procedure
    is accessed by our software on the client machine).
    Using this order number we do a couple of SQL queries.
    My first question: What would be our best option to convert the result of the
    queries to xml?
    Second Question: Once the XML has been generated, how do we save that XML to a file?
    (The XML file is going to be saved on the file system of the server that
    the database is running on.)
    Now our procedure will also have a output parameter which returns the filename to us. eg. Order1001.xml
    Our software on the client machine will then ftp this XML file(based on the output parameter[filename]) to
    the client hard drive.
    Any information would be greatly appreciated.
    Thanking you,
    Francois

    Hi
    Here is an example of some code that i am using on Oracle 817.
    The create_file procedure is the one that creates the file.
    The orher procedures are utility procedures that can be used with any XML file.
    PROCEDURE create_file_with_root(po_xmldoc OUT xmldom.DOMDocument,
    pi_root_tag IN VARCHAR2,
                                            po_root_element OUT xmldom.domelement,
                                            po_root_node OUT xmldom.domnode,
                                            pi_doctype_url IN VARCHAR2) IS
    xmldoc xmldom.DOMDocument;
    root xmldom.domnode;
    root_node xmldom.domnode;
    root_element xmldom.domelement;
    record_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    BEGIN
    xmldoc := xmldom.newDOMDocument;
    xmldom.setVersion(xmldoc, '1.0');
    xmldom.setDoctype(xmldoc, pi_root_tag, pi_doctype_url,'');
    -- Create the root --
    root := xmldom.makeNode(xmldoc);
    -- Create the root element in the file --
    create_element_and_append(xmldoc, pi_root_tag, root, root_element, root_node);
    po_xmldoc := xmldoc;
    po_root_node := root_node;
    po_root_element := root_element;
    END create_file_with_root;
    PROCEDURE create_element_and_append(pi_xmldoc IN OUT xmldom.DOMDocument,
    pi_element_name IN VARCHAR2,
                                            pi_parent_node IN xmldom.domnode,
                                            po_new_element OUT xmldom.domelement,
                                            po_new_node OUT xmldom.domnode) IS
    element xmldom.domelement;
    child_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    BEGIN
    element := xmldom.createElement(pi_xmldoc, pi_element_name);
    child_node := xmldom.makeNode(element);
    -- Append the new node to the parent --
    newelenode := xmldom.appendchild(pi_parent_node, child_node);
    po_new_node := child_node;
    po_new_element := element;
    END create_element_and_append;
    FUNCTION create_text_element(pio_xmldoc IN OUT xmldom.DOMDocument, pi_element_name IN VARCHAR2,
    pi_element_data IN VARCHAR2, pi_parent_node IN xmldom.domnode) RETURN xmldom.domnode IS
    parent_node xmldom.domnode;                                   
    child_node xmldom.domnode;
    child_element xmldom.domelement;
    newelenode xmldom.DOMNode;
    textele xmldom.DOMText;
    compnode xmldom.DOMNode;
    BEGIN
    create_element_and_append(pio_xmldoc, pi_element_name, pi_parent_node, child_element, child_node);
    parent_node := child_node;
    -- Create a text node --
    textele := xmldom.createTextNode(pio_xmldoc, pi_element_data);
    child_node := xmldom.makeNode(textele);
    -- Link the text node to the new node --
    compnode := xmldom.appendChild(parent_node, child_node);
    RETURN newelenode;
    END create_text_element;
    PROCEDURE create_file IS
    xmldoc xmldom.DOMDocument;
    root_node xmldom.domnode;
    xml_doctype xmldom.DOMDocumentType;
    root_element xmldom.domelement;
    record_element xmldom.domelement;
    record_node xmldom.domnode;
    parent_node xmldom.domnode;
    child_node xmldom.domnode;
    newelenode xmldom.DOMNode;
    textele xmldom.DOMText;
    compnode xmldom.DOMNode;
    BEGIN
    xmldoc := xmldom.newDOMDocument;
    xmldom.setVersion(xmldoc, '1.0');
    create_file_with_root(xmldoc, 'root', root_element, root_node, 'test.dtd');
    xmldom.setAttribute(root_element, 'interface_type', 'EXCHANGE_RATES');
    -- Create the record element in the file --
    create_element_and_append(xmldoc, 'record', root_node, record_element, record_node);
    parent_node := create_text_element(xmldoc, 'title', 'Mr', record_node);
    parent_node := create_text_element(xmldoc, 'name', 'Joe', record_node);
    parent_node := create_text_element(xmldoc,'surname', 'Blogs', record_node);
    -- Create the record element in the file --
    create_element_and_append(xmldoc, 'record', root_node, record_element, record_node);
    parent_node := create_text_element(xmldoc, 'title', 'Mrs', record_node);
    parent_node := create_text_element(xmldoc, 'name', 'A', record_node);
    parent_node := create_text_element(xmldoc, 'surname', 'B', record_node);
    -- write the newly created dom document into the buffer assuming it is less than 32K
    xmldom.writeTofile(xmldoc, 'c:\laiki\willow_data\test.xml');
    EXCEPTION
    WHEN xmldom.INDEX_SIZE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Index Size error');
    WHEN xmldom.DOMSTRING_SIZE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'String Size error');
    WHEN xmldom.HIERARCHY_REQUEST_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Hierarchy request error');
    WHEN xmldom.WRONG_DOCUMENT_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Wrong doc error');
    WHEN xmldom.INVALID_CHARACTER_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Invalid Char error');
    WHEN xmldom.NO_DATA_ALLOWED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Nod data allowed error');
    WHEN xmldom.NO_MODIFICATION_ALLOWED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'No mod allowed error');
    WHEN xmldom.NOT_FOUND_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Not found error');
    WHEN xmldom.NOT_SUPPORTED_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'Not supported error');
    WHEN xmldom.INUSE_ATTRIBUTE_ERR THEN
    RAISE_APPLICATION_ERROR(-20120, 'In use attr error');
    WHEN OTHERS THEN
    dbms_output.put_line('exception occured' || SQLCODE || SUBSTR(SQLERRM, 1, 100));
    END create_file;

  • Why it's so inefficient to generate XML from SQL queries?

    I am learning to use Oracle9i XML DB to generate XML document using SQL queries. According to the document, there are multiple ways to do it (SQLX, DBMS_XMLGEN, SYS_XMLGEN, XSU). I am using SQLX to do it, but find it's so inefficient. Could someone point out what could be the problem?
    I generate XML from TPC-H database, using the query as shown below. The indexes and primary key/foreign keys are created and specified. The system is Pentium IV 2GHz, Linux 2.4.18 with 512MB memory and 1GB swap. With database size 5MB, it spends about 300 seconds (TKPROF result) to generate the XML document. But for 10MB TPCH database, I cannot get the xml document after a long time. I find that all almost physical memory are used up by it. Therefore I stop it.
    It seems that nested-loop join is used to evaluate the query, therefore it's very inefficient. I don't know whether there is a efficient way to do it.
    Wish to get your help. Thank you very much!
    Chengkai Li
    ===================================================================================================================
    SELECT XMLELEMENT (
    "region",
    XMLATTRIBUTES ( r_regionkey AS "regionkey", r_name AS "name", r_comment AS "comment"),
    (SELECT XMLAGG(
    XMLELEMENT (
    "nation",
    XMLATTRIBUTES ( n_nationkey AS "nationkey", n_name AS "name", n_regionkey AS "regionkey", n_comment AS "comment"),
    XMLConcat ((SELECT XMLAGG(XMLELEMENT (
    "supplier",
    XMLATTRIBUTES ( s_suppkey AS "suppkey", s_name AS "name", s_address AS "address", s_nationkey AS "nationkey", s_phone AS "phone", s_acctbal AS "acctbal", s_comment AS "comment"),
    (SELECT XMLAGG(XMLELEMENT (
    "part",
    XMLATTRIBUTES ( p_partkey AS "partkey", p_name AS "name", p_mfgr AS "mfgr", p_brand AS "brand", p_type AS "type", p_size AS "size", p_container AS "container", p_retailprice AS "retailprice", p_comment AS "comment", ps_availqty AS "ps_availqty", ps_supplycost AS "ps_supplycost", ps_comment AS "ps_comment")))
    FROM PART p, PARTSUPP ps
    WHERE ps.ps_partkey = p.p_partkey
    AND ps.ps_suppkey = s.s_suppkey
         FROM SUPPLIER s
    WHERE s.s_nationkey = n.n_nationkey
    (SELECT XMLAGG(XMLELEMENT(
    "customer",
    XMLATTRIBUTES ( c_custkey AS "custkey", c_name AS "name", c_address AS "address", c_nationkey AS "nationkey", c_phone AS "phone", c_acctbal AS "acctbal", c_mktsegment AS "mktsegment", c_comment AS "comment"),
    (SELECT XMLAGG(XMLELEMENT (
    "orders",
    XMLATTRIBUTES ( o_orderkey AS "orderkey", o_custkey AS "custkey", o_orderstatus AS "orderstatus", o_totalprice AS "totalprice", o_orderdate AS "orderdate", o_orderpriority AS "orderpriority", o_clerk AS "clerk", o_shippriority AS "shippriority", o_comment AS "ps_comment"),
    (SELECT XMLAGG(XMLELEMENT (
    "lineitem",
    XMLATTRIBUTES ( l_orderkey AS "orderkey", l_partkey AS "partkey", l_suppkey AS "suppkey", l_linenumber AS "linenumber", l_quantity AS "quantity", l_extendedprice AS "extendedprice", l_discount AS "discount", l_tax AS "tax", l_returnflag AS "returnflag", l_linestatus AS "linestatus", l_shipdate AS "shipdate", l_commitdate AS "commitdate", l_receiptdate AS "receiptdate", l_shipinstruct AS "shipinstruct", l_shipmode AS "shipmode", l_comment AS "comment")
    FROM LINEITEM l
    WHERE l.l_orderkey = o.o_orderkey
    FROM ORDERS o
    WHERE o.o_custkey = c.c_custkey
         FROM CUSTOMER c
    WHERE c.c_nationkey = n.n_nationkey
    FROM NATION n
    WHERE n.n_regionkey = r.r_regionkey
    FROM REGION r;

    Tim,
    Oracle Reports was the orginal way to do this in an Oracle Apps environment. However, the XML Publisher team built a tool called data templates to do this as well. You can read several articles on how to use data templates on the XMLP blog. Here's the first arcticle in a series: http://blogs.oracle.com/xmlpublisher/2006/11/08#a127.
    Bryan

  • How to add doctype when generating XML from an arbitrary data structure

    I was reading SUN's tutorial "Working with XML - PART IV: Using XSLT". Inside this tutorial, in 3, it talks about how to generate XML from an arbitrary data structure making use of a XMLReader and a Transformer. The example only shows adding elements. Is there a way to add DTD information in the XML generated, i.e. <!DOCTYPE ... >? What APIs can I use?
    Thanks,
    Alex

    The simplest way seems to me is to use a XSL file for that. The <xsl:output> attributes doctype-system and doctype-public generate the DTD declaration <!DOCTYPE YOUR_ROOT SYSTEM "yourDTDfile.dtd"> and <!DOCTYPE YOUR_ROOT PUBLIC "yourDTDfile.dtd">, respectively.
    When calling transformerInstance.transform() the XSLT processor performs the identity transformation - it just copies elements, attributes, content, processing instructions and comments to the result stream.
    If you're using an xsl file for your transformation already, simply add <xsl:output doctype-system="yourDTDfile.dtd"/> to your existing XSL file.
    If you're only using the identity transformation you'd need to change the line of code where you obtain the transformer instance from the TransformerFactory to:
    t_factory.newTransformer(new StreamSource("test.xsl"));
    and use this as test.xsl:
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       <xsl:output doctype-system="yourDTDfile.dtd"/>
       <!-- this is the identity transformation -->
       <xsl:template match="*|@*|comment()|processing-instruction()|text()">
          <xsl:copy>
             <xsl:apply-templates select="*|@*|comment()|processing-instruction()|text()"/>
          </xsl:copy>
       </xsl:template>
    </xsl:stylesheet>Good luck.

  • How to generate XML from EBusiness suite ARXSGPO

    Could someone tell me how I can generate XML from the EBusiness Suite Accounts Receivable report ARXSGPO.rdf I understand this report is called by a C program. I have tried changing the concurrent request to output format to XML the result does not resemble XML. Does anyone have any suggestions how I can generate XML from the ARXSGPO report?
    Thanks,
    Mark

    Hi Mark
    the next release of XMLP will have last page only support. The problem is that at the template layer you do not know how many lines are going to fit on the page, so you never know what is going to be the last page. The only way around it for now is to specify the number of lines to a page and then check when all the lines have been rendered and then render the remit portion.
    I have a sample invoice that does the same, drop me a mail, you can work out the email from my name and the fact I work for XMLP Im sure.
    Tim

  • How to generate XML from SQL query

    possible ways to generate XML from SQL qury.
    i want to generate XML of following query. "Select * from emp,dep wher emp.deptno=dept.deptno"

    Hello.
    Can you try:
    SQL> set pages 0
    SQL> set linesize 150
    SQL> set long 9999999
    SQL> set head off
    SQL> select dbms_xmlgen.getxml('Select * from emp,dep wher emp.deptno=dept.deptno') from dual;
    It works fine for me.
    Octavio

  • Error while generating .plx from .pll using Forms 4.5 Generator

    I get frm-30312 error while trying to generate .plx from .pll
    using Forms 4.5 Generator. I have both Oracle 8i and Oracle 7 on
    my computer. I work under Windows 2000 with Service Pack 1.
    Could anyone help my with this bug? Forms 6i Compiler generates
    .plx but Forms 4.5 Generator fails.
    frm-30312 "Could not compile library."
    Raimundas

    Hi Kuldeep,
    The WSDLC task which you are using in WLS8.1 ehich is not correct..."weblogic.wsee.tools.anttasks.WsdlcTask" The above taskDef is present WLS9.x Onwards.
    Please use the following Task for WLS8.1 (http://download-llnw.oracle.com/docs/cd/E11035_01/wls100/webserv_ref/anttasks.html#wp1075710)
    <wsdl2service
    wsdl="wsdls/myService.wsdl"
    destDir="myService/implementation"
    packageName="example.ws2j.service"/>
    Thanks
    Jay Sensharma
    http://jaysensharma.wordpress.com/webservices/ (WebLogic Wonders Are Here)
    Edited by: Jay SenSharma on Feb 16, 2010 1:30 PM

  • How to copy file to another server from database using FTP in oracle

    How to copy file to another server from database using FTP in oracle.
    Please do the needfaul.

    Billy  Verreynne  wrote:
    BluShadow wrote:
    Not to mention that some FTP servers can return more than one return message per operation whereas others may return one message for the same operation.I had the problem using the LIST command to determine if a file exists on the server. Cannot be determined via the FTP server's return code. Which means parsing and checking the text response from the server to the command. And this vary from server to server.
    But the basics were quite easy to code. The entire package is 500 lines, includes comments and blank lines for formatting, and supports the basic FTP client command set. Not really a complex piece of software to write - but I found that many developers seem to think that writing network socket software is complex. Not really the case...Mine's a big larger, but incorporates functionality similar to what Chris provided in his, such as being able to use SQL to query a remote file using pipelined functions, or functionality to write the results of a query directly to a remove file.
    :)

  • How to display multiple tables from database using netbeans swing gui

    plz reply asap on how to display multiple tables from database using netbeans swing gui into the same project

    Layered Pane with JTables or you can easily to it with a little scripting and HTML.
    plzzzzzzzzzzzzzzzzz, do not use SMS speak when posting.

Maybe you are looking for

  • Elements 11 organiser won't open

    Wjhen I plug in my Nikon D300s the downloader won't open, but when my D80 is plugged in it opens automatically.

  • Documentation on SDD_% views

    Is there any documentation on these views. I can't find anything in API and Model Reference Guide. The reason I think I need this is that we are about to go through a process of table and column renaming and I want to produce queries which show the o

  • "Reverse Parent Lookup"

    Hello Not quite sure if I should post this here, or in the 3D section - but here goes (in here ^^) I'm currently in the process of scripting a 3D interface system which has a simple scenegraph associated with it. Now, all my objects have an ancestor

  • Page erring if FND Diagnostics profile is not set

    Hi, I did see the old thread, but I do not have the same code issue.  Here is the part of my CO code that seems to be erring.  This is a dialog page with Yes/No button and error occurs when the Yes button is clicked.  If is set the FND Diagnostics pr

  • In need of your assistance please, for HP pavilion DV6 7007tx

    Hello, I previously updated my bios into Insyde F.24 (see attached images) which was ok at first, but when i decided to update my graphics drivers to its manufacturers driver (Nvidia), I started to experience my HP Pavilion DV6 heating up whenever i