Generating XML Tags in PLSQL using XMLELEMENT

Hi All,
I am trying to generate XML Tags using XMLELEMENT. Does anyone has an example for this. I have special characters in my DATA so the normal Concatenation does not work.........
Thanks In Advance.

try select xmlelement("ELEMENT_NAME",column)
into var
from dual;
var must be defined as xmltype

Similar Messages

  • Generating xml tags with stored procedure

    Hi Friends,
    I have to create a xml report using procedure .the code is given here to generate xml tags.
    create or replace procedure sri_xml (errbuff out varchar2,
    retcode out number) as
    /* create cursor to fetch the records*/
    cursor c_emp is select empno,
    ename,
    deptno,
    sal,
    job
    from emp;
    begin
    /* first line of xml data should be "<? xml version = "0.1"?>" */
    fnd_file.put_line(fnd_file.output,'<?xml version = "1.0" ?>');
    fnd_file.put_line(fnd_file.output,'<per_emp1>');
    for c in c_emp loop
    /* for each record create a group tag <gemp_name> at start */
    fnd_file.put_line(fnd_file.output,'<G_EMP_NAME>');
    /*EMBEDD DATA BETWEEN XML TAGS */
    fnd_file.put_line(fnd_file.output,'<empno>' || c.empno || '</empno>');
    fnd_file.put_line(fnd_file.output,'<ename>' || c.ename || '</ename>');
    fnd_file.put_line(fnd_file.output,'<sal>' || c.sal || '</sal>');
    fnd_file.put_line(fnd_file.output,'</G_EMP_NAME>');
    end loop;
    fnd_file.put_line(fnd_file.output,'</per_emp1>');
    end;
    i run the procedure in the concurrent program with output mode as text and i got the xml tags as the out put. i have created the template using the data definition and registered them in the xml publisher administer but i am unable to get the out put when i run the concurrent request it is giving the message "AUTHENTICATION FAILED".
    please help me to solve the problem and to get the desired output with desired template.
    thanks in advance,
    siddam

    Hi Siddam,
    Please post your query on BI Publisher forum.
    There are number of folks who can resolve the issue u faced.
    Please go through the bi publisher developers guide and then design the report.
    I am not sure about the process ur following for report development...i think you have to create data defination and rtf layout and then attach it to oracle xml administrator responsibility.
    Ratnesh

  • Generate XML file from RFC using Web Services

    Hi,
      I am trying to save an RFC enabled Function Module output to an XML file using ABAP web services.
    I could able to create Web Service and release it using WSCONFIG/WSADMIN. I can actually get the output in XML file when i launch the web service home page. But I need this to be done in the ABAP program itself. So If i run the RFC I could able to create,release web service and capture the Generated XML file by SOAP runtime.
    Any FM available?
    Thanks,
    Ram Sanjeev

    which version of WAS you are on .
    if you are on WAS6.40 check the following weblog on how to consume webservice using the wsdl file.
    /people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap
    lower version of WAS use class cl_http_client.
    if this case you have to manually build the soap message.
    /people/durairaj.athavanraja/blog/2004/09/20/consuming-web-service-from-abap
    Regards
    Raja

  • Dbassist generates XML how can I use

    The dbassist tool in 9i generates XML files for the template definitions.
    Are there any DTD for this XML?
    How can I use this templates in silent mode (without GUI) to generate the creation scripts.

    The GeoRaster metadata is schema-based, so you have to give the scheme name when call the XML SQL functions. For example,
    select t.tmimage.metadata.extract(
    '/gr:georasterMetadata/gr:layerInfo/gr:objectLayer',
    'xmlns:gr=http://xmlns.oracle.com/spatial/georaster')
    from landsat t
    where t.id=0;
    or
    select t.tmimage.metadata.extract(
    '/georasterMetadata/layerInfo/objectLayer',
    'xmlns=http://xmlns.oracle.com/spatial/georaster')
    from landsat t
    where t.id=0;

  • Generate xml file from plsql ..

    Hi,
    I am using oracle 9i.
    I have written a script to generate o/p in text file . Its working fine to generate text file.
    I wish to create xml file for the same output. How to do this ??
    declare
    emp_rec emp%ROWTYPE;
    file_id UTL_FILE.FILE_TYPE;
    BEGIN
    file_id := utl_file.FOPEN ('C:\test','test.html','w');
    FOR emp IN (SELECT empno,ename FROM emp)
    LOOP
    utl_file.PUT_LINE( file_id, emp.empno );
    utl_file.PUT_LINE( file_id, emp.ename );
    END LOOP;
    utl_file.fCLOSE(file_id);
    END;
    --- Desired output ---
    <?xml version="1.0" encoding="utf-8" ?>
    <Start>
    <Row>
    <EName>SMITH</EName>
    <EMPNO>7369</EMPNO>
    </Row>
    <Row>
    <EName>SMITH</EName>
    <EMPNO>7499</EMPNO>
    </Row>
    <Row>
    <EName>ALLEN</EName>
    <EMPNO>7521</EMPNO>
    </Row>
    </Start>
    declare
    emp_rec emp%ROWTYPE;
    file_id UTL_FILE.FILE_TYPE;
    BEGIN
    file_id := utl_file.FOPEN ('C:\test','test.html','w');
    FOR emp IN (SELECT empno,ename FROM emp)
    LOOP
    utl_file.PUT_LINE( file_id, emp.empno );
    utl_file.PUT_LINE( file_id, emp.ename );
    END LOOP;
    utl_file.fCLOSE(file_id);
    END;
    Pls guide.

    Michael,
    I've some problem regarding execution of your process -
    satyaki>ed
    Wrote file afiedt.buf
      1  declare
      2    ctx integer := dbms_xmlgen.newcontext('select ename "EName", empno from emp');
      3  begin
      4    dbms_xmlgen.setRowTag(ctx, 'Row');
      5    dbms_xmlgen.setRowSetTag(ctx, 'Start');
      6    dbms_xslprocessor.clob2file(dbms_xmlgen.getxml(ctx), 'c:\', 'Test.xml');
      7* end;
    satyaki>/
      dbms_xslprocessor.clob2file(dbms_xmlgen.getxml(ctx), 'c:\', 'Test.xml');
    ERROR at line 6:
    ORA-06550: line 6, column 3:
    PLS-00201: identifier 'DBMS_XSLPROCESSOR.CLOB2FILE' must be declared
    ORA-06550: line 6, column 3:
    PL/SQL: Statement ignored
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    satyaki>Why is it throwing error?
    Is this because of lack of privs? Or anything else?
    Regards.
    Satyaki De.

  • Need to generate xml tags

    select B.PERIOD_NAME,B.VENDOR_NAME,B.AMOUNT,A.VENDOR_NAME AS VENDOR,A.LINE_AMOUNT,A.SEGMENT2,A.DESCRIPTION,A.COST_CENTER,A.VERTICAL from (
    select distinct aida.period_name,gcc.segment2,
    ffv.description ,asa.vendor_name,asa.vendor_id,sum(aia.invoice_amount)LINE_AMOUNT,
    bbb.description cost_center, bbb1.description vertical
    from
    ap_invoices_all aia
    ,ap_invoice_distributions_all aida
    ,gl_code_combinations_kfv gcc,
    ap_suppliers asa,
    fnd_flex_values_vl ffv,
    (select gcc.segment3,ffv.description
    from gl_code_combinations_kfv gcc,
    fnd_flex_values_vl ffv,
    fnd_flex_value_sets ffvs
    where gcc.segment3 = ffv.flex_value
    and ffvs.flex_value_set_id = ffv.flex_value_set_id
    and ffvs.flex_value_set_name = 'HEGICL_COST_CENTRE_VS'
    ) bbb,
    (select gcc.segment4,ffv.description from gl_code_combinations_kfv gcc,
    fnd_flex_values_vl ffv,
    fnd_flex_value_sets ffvs
    where ffvs.flex_value_set_id = ffv.flex_value_set_id
    and ffvs.flex_value_set_name = 'HEGICL_VERTICAL_VS'
    and gcc.segment4 = ffv.flex_value) bbb1
    where aia.invoice_id = aida.invoice_id
    and aida.dist_code_combination_id = gcc.code_combination_id
    and asa.vendor_id = aia.vendor_id
    and asa.vendor_type_lookup_code = 'VENDOR'
    -- and ffv.flex_value = gcc.segment2
    -- and asa.vendor_name in ('A Suresh Babu','Adinath Jadhav','Bindi Thakkar')
    and aia.gl_date between (select '1'||substr(:p_period_name1,1,6) from dual) and (select last_day('1'||substr(:p_period_name2,1,6)) from dual)
    and gcc.segment2 like '4%'
    and AP_INVOICES_PKG.GET_POSTING_STATUS( AIa.INVOICE_ID)= 'Y'
    group by
    gcc.segment2 , ffv.description ,asa.vendor_name,aida.period_name
    ,bbb.description, bbb1.description,asa.vendor_id)A,
    ( select distinct p.period_num,x.* from (
    select * from (
    select aida.period_name,asa.vendor_name,asa.vendor_id,sum(aia.invoice_amount)as Amount from
    ap_invoices_all aia
    ,ap_invoice_distributions_all aida
    ,gl_code_combinations_kfv gcc,
    ap_suppliers asa
    where
    aia.invoice_id = aida.invoice_id
    and aida.dist_code_combination_id = gcc.code_combination_id
    and asa.vendor_id = aia.vendor_id
    and asa.vendor_type_lookup_code = 'VENDOR'
    -- and ffv.flex_value = gcc.segment2
    and aia.gl_date between (select '1'||substr(:p_period_name1,1,6) from dual) and (select last_day('1'||substr(:p_period_name2,1,6)) from dual)
    and gcc.segment2 like '4%'
    and AP_INVOICES_PKG.GET_POSTING_STATUS( AIa.INVOICE_ID)= 'Y'
    -- and rownum < 11
    group by
    asa.vendor_name,aida.period_name,asa.vendor_id
    order by Amount desc)
    where
    rownum < 11
    ) x ,gl_period_statuses p
    where p.period_name = x.period_name
    order by p.period_num)B
    where a.vendor_ID = B.VENDOR_ID
    Regards
    Chandra

    for example
    select dbms_xmlgen.getxml('select empno, ename from emp where rownum <3') from dual
    <?xml version="1.0"?>
    <ROWSET>
    <ROWSET>
      <EMPNO>1</EMPNO>
      <ENAME>123</ENAME>
    </ROW>
    <ROW>
      <EMPNO>9999</EMPNO>
      <ENAME>Tim</ENAME>
    </ROW>                                                                                    
    </ROWSET>      or
    SELECT xmlelement("ROWS", xmlagg( xmlelement("ROW",xmlelement("EmpNumber", empno), xmlelement("EmpName", ename))))
    FROM emp
    WHERE rownum<3
    <ROWS><ROW><EmpNumber>1</EmpNumber><EmpName>123</EmpName></ROW><ROW><EmpNumber>9999</EmpNumber><EmpName>Tim</EmpName></ROW></ROWS>                                                                                                                                                                                                                    

  • 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.

  • 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 to generate xml file with multiple nodes using sqlserver as database in SSIS..

    Hi ,
    I have to generate the xml file using multiple nodes by using ssis and database is sqlserver.
    Can some one guide me on to perform this task using script task?
    sudha

    Why not use T-SQL for generating XML? You can use FOR XML for that
    http://visakhm.blogspot.in/2014/05/t-sql-tips-fun-with-for-xml-path.html
    http://visakhm.blogspot.in/2013/12/generating-nested-xml-structures-with.html
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Generate xml-rpc request using xsd

    Hi All,
    I have one xsd file . I want to generate xml-rpc request file using this xsd file. If any body have any tools for that , can you please share this name with me. It's great help for me...
    Thank You,
    Pattanaik

    That's an interesting question. I thought it would be obvious that xmlbeans or "normal" xml-rpc packages would handle this.
    It turns out this doesn't seem to be true.
    Are you saying that you're trying to pass an object to a method and you want to deserialize the object into a java object of a type that is defined via an XSD? If this is the case you can use xmlbeans to do the xsd<->java mapping, then use just about any xml-rpc service to do the actual RPC mechanism.
    It's interesting that these two technologies haven't converged though...

  • Send as Email - xml tags contain LF

    I am trying to send the content of a form as email, in xml format.
    An xml file is generated as it is supposed to, and it contains all the data. My problem ist that all generated xml tags are invalid. After every tag name there is a line feed before the closing ">".
    The generated file looks like this:
    <tag
    ><innertag
    >content</innertag
    ></tag
    >
    Is this a known issue? What can I do so that those line feeds are not inserted?
    I am using Adobe LiveCycle Designer 8.2.1
    Thank you!

    When I open the pdf file with Adobe Acrobat Pro and then click send per email and save the xml file there are those LF characters inside each start tag and end tag.
    When I open the file with Notepad++ and tick "Show all symbols" it is displayed as follows:
    I am using a data connection to create the form from a xsd document. Can this be the source of the problem? It is a valid xml file.

  • Mapping of XML tags with column

    My xml structure is :
    <PARAMS>
    <ROWSET>
    <ROW NUM="1">
    <SID>man123</SID>
    <PO>
    <PO>OBJ1</PO>
    <PI>
    <PI>PARENTOBJ1 INSTANCE</PI>
    </PI>
    </PO>
    </ROW>
    </params>
    My table structure is :
    CREATE TABLE TEMP(SID VARCHAR2(20),PO POBJECT_T)
    where Object types are:
    CREATE OR REPLACE TYPE PINSTANCE_T AS OBJECT (PI VARCHAR2(255),CO COBJECT_T);
    CREATE OR REPLACE TYPE POBJECT_T AS OBJECT (PO VARCHAR2(255),PI PINSTANCE_T);
    To store this XML directly into table i have to have Column with name "PO" (same as XML tag).I am using this same table to store other XML with same tags . With this limitation its difficult to do so.Is there any way to map XML tag to column with different name????
    Thanks

    Hi,
    thx for your Reply,
    seems to work basicly but i get now in the IDE warnings with:
    "Data binding will not be able to detect changes when using
    square bracket operator. For Array, please use
    ArrayCollection.getItemAt() instead. "
    And how can i access the next item something like this didnt
    work right
    try someniceid.lastResult["some-root"]["someother-root"]
    I had to use single quotes (') to get it to work.
    Any ideas?
    Kind regards,
    Marko

  • XML Parser for PLSQL and BIG5/UTF-8

    I'm trying store data in traditional chinese submitted by IE5 (through oXMLHttpRequest.send() and javascript), I tried both 'encoding="BIG5"' and 'encoding="UTF-8"'.
    It seems that the parser ignore all characters that are not ascii regardless of their encoding.
    Any thoughts will be much appreciated
    procedure UpdateXMLProc(xmlSrc varchar2)
    is
    p xmlparser.parser;
    doc xmldom.DOMDocument;
    nlist xmldom.DOMNodeList;
    list_len pls_integer;
    node1 xmldom.DOMNode;
    node2 xmldom.DOMNode;
    node3 xmldom.DOMNode;
    begin
    p := xmlparser.newParser;
    xmlparser.parseBuffer(p, xmlSrc);
    doc := xmlparser.getDocument(p);
    nlist := xmldom.getElementsByTagName(doc, 'ROW');
    list_len := xmldom.getLength(nlist);
    -- loop through elements
    for j in 0..list_len-1 loop
    node1 := xmldom.item(nlist, j);
    -- get primary key values
    node2 := xmldom.getFirstChild(node1);
    loop
    -- get the text node and if not null get value
    node3 := xmldom.getFirstChild(node2);
    if not xmldom.isNull(node3) then
    -- THIS OUTPUT MAY ALTER CHARACTER IF IT'S NOT ASCII
    htp.p(xmldom.getNodeValue(node3));
    end if;
    -- get next field
    node2 := xmldom.getNextSibling(node2);
    exit when (xmldom.isNull(node2));
    end loop;
    end loop;
    -- THIS OUTPUT WILL BE IN THE SAME ENCODING AS THE ORIGINAL
    htp.p(xmlSrc);
    end;
    null

    I just ran the initjvm.sql,initdbj.sql and
    initsqlj.sql.
    Still getting the error.
    Please help!!!!
    Thanks
    Jay
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jay ([email protected]):
    I have Oracle8i Release 8.1.5.0.0 - ProductionWith the Java option
    PL/SQL Release 8.1.5.0.0 - Production version
    runnig in sun sparc server.
    While I am loading Oracle XML Parser for PLSQL(using plxmlparser_V1_0_1.tar.gz) have a problem. When I try to load the xmlparser.jar class and I get the
    following messages:
    initialization complete
    Error while accessing MD5 table
    ORA-00942: table or view does not exist
    loading : org/w3c/dom/DOMImplementation
    Error while loading org/w3c/dom/DOMImplementation
    ORA-04068: existing state of packages has been discarded
    ORA-04063: package body "TEST.LOADLOBS" has errors
    ORA-06508: PL/SQL: could not find program unit being called
    ORA-06512: at line 1
    creating : org/w3c/dom/DOMImplementation
    Error while creating class org/w3c/dom/DOMImplementation
    ORA-00406: COMPATIBLE parameter needs to be 8.1.0.0.0 or greater
    Error while accessing MD5 table
    ORA-00942: table or view does not exist
    loading : org/w3c/dom/html/HTMLDivElement
    Error while loading org/w3c/dom/html/HTMLDivElement
    ORA-04068: existing state of packages has been discarded
    ORA-04063: package body "TEST.LOADLOBS" has errors
    ORA-06508: PL/SQL: could not find program unit being called
    and so on.
    Could anyone please tell me if I need to do any pre-installation steps.
    Thanks
    Jay<HR></BLOCKQUOTE>
    null

  • Generation of XML Tags for columns in Lexical parameter in select query

    Hi,
    I have lexical parameter in my select statement of my data model in the report.
    How do i generate XML tags for these columns inside a Lexical Parameter?
    Simple Example: I have data model query as follows:
    SELECT msi.inventory_item_id
    &LP_SELECT
    FROM mtl_system_items_b
    Here my lexical Parameter LP_SELECT is generated in before report trigger as follows in my report:
    :LP_SELECT := 'msi.segment1,msi.description';
    So, the question is how to generate XML Tags for columns in Lexical Parameter(as in the example above, i need XML tags for these columns - segment1 and description)
    Thanks,
    Ratan

    try this
    Select &order data_show
    from oe_order_headers_all
    where order_number ='7889'
    and setting  :order:='order_number';  in after parameter form trigger.
    Hope this helps
    Hamid

  • Generate XML-Files 4Gigabyte

    Hi,
    I must generate very big XML-Files(Size > 4GB)
    Our datasoure are saved in relational tables.
    From that tables we want to generate xml-Files.
    We used DBMS_LOB but we have problems with clob-size about 4GB.
    Our database version is 9.2.0.4.0
    How I can save relational datas in a XML-File?
    Thanks in advanced
    Michael

    You can use the XMLSAXSerializer and XSU in the XDK Java package. You can use it to build SAX program to dump the result.

Maybe you are looking for

  • Error "The Connection Failed" in Time Machine, Migration Assistant and Restore From DVD

    I am receiving this error when trying to connect to my Time Machine Backup in my Time capsule. I input the proper password to access my Time Capsule and It returns me to the screen with the caption "The connection failed" under the Time Capsule name

  • Album artwork turns solid black (for one album only)

    I recently decided to get serious about adding missing artwork to my collection (most of it was ripped long ago, before such things were quite as turnkey). By now, I've added artwork to dozens of albums with no problem, then I got to one where I add

  • Movies on ipod

    i hope someone can help, i have downloaded instant handbrake but still can't get a movie imported to my ipod. so frustrating, itunes keeps "quitting unexpectedly" when i try to sync or import a movie. Any thoughts ?? anyone?? thanks

  • ORA-00939 when creating XML table with Virtual Columns

    Getting error on creating table with VIRTUAL COLUMNS: Error at Command Line:4 Column:31 Error report: SQL Error: ORA-00939: too many arguments for function 00939. 00000 - "too many arguments for function" Without VIRTUAL COLUMNS works fine. Where to

  • Firefox 22 won't open PDFs

    Ever since updating Firefox/Mac to v.22, the built-in Firefox PDF viewer won't open PDFs. Any PDF link automatically downloads the file. I've set the Applications control for PDFs to "Preview in Firefox". I've also reset the mimeTypes.rdf file, but n