XML output to a file

Hi,
I am using XSU to querry a table and generate XML output.
When I execute a file (say for example test.sql), is there a way I can save this XML output to a file (say 'something.xml') ??
Can any one help ?
Thanks.
vikram

Hi,
Thanks for your reply.
But I am sorry I didn't get you. I can't use the second option because I am not using XSQL.
Coming to the first option, I didn't understand where to type
java OracleXML ... > SomeFile.xml
Can you explain pls ?
Once again this is what I have got....
Say, I have a file test.sql which contains the following code
select xmlgen.getXML('select * from scott.emp1',1) from dual;
commit;
set serveroutput on
Now, when I execute the file in SQL prompt I get the following output.
<ROWSET>
<ROW num="1">
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<MGR>7902</MGR>
<HIREDATE>1980-12-17 00:00:00.0</HIREDATE>
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
</ROW>
<ROW num="2">
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>1981-02-20 00:00:00.0</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
<DEPTNO>30</DEPTNO>
</ROW>
</ROWSET>
I want this result to go to a file (.xml) instead of displaying the output in the SQL prompt.
How do I do this ? Pls explain. Thanks.
vikram
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
Two ways:
(1) Just redirect the output to a file like:
java OracleXML ... > SomeFile.xml
(2) Use the XSQL Command Line utility
and build an XSQL Page that describes
the query you want to do. Then you can
do:
$ xsql yourfile.xsql SomeFile.xml<HR></BLOCKQUOTE>
null

Similar Messages

  • Write CLOB XML output to a file on UNIX box (file size 32 K)

    All,
    Can someone give me a sample code of how to write a CLOB output in a CLOB variable (holds XML output generated from DBMS_XMLQUERY) to a text file on UNIX box?
    I found on ask tom a technique which only write upto 32K length. My CLOB output is more than 32K.
    from ASK TOM:
    create or replace
    procedure clob_to_file( p_dir in varchar2,
    p_file in varchar2,
    p_clob in clob )
    as
    l_output utl_file.file_type;
    l_amt number default 32000;
    l_offset number default 1;
    l_length number default
    nvl(dbms_lob.getlength(p_clob),0);
    BEGIN
    l_output := utl_file.fopen(p_dir, p_file, 'w', 32760);
    while ( l_offset < l_length )
    loop
    utl_file.put(l_output,
    dbms_lob.substr(p_clob,l_amt,l_offset) );
    utl_file.fflush(l_output);
    l_offset := l_offset + l_amt;
    end loop;
    utl_file.new_line(l_output);
    utl_file.fclose(l_output);
    end;
    Thanks

    Fortran and C strings are different. When passing a string to Fortran from C, you have to know the Fortran string's length, and pad the trailing part of the string with blanks (spaces). Modern C functions never write a string without a NUL terminator, so you cannot write directly to the Fortran string unless you ensure there is at least one extra character. My guess is that your output strings contain embedded NUL characters, which somehow causes problems in the file I/O routines, but not to stdout.
    According to your C fread() calls, I am assuming that you use hard-wired lengths of len(nis)==15 and len(sys)==32.Here is an example that may work, (without the #includes). It is similar to yours, but blanks-pads the result starting from the first control or NUL character. It is also a subroutine (void result) because 'bit' was just returned uninitialized in your code. Like yours, there is no error checking, but NIS should end up all blanks if there is an error.
    #define NIS_LEN 15
    void operating_sys(char nis[NIS_LEN]) {
      int i;
      FILE *stream;
      nis[0]=0;
      stream=popen("/bin/nisdomainname","r");
      fgets(string,sizeof(string),stream);
      fread(nis,1,NIS_LEN,stream);
      pclose(stream);
      for (i=0;i<NIS_LEN;i++) {
        if (nis<' ') {
    memset(&nis[i],' ',NIS_LEN-i);
    break;

  • BSP XML output to a file

    Hello, I would like to know how to output the XML generated by a BSP (Business Server Page) to a file.  We have a URL to execute a BW query using BSP...this outputs the report in XML to the Internet Explorer page... I am interested in knowing if there is a way to capture the output to a file when executing the BSP (not manually copying and pasting..).
    Thanks.

    i use the following method:
    leave the layout portion blank.
    and in oninitialization :
    prepare the data in xml format by hand or
    use call transformation and then use
    call method response->if_http_entity~set_cdata
      exporting
        data = xml_out.

  • Extract XML output to a file from a Query

    Hi Gurus,
    I want to know how can I achieve this. Please post some sample code.
    i want to extract output of following query into xml
    select customer_name,address,phone,email
    from tn_customers
    where rownum <1001
    here i wil get 1000 records.
    Is there any way to generate mxl into a file from the above query?
    Please help

    First you must have defined a output directory:
    create directory OUTPUT_DIRECTORY as 'c:\work'
    Then you need a function which creates the xml for you, for example:
    function create_xmltype
    return xmltype
    is
    queryctx dbms_xmlquery.ctxtype;
    result clob;
    begin
    -- set up the query context...!
    queryctx := dbms_xmlquery.newcontext ('select customer_name,address,phone,email from tn_customers where rownum <1001');
    -- get the result..!
    result := dbms_xmlquery.getxml (queryctx);
    -- Now you can use the result to put it in tables/send as messages..
    dbms_xmlquery.closecontext (queryctx); -- you must close the query handle..
    return xmltype(result);
    end;
    And last but not least you must create the file. This is shown in next code:
    procedure write_file
    is
    cursor c_cur
    is
    select primary_id, clob_stuff
    from table;
    l_output_directory varchar2 (200) := 'OUTPUT_DIRECTORY';
    output_file utl_file.file_type;
    l_xml xmltype;
    l_blob blob;
    l_data_length number;
    l_offset number default 1;
    l_chunk constant number default 4000;
    l_csid number;
    l_csid_value varchar2 (100);
    begin
    -- make sure we are using correct character set id
    select value
    into l_csid_value
    from nls_database_parameters
    where parameter = 'NLS_CHARACTERSET';
    select nls_charset_id (l_csid_value)
    into l_csid
    from dual;
    for r_cur in c_cur
    loop
    l_xml := xmltype (r_cur.clob_stuff);
    l_blob := l_xml.getblobval (l_csid);
    l_data_length := dbms_lob.getlength (l_blob);
    -- Open the file
    output_file := utl_file.fopen (l_output_directory, r_cur.primary_id || '.xml', 'wb', l_chunk);
    loop
    -- Exit when our file offset is bigger than our file
    exit when l_offset > l_data_length;
    -- Write the output chunk by chunk
    utl_file.put_raw (output_file, dbms_lob.substr (l_blob, l_chunk, l_offset), true);
    -- Increment the offset by the amount written
    l_offset := l_offset + l_chunk;
    end loop;
    -- Close the file and reset offset
    utl_file.fclose (output_file);
    l_offset := 1;
    end loop;
    end write_file;

  • Smartform xml output

    Hello Frnds,
    Actually I want to store the output of the smartformx xml output in a file.
    I am able to see it in spool ... but how to get it into a file ?
    How & where to ser port type FILE.
    Thanks & Regards

    Hi ,
    Check this thread, may be it helps you
    xml output from smartforms
    smartform output
    Re: FB_CONVERT_FORM_TO_XML ?
    Re: XML OUTPUT
    http://help.sap.com/saphelp_nw04/helpdata/en/6c/28923c114011d5b675006094192fe3/frameset.htm
    Regards,
    Raghav
    Message was edited by:
            Raghavendra  L

  • XML output while running in Apps 11i

    Hi,
    I'm running a report in Oracle Applications 11i. Is it possible to customize the report so that when it runs (invoked as a concurrent request), it generates XML output (to a file) rather than (or in addition to) a report on screen? Is there some parameter setting that would allow this?
    Thanks,
    - NR

    hello,
    in case the version you use is 6i you can use the parameters DESFORMAT, DESTYPE and DESNAME to determine type, format and destination of your report.
    by spefifying DESTYPE=FILE DESFORMAT=XML DESNAME=myfile.xml it will produce a file called myfile.xml in XML format.
    the only thing that is questionable, is if applications 11i lets you specify these parameters. you will have to check that with your applications 11i support.
    regards,
    the oracle reports team

  • When running an xml publisher report the xml output leads to 9 mb and the excel output file leads to 20 mb.But the output records is originally 4000 records. When copy to new excel it is showing 3.5 mb only. Does anyone knows the answer for this issue?

    When running an xml publisher report the xml output leads to 9 mb and the excel output file leads to 20 mb. The records contained in excel file is 4000 records. When taking the excel records and copy to new excel file the excel file size is 3.5 mb only.Why does the oracle software generates 20mb file?
    Does any one knows the answer please advice?

    Hello,
    This issue is because the Excel output from BI Publisher is MHTML (XML Publisher generates XHTML) not binary .xls.
    MHTML and XHTML are more verbose formats than binary .xls.
    It will be large because the current Excel output is just an HTML and not compressed like PDF. Please use the workaround (save it as .xls file).  This is a known limitation of RTF layout templates.
    BI Publisher Enterprise has a new feature True Excel Templates. The layouts generate binary Excel output.
    Excel Output File Size Generated By BI Publisher is Very Large (Doc ID 760437.1)
    Bogdan

  • How to calculate number of data records in a XML output file

    Hi,
    After generating a XML output file from Oracle Reports, I want to calculate number of records in the XML file. Is it possible? Specifically, I want to calculate number of records for a group variable ( organization_id, which I use for bursting).
    Thanks for the help.

    Thanks BIPuser. It is useful for me.
    I can use this xsl function within the template. However, I'm also looking to print this in the concurrent request log file. So, outside of rtf template, id there any PL/SQL based XML functions I can use to count the number of records.
    Thanks.

  • ns0 Prefix in XML output file

    Dear Gurus,
    I am working on a scenario where vendor master is triggered from  SAP-XI--FTP.
    when i am posting the vendor master on FTP.. i am getting
    the xml output with prefix as below
    <ns0:VENDORID>0000100000</ns0:VENDORID>at each element in vendor master xml file.
    Instead of  <VENDORID>0000100000</VENDORID>
    could anyone tell how to fix this prefix at each level.
    Does i need to add any module in file receiver adapter..or any patch i need to apply ..
    we are on SP9 PI 7.0
    Kind Regards,
    Vijay

    Hi,
    I tryed as per blog earlier ..it is not working
    i am using file receiver adapter...any other solution to fix this.
    Regards,
    Vijay

  • Need to reference file name within the XML Output

    Not sure if this is possible, as I'm new to the livecycle/XML world. But I need to be able to reference a file within the XML output from the PDF.
    The Scenario is that a pdf form of a business card will be issued to 50 franchisees for them to type in their names and mobiles, click submit and the XML file to be sent to myself, and be imported in to InDesign populating their data ready for printing. Up to here I have it working perfectly.
    However as each franchisee have a combination of up to 5 logos to place in the bottom corner to save having to have various templates with different combinations of logos and having to ensure the correct templates are used. I intend to reference each companies combination as an EPS and make the reference within the xml out and have it import directly in with the other data. I can type the code directly within the xml but I would like to have the form reference it directly in the xml output. Is this possible or am expecting to much of livecycle? Any help/advice greatly appreciated.
    David

    Hi MadhavaGanji,
    I have post how to validate the file name, header row against definition table which stored the file name and column definition. 
    Take a look and see if this is helpful.
    http://sqlage.blogspot.com/2013/11/ssis-validate-file-header-against.html
    http://sqlage.blogspot.com/

  • How to Generate XML Output file

    Hi,
    I want to print sample output XML file.
    I got this link 362496.1
    An output file can be generated via the Preview functionality available under the XML Publisher Administrator responsibility. Navigation path :
    1. Login to the application as SYSADMIN
    2. Responsibility: XML Publisher Administrator
    3. Function: Templates
    4. Select a Template for which a Preview Data file has been uploaded in the past.
    5. Click on the Preview icon
    6. Save the PDF to the client PC
    7. Determine the version either by the above instructions OR by provide the PDF file to Global Customer Support.But in #4 I can not populate any values to search, even if I put all %.
    How can I get a valid search?
    Thanks a lot,
    Ms K

    Hi;
    AFAIK if you prepare template in XML publisher than you can take output as pdf, by the way you can take xml output too
    Please check user guide:
    http://www.oracle.com/technology/products/xml-publisher/docs/XMLP5.6.1UserGuide.pdf
    Oracle XML Publisher and Oracle Reports
    Oracle XML Publisher and Oracle Reports
    Also Please check below thread:
    XML output for pdf concurrent program
    http://www.quovera.com/whitepapers/downloads/xml_oracle.pdf
    Generate XML output using DBMS_XMLGEN.getxmltype and not from rdf
    http://www.orafaq.com/forum/t/35204/2/
    Hope it helps
    Regard
    Helios

  • XML output file with Control M Characters

    Hi,
    I am using JDOM API 1.0 on Solaris platform.
    Using the XMLOuputter I write the XML data to a file. But the XML file contains Control-M characters at the end of each line..like
    <User>^M
    <Name>Satish</Name>^M
    <id>12567</id>^M
    </User>^M
    File f = new File(path,Constants.USER_XML);
    Document doc = getDocument();
    XMLOutputter out = new XMLOutputter();
    out.setFormat(Format.getPrettyFormat());
    Format outFormat = out.getFormat();
    outFormat.setLineSeparator(System.getProperty("line.separator"));
    outFormat.setIndent(" ");
    try{
    FileWriter fw = new FileWriter(f);
    out.output(doc,fw);
    } catch(IOException iox) {}I am not writing the Control-M characters. Also I am using the default encoding which is UTF-8. So how to avoid the control characters. Thanks in advance.
    Regards,
    Satish

    Those are carriage-return (CR) characters. I don't know anything about the classes you are using but I would suggest you let the software decide what line endings it is going to use (the XML default is line-feed (LF) only) instead of telling it. Just a guess.
    It's also possible that those CRs were in your input document and you are just copying them to the output document. XML parsers are supposed to normalize those characters to only LF but perhaps your parser isn't doing that. Just another guess.

  • Q: XML Publisher build template on Word then Output to Excel file

    Hi All
    When create template on MS-Word then output to Excel file
    When Data Format include percentage then output to Excel The Excel just only show two decimal
    Ex: 9.6549% Excel show ->9.65%
    * Except 9.6549% on Excel *
    Thanks
    Johnson

    Hi
    What version of XML/BI Publisher you have?
    Thanks
    Ravi

  • Java file with xml output..

    Hi all,
    I am executing a java code in the command prompt.
    It takes input of an xml file and gives the result in the command prompt itself which contains the complete format of soap file... using data.append(line);
    data.append("/r/n");
    Now it shows the whole output in the command line and i want it to create an xml or html file and transfer the output into that file....How will i do it... Im using HTTPClient..

    Is the output already in the XML or HTML format you desire?
    If so you can just pipe it down to a file
    In DOS Command Prompt (i think that's what you are using) what you do is use the > sign like this
    dir > test.txt
    Instead of getting the dir listing in the screen, it's piped down to the file
    So what you do is
    java yourJavaFile > yourOutput.xml (this is the simplified version, put your flags and everything there, after your command add > and the file name)
    If you are using Unix/Linux systems, i think that the pipe command is || instead of >, but i'm not sure
    If the result is not in the format you need, then you'll have to open a FileWriter in your code, and just write the things down in a file, in the manner you want.

  • XML Output  File using PLSQL

    I like to generate an XML output file using the PLSQL. Can any one help with an example (using EMPand DEPT). I tried the forum but seems confusing to me...
    This is URGENT so please rush!

    Please refer to the following post:
    page 0 security: authorization scheme not applied to other pages

Maybe you are looking for

  • How to access my old email address

    i have just changed to btinternet from orange, I was told I could use my old email address, but I cannot access in btyahoo. l have also changed my computer which uses windows 7 that seems not to  support outlook express which I was using to access my

  • Blank pages while printing in BO6.5.1

    Post Author: Saravanan Perumal CA Forum: Desktop Intelligence Reporting Hi, I'm trying to create a Business objects report 6.5 with more tables and cells than will fit across one page. This results blank pages while printing, Is there any option to f

  • Determining whether an integer is a floating-point number

    I want to create a program that when an integer is input into the numeric constant, a floating-point number with all zeros to the right of its decimal point will light the LED on the front panel. The LED will remain unlit for any other floating-point

  • Search error-Query component status initialzing

    When I try to search anything on my sharepoint site its is showing Internal Server Exception. When I looked into the Central Administartion->Search Service:Search Administration,the Query Component 0 status is stuck on initilialzing.So how can I solv

  • Setup and Security of XP Mode in Windows 7 SP1

    I purchased my new ThinkPad W530 with Windows 7 SP1 and XP Mode factory installed to allow use of some "legacy" programs.  Presumably the first thing I have to do (if I can figure out how to get XP activated) is to download all the updates before ext