XMLGEN package

Is any one used xmlgen package, how is better than xsql.
and from where i can load that.
Thanks in Adv.

Hi,
You could still do it with SQL/XML functions :
SQL> with sample_data as (
  2   select sysdate as start_date from dual union all
  3   select cast(null as date) from dual
  4  )
  5  select xmlserialize(document
  6          xmlelement("ROOT",
  7           xmlattributes('http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi"),
  8           xmlagg(
  9            xmlelement("START_DATE",
10              xmlattributes(nvl2(start_date, null, 'true') as "xsi:nil"),
11              start_date
12            )
13           )
14          )
15          as clob indent
16         ) as result
17  from sample_data
18  ;
RESULT
<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <START_DATE>2011-03-08</START_DATE>
  <START_DATE xsi:nil="true"/>
</ROOT>
Is there a way using DBMS_XMLGEN that I generate the DETAILS tag seperately, then append HEADER tag.Possibly, but that depends on the SQL query you're using.
Could you post a simplified example, with table structures and sample data, and the XML output you require.
Database version would help too.
Thanks.

Similar Messages

  • DTD verification procedure/function in xmlgen package??

    Is there a function or procedure in xmlgen package that verifies if the xmldocument is compliant with the DTD just like an error is generated if we use Java OracleXML putXML while using Java. Also, I am getting a system class not found (/oracle/rdbms/aurora/compiler) error when loading xmparser.jar file. Should I load the aurora.zip file first using the sys user in C:\oracle\ora81\javavm\lib directory ??

    We can build Java Stored Procedures on Java Classes. If this is your case then the java source will not be visible in the USER_SOURCE view.
    You can see what classes you have loaded in the schema (and whetehr you have the source for them) by running this query (warning: very slow!):
    select name, source
    from USER_JAVA_CLASSES
    /Alternatively you can run this
    select dbms_java.longname(object_name), object_type
    from   user_objects
    where  object_type like 'JAVA%'
    /or join the two together...
    select name, kind, source
    from USER_JAVA_CLASSES
    where name in (  select dbms_java.longname(object_name)
    from   user_objects
    where  object_type = 'JAVA SOURCE')
    /Cheers, APC

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

  • How to create xmlgen pl/sql package

    Hi,
    I am trying to read a xml file and insert the data present in it into database table.
    On internet i found a code which uses xmlgen package. In my database i am unable to find xmlgen pckg.
    I am using 10.2.0.1.0 database on windows XP.
    Please tell me how to create xmlgen package.
    Thank You,
    Niranjan.

    Hi All,
    I can access dbms_xmlgen but the code i am using uses package xmlgen.
    Please find below the code.
    declare
    charString varchar2(80);
    finalStr varchar2(4000) := null;
    rowsp integer;
    v_fileHandle utl_file.file_type;
    begin
    xmlgen.setRowsetTag('Zipcodes');
    xmlgen.setRowTag('mappings');
    dbms_output.enable(1000000);
    v_fileHandle := utl_file.fopen('d:\test','test.xml','r');
    loop
    begin
    utl_file.get_line(v_fileHandle,charString);
    exception
    when no_data_found then
    utl.fclose(v_fileHandle);
    exit;
    end;
    dbms_output.putline(charString);
    if finalStr is not null then
    finalStr := finalStr || charString;
    else
    finalStr := finalStr;
    end if;
    end loop;
    rowsp := xmlgen.insertXML('scott.zipcodes',finalStr);
    xmlgen.resetOptions;
    end;
    The procs and fun present in xmlgen are not present in dbms_xmlgen.
    Is there any package as XMLGEN or i am getting confused.
    Thank You,
    Niranjan

  • Sharing XML packages among users

    Hello all,
    I have a question about the installation of the Oracle XML packages and sharing them among users.
    Our DBA thought it might be best to create a special user (user1) and install all of the XML packages, utilities under that user schema. We went this route and were trying to use that users's xml objects with another user (user2).
    When trying to generate XML output from SQL using the xmlgen package as user2 we get the following error.
    SQL> set serveroutput on size 1000000
    SQL> DECLARE
    2 v_query VARCHAR2(200) := 'SELECT ''monkey'' AS Animal FROM dual';
    3 BEGIN
    4 DBMS_OUTPUT.PUT_LINE(DBMS_LOB.SUBSTR(xmlgen.getXML(v_query), 250, 1));
    5 END;
    6 /
    DECLARE
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: java.util.MissingResourceException:
    can't find resource for oracle.xml.sql.mesg.XSUMessages_en_US
    ORA-06512: at "SXXML.XMLGEN", line 465
    ORA-06512: at "SXXML.XMLGEN", line 456
    ORA-06512: at line 4
    However running that same anonymous PL/SQL block as user1 we get success:
    SQL> set serveroutput on size 1000000
    SQL> DECLARE
    2 v_query VARCHAR2(200) := 'SELECT ''monkey'' AS Animal FROM dual';
    3 BEGIN
    4 DBMS_OUTPUT.PUT_LINE(DBMS_LOB.SUBSTR(sxxml.xmlgen.getXML(v_query), 250, 1));
    5 END;
    6 /
    <?xml version = '1.0'?>
    <ROWSET>
    <ROW num="1">
    <ANIMAL>monkey</ANIMAL>
    </ROW>
    </ROWSET>
    So I have several questions:
    1> What is the best way to install these XML packages so that all users can use these utilities?
    2> What access privileges need to be granted to user2 so that user1 AML utilities are available?
    Thanks in advance.
    Regards,
    Bediako George

    Thanks for the quick reply Steve: I have an observation and a couple of questions.
    First my observation. I looked for the java resource that "turned up missing" as far as my user2 user is concerned and I couldn't find it in sxxml's schema. ( I was logged in as sxxml). I attempted to create a wrapper package belonging to sxxml sxhema as I understood. However even after granting execute privilege to my second user I got the same message.
    Finally I removed the authid as current_user tag from the package declaration and I was able to get it to work.
    I am not comfortable with this solution and would like to get this set up the right way. You said my second option was to grant execute privilege on the missing Java resource to my second user.
    How do I locate this "missing" Java resource?
    How do I grant execute privilege to a Java resource?
    What are the ramifications of solving the problem the way I did?
    Thanks again for your help.
    Regards,
    Bediako
    create or replace package xmlgen AUTHID CURRENT_USER...This means that it runs under the security domain of whatever user executes it, not under the security domain of the package owner/definer.
    Either GRATN EXECUTE on this Java resource to your new user, or alternatively, have your SXXML schema create a wrapper package for XMLGEN that is created using the default of definer's rights. Then, anyone that you GRANT EXECUTE to your wrapper procedure can use it.<HR></BLOCKQUOTE>
    null

  • Xmlgen rowid attribute

    I am using the xmlgen package to return an xml result set to java. I am trying to eliminate the id attribute that prints within each row tag. The documentation states that I can use xmlgen.setRowIDAttrName() and pass in an empty string or null to accomplish this. However, when I try this like xmlgen.setRowIDAttrName(NULL) or xmlgen.setRowIDAttrName(''), it does not work. The resulting xml still has the default num="1" ect. I have been successful in changing the name of the attribute but not eliminating it. Does any know if I am doing something wrong or another way to do this? Thanks.

    I'm having the same problem. However, if you use the DBMS_XMLQuery method you will be okay:
    FUNCTION dateXML RETURN CLOB IS
    query VARCHAR2(1000);
    result CLOB;
    queryCtx DBMS_XMLquery.ctxType;
    BEGIN
    query := 'select sysdate from dual';
    queryCtx := DBMS_XMLQuery.newContext(query);
    DBMS_XMLQuery.setRowsetTag(queryCtx,'html');
    DBMS_XMLQuery.setRowTag(queryCtx,'body');
    DBMS_XMLQuery.setRowIdAttrName(queryCtx,null);
    result := DBMS_XMLQuery.getXML(queryCtx);
    DBMS_XMLQuery.closeContext(queryCtx);
    return result;
    END;
    Apparently the OracleXMLStaticQuery.setRowIdAttrName method (used by DMBS_XMLQuery) works properly, but the OracleXMLStore.setRowIdAttrName method (used by xmlgen) does not.
    Is there another solution or fix for this?
    null

  • Xmlgen whitespace

    Hi!
    I have written a procedure in pl/sql that accepts a query (among a few other
    things) and generates an XML document using Oracle's XML SQL Utility
    (XSU) using the xmlgen package in particular to generate the xml.
    When the xml document is generated I get these line breaks scattered here and there--and end up in the middle of a tag which gives me an error. I've tried using strip space but it doesn't seem to be doing anything and I've tried adjusting the linesize but nothing.... Can anybody offer any words of wisdom????
    Below is some of the code in the procedure followed by a sample xml document that's generated by it.
    xmlgen.setStyleSheet('http://customreports/xml-stylesheet1.xsl', 'text/xsl');
    /* Take the query string passed in and generates the XML document */
    xmlString := xmlgen.getxml(QueryStr,1);
    xmlgen.setRaiseException(v_error);
    /* If any errors have occurred, nothing will be written to the file */
    IF v_error THEN
    /* Open the file to read/write in "replace" mode which removes all existing lines in the file if it exists.
    Will create the file if it does not exist */
    out_file := UTL_FILE.FOPEN(FileDir,FileName,'w');
    /* Read the buffer contents and write it to a file */
    dbms_lob.open(xmlString,dbms_lob.lob_readonly);
    loop
    dbms_lob.read(xmlString,amount,position,charString);
    utl_file.put_line(out_file, charstring);
    position := position + amount;
    end loop;
    ELSE
    RETURN; --return with no error
    END IF;
    <?xml version = '1.0'?>
    <?xml-stylesheet href="http://kingston/customreports/xml-stylesheet1.xsl" type="text/xsl"?>
    <ROWSET>
    <ROW num="1">
    <ID>1</ID>
    <NAME>Jane Austen</NAME>
    <GENRE>DRAMA</GENRE>
    <NUM_BOOKS>20</NUM_BOOKS>
    </R
    OW>
    <ROW num="2">
    <ID>2</ID>
    <NAME>Emily Bronte</NAME>
    <GENRE>DRAMA</GENRE>
    <NUM_BOOKS>15</NUM_BOOKS>
    </ROW>
    <ROW num="3">
    <ID>3</ID>
    <NAME>Stephen King</NAME>
    <GENRE>HORROR</GENRE>
    <NUM_BOOKS>30</N
    UM_BOOKS>
    </ROW>
    <ROW num="4">
    <ID>4</ID>
    <NAME>Jennifer Gilmore</NAME>
    <GENRE>SCIENCE FICTION</GENRE>
    <NUM_BOOKS>0</NUM_BOOKS>
    </ROW>
    <ROW num="5">
    <ID>5</ID>
    <NAME>Agatha Christie</NAME>
    <GENRE>MYSTE
    RY</GENRE>
    <NUM_BOOKS>17</NUM_BOOKS>
    </ROW>
    </ROWSET>
    null

    fixed it....

  • How to set encoding in XMLGen

    I need to have an XML doc generated from the server with the encoding set to Big5.
    I just was looking at the XMLGen utilties to replace our own PL/SQL procedures for generating XML from a query. However I can't see any option to specify the encoding.
    Does anyone know how to do this.
    Rob
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Rob Edgar:
    I need to have an XML doc generated from the server with the encoding set to Big5.
    I just was looking at the XMLGen utilties to replace our own PL/SQL procedures for generating XML from a query. However I can't see any option to specify the encoding.
    Does anyone know how to do this.
    Rob
    <HR></BLOCKQUOTE>
    XMLGEN.SETENCODINGTAG('ISO-8859-P1');
    will do this for the output XML data. You must specify the charater set based on the NLS_LANG environment variable/registry setting to match this tag.
    I used TOAD to look at the SYS.XMLGEN package definition to see extra info on this utility. You should be able to do the same using the ALL_SOURCE view from SQL*Plus.
    null

  • SetDateFormat in XMLGEN

    The setDateFormat method in the
    XMLGEN package does not seem to
    work correctly. It will fail
    on parsing the next date no
    matter what the format after being
    set, even when set to the default.
    Xmlgen.setDateFormat('YYYY-MM-DD HH24:MI:SS')
    Will cause an insert in that format
    to fail???
    scottg

    Hello,
    The reason you are having this problem is that your date format syntax is wrong (i.e. your mask is wrong). Please refer to the java class SimpleDateFormat documentation. It is there that they give a nice explanation of how the date mask should look like. The XSU uses java representation of the date mask.
    visar
    ps.: The link below with take you to the documentation I am talking about. Good luck. http://java.sun.com/products/jdk/1.2/docs/api/java/text/SimpleDateFormat.html

  • PL/SQL procedure to process XML file

    I am just starting to work on xml, and we are using PL/SQL stored procedures to process xml file. I did find the sample code in the package (family.sql). This sample print out all element names and attributes. My questions are :
    (1) I tried to modify the code to print out the element values (or Node values). Here is the code:
    -- get all elements and values
    nl := xmlparser.getElementsByTagName(doc, '*');
    len := xmlparser.getLength(nl);
    -- loop through elements
    for i in 0..len-1 loop
    n := xmlparser.item(nl, i);
    dbms_output.put_line('NodeName: ' &#0124; &#0124; xmlparser.getNodeName(n) &#0124; &#0124; ' ');
    dbms_output.put_line('NodeValue: ' &#0124; &#0124; xmlparser.getNodeValue(n) &#0124; &#0124; ' ');
    end loop;
    However, it did not print out the values, although it did print out the name. what's wrong with it? how can I get the value?
    (2) I have the following xml file:
    <?xml version="1.0"?>
    <profile>
    <id>1</id>
    <name>Company</name>
    <des>master profile</desc>
    <subprofile>
    <subid>1</subid>
    <subname>group1</subname>
    <subdesc>group profile</subdesc>
    </subprofile>
    </profile>
    now, I'd like to print out all the children of the <subprofile> node, that is <subid>, <subname> and <subdesc>. Here is my code:
    -- get subprofile nodelist
    qnlist := xmlparser.getElementsByTagName(doc, 'subprofile');
    -- get length of the nodelist
    len := xmlparser.getLength(qnlist);
    -- loop through elements
    for i in 0..len-1 loop
    qnode := xmlparser.item(qnlist, i);
    qnnode := xmlparser.getFirstChild(qnode);
    qnchild := xmlparser.getFirstChild(qnnode);
    dbms_output.put_line(xmlparser.getNodeName(qnnode));
    dbms_output.put_line(xmlparser.getNodeValue(qnchild));
    LOOP
    if (xmlparser.isNULL(xmlparser.getNextSibling(qnnode))) then exit;
    END IF;
    qnnode := xmlparser.getNextSibling(qnnode);
    qnchild := xmlparser.getFirstChild(qnnode);
    dbms_output.put_line(xmlparser.getNodeName(qnnode));
    dbms_output.put_line(xmlparser.getNodeValue(qnchild));
    END LOOP;
    end loop;
    when I execute the procedure, I get the following output:
    #text
    I am not sure what's wrong with it. Basically, I didn't know the procedure to traverse the tree since here it's a little different from OO programming. Could someone give a sample code which demonstrate the procedure which can get a specific element's name and values? (for my exapmle, the name and value of the <subname>, or <subid>, <subdesc>).
    Also, is there a way to insert a part of xml file into a DB table? in my case, insert the subprofile into a table. I know the xmlgen package has a procedure to insert a xml file into a table, but not a part of xml. And can I insert a xml file into several tables instead of one table, using xmlgen package?
    looking forward to hearing from you. any suggestion and sample code would be helpful. thank you very much.
    null

    I sloved my first question: to get the Nodevalue, I need to use getFirstChild(n);
    But, I still didn't figure out the second
    problem. Actually, It works when I modified my xml file as following:
    <?xml version="1.0"?>
    <profile>
    <id>1</id>
    <name>Company</name>
    <des>master profile</desc>
    <subprofile><subid>1</subid><subname>group1</subname><subdesc>groupprofile</subdesc></subprofile>
    </profile>
    All the <subprofile>....</subprofile> must be in one line without any return. This is unbelievable! It suppose that xml does not matter new lines. I tested my code, it seems space is fine, but new line. Something must be wrong in my code.
    please give any suggestion. Thanks,
    Yudong
    null

  • 1.2 JVM crashes using XML SQL Utility 1.1.10 (NT 8.1.5)

    I am trying to use the XML SQL Utility for Java (Oracle 8.1.5) to obtain a DTD or XML schema for tables in our database.
    I have installed the XSU111.ZIP archive,
    set the CLASSPATH and stuff, loaded the JAR
    files (xmlparserv2.jar, oraclexmlsql.jar)
    processed the xmlgenpkg.sql script (following the installation instructions)
    When I execute the samples in Java, the JVM (JDK 1.2.2) crashes in javai.dll.
    The same error occurs when I run java OracleXML getXML ....
    The installation file (env.bat) lists the JDBC driver ZIP as CLASSES12.ZIP, which is of course, not available for 8.1.5, which is what the download instructions indicated is appropriate for XSU 1.1.1.
    Any ideas? Do I need to upgrade to 8.1.6?
    Can I patch the JDBC with classes12.ZIP.
    By the way, when I execute the commands in PL/SQL using xmlgen package, everything is fine.
    Regards and Much thanks

    Set JDK_HOME to the directory where you install your JDK (Java Development Kit).
    So instance, I've install JDK1.1.8 on my
    C drive so
    set JDK_HOME=c:\jdk1.1.8;c:\jdk1.1.8\bin

  • XML,CLOB  AND MEMORY : CONSUMED BUT NOT RELEASED !!!

    Hi,
    I'm working with XMLGEN Package and XSLT Processor to produce XML Document on Oracle 8.1.7.3 server, I use 9i XML and Java packages.
    I'm facing the following BIG MEMORY problem :
    Environment : I must generate an XML parsed with an XSL document of 80Mo (nearly 22 000 rows),
    as XMLGEN is on DOM parsing method, I extract my XML by 500 Rows and I loop until 22 000 rows. I use DBMS_JOB with jobs who read and execute export each minute.
    The algorithme is :
    keeprow=22000
    while keeprow>0
    Create 3 clob (DBMS_LOB Package) : one for XSL Sheet, one for XML and one for result
    GetXML (XMLGEN Package)
    Transform in XSL (XSL Processor)
    Write to disk (UTL_FILE Package)
    Free the 3 Clob ((DBMS_LOB Package))
    keeprow =keeprow-500
    loop
    The problem : The process start at 250Mo ot total memory and END at 1000 Mo of used memory and NEVER RELEASE 1 ko of memory.
    So often I get a JavaOutOfMemoryError (I've allocated 1Go Ram to my JAVA process).
    Any help will be very very appreciated !
    My derived problem is 22 000 rows is not enough I've some export of 200 000 rows to do (And I cannot allocate 10 Go of RAM !!!)
    Following My PL/SQL Code.
    Regards
    Fred
         PROCEDURE DO_EXPORT_XML(
                   P_JOB_ID JOB_PARAMETRE.JOB_ID%TYPE,
                   P_JOB_ID_ORDRE JOB_PARAMETRE.JOB_ID_ORDRE%TYPE,
                   P_CLE_UP UPLOADREQ_TEMP.ID%TYPE,
                   P_LOAD_OR_DELOAD VARCHAR2)
              IS
              L_FILE_NAME JOB_PARAMETRE.JOB_FILE_NAME_DEST%TYPE;
              L_REP_NAME JOB_PARAMETRE.JOB_REP_NAME_DEST%TYPE;
              L_FILE_STYLESHEET JOB_PARAMETRE.JOB_STYLESHEET%TYPE;
              L_VERSION_PDM JOB_PARAMETRE.JOB_VPDM%TYPE;
              P_SELECT varchar2(4000):='';
              P_CURSOR varchar2(4000):='';
         l_filehandler_out UTL_FILE.FILE_TYPE;
              --Variable pour le traitement par lot de 500
              L_NBROW_TODO_ATONCE number := 500;
              L_NBROW_MIN number := 1;
              L_NBROW_MAX number := -1;
              L_NBROWKEEPTODO number := -1;
              xslString CLOB := null;
              res number default -1;
              xmlString CLOB := null;
              li_ret number := 0;
              li_faitle number := 0;
              amount integer:= 255;
              li_loop integer := 0;
              charString varchar2(255);
              ls_deload varchar2(255) default '';
              ls_SQL varchar2(4000) default '';
              ls_temp_file varchar2(255) default '';
              text_file_dir varchar2(32) := 'e:\temporarydir';
              l_par xmlparser.parser;
         l_xml xmldom.domdocument;
         l_pro xslprocessor.processor;
         l_xsl xslprocessor.stylesheet;
              docfragnode xmldom.DOMNode;
              docfrag xmldom.DOMDocumentFragment;
              l_parsedclob clob := null;
              l_amount binary_integer := 32767;
              l_ligne varchar2(32767);
              l_offset number default 1;
              l_pos number default null;
              l_pos2 number default null;
              l_lobsize number default null;
              l_memsize number default 1073741824; --1024 Mo
              l_mempipo number default 0;
              type rc is ref cursor;
              l_cursor rc;
              cursor TEMPLATE is select UNSPSC,1 as NB from UPLOADREQ_TEMP where 1=2;
              c1rec TEMPLATE%rowtype;          
              BEGIN
              l_mempipo:=setmaxmemorysize(l_memsize);
              dbms_lob.createtemporary(l_parsedclob, true, dbms_lob.session);
              dbms_lob.createtemporary(xmlstring, true, dbms_lob.session);
              --return the good select
              GET_SELECT_TO_EXPORT_XML(P_JOB_ID , P_JOB_ID_ORDRE , P_CLE_UP , P_SELECT,P_CURSOR, P_LOAD_OR_DELOAD);
                        SELECT JOB_FILE_NAME_DEST,JOB_REP_NAME_DEST,JOB_STYLESHEET
                        INTO L_FILE_NAME,L_REP_NAME,L_FILE_STYLESHEET
                        FROM JOB_PARAMETRE
                        WHERE JOB_ID =P_JOB_ID AND JOB_ID_ORDRE=P_JOB_ID_ORDRE;
                        l_filehandler_out := UTL_FILE.FOPEN(text_file_dir, L_FILE_NAME, 'w',l_amount);
                        --Return XSL Sheet in a clob : cause of memory consumed  but not released
                   xslString := METACAT.load_a_file( 1,L_FILE_STYLESHEET);     
                        open l_cursor for P_CURSOR;
    LOOP
                   fetch l_cursor into c1rec;
                   exit when l_cursor%notfound;
                             L_NBROW_MIN := 1;
                             L_NBROW_MAX := 0;
                             L_NBROWKEEPTODO:=c1rec.NB;
                             LOOP
                             begin
                                  if(L_NBROWKEEPTODO > L_NBROW_TODO_ATONCE) THEN
                                       begin
                                       L_NBROW_MAX:= L_NBROW_TODO_ATONCE + L_NBROW_MAX;
                                       L_NBROWKEEPTODO:= L_NBROWKEEPTODO - L_NBROW_TODO_ATONCE;
                                       end;
                                  else
                                       begin
                                       L_NBROW_MAX:= L_NBROW_MAX + L_NBROWKEEPTODO;
                                       L_NBROWKEEPTODO:=0;
                                       end;
                                  end if;
                                  --on ouvre le fichier de risultats
                                  ls_SQL:= P_SELECT || ' AND ( ROWNUM BETWEEN ' || L_NBROW_MIN || ' AND ' || L_NBROW_MAX || ' ) and UNSPSC=''' || c1rec.UNSPSC || '''';
                                  ls_temp_file := c1rec.UNSPSC || '_' || L_FILE_NAME;
                                  L_NBROW_MIN:=L_NBROW_TODO_ATONCE + L_NBROW_MIN;
                                  --CAT_AUTOLOAD.JOB_ADD_TRACE (P_JOB_ID,'UPLOAD REQUISITE : Export donnies REQUETE ' || to_char(li_loop), ls_SQL,'',0,0);
                                  xmlgen.resetOptions;
                                  xmlgen.setErrorTag('ERROR_RESULT');
                                  xmlgen.setRowIdAttrName('NAH');
                                  xmlgen.setRowIdColumn('NAH');
                                  xmlgen.setEncodingTag('ISO-8859-1');
                                  xmlgen.useNullAttributeIndicator(false);
                                  if(xmlString is not null) then
                                       dbms_lob.open(xmlString,dbms_lob.lob_readwrite);
                                       l_lobsize:= dbms_lob.Getlength(xmlString);
                                       if(l_lobsize>0) then
                                       dbms_lob.erase(xmlString,l_lobsize,1);
                                       end if;
                                       dbms_lob.close(xmlString);
                                  dbms_lob.freetemporary(xmlString);
                                       dbms_lob.createtemporary(xmlstring, true, dbms_lob.session);
                                  end if;
    --Return XML in a clob : cause of memory consumed  but not released
                                  xmlString := xmlgen.getXML(ls_SQL,0);
                                  l_par := xmlparser.newparser;
                                  xmlparser.parseclob(l_par, xslString);
                                  l_xsl := xslprocessor.newstylesheet(xmlparser.getdocument(l_par),null);
                                  xmlparser.parseclob(l_par, xmlString);
                                  l_xml := xmlparser.getdocument(l_par);
                                  l_pro := xslprocessor.newprocessor;
                                       xslprocessor.showWarnings(l_pro, true);
                                       xslprocessor.setErrorLog(l_pro, text_file_dir || substr(ls_temp_file,0,length(ls_temp_file)-4) || '_logerreur.XML');
                                       if(l_parsedclob is not null) then
                                                 dbms_lob.open(l_parsedclob,dbms_lob.lob_readwrite);
                                                 l_lobsize:= dbms_lob.Getlength(l_parsedclob);
                                                 if(l_lobsize>0) then
                                                 dbms_lob.erase(l_parsedclob,l_lobsize,1);
                                                 end if;
                                                 dbms_lob.close(l_parsedclob);
                                            dbms_lob.freetemporary(l_parsedclob);
                                                 dbms_lob.createtemporary(l_parsedclob, true, dbms_lob.session);
                                       end if;
                        --Return XML Processed with XSL in a clob : cause of memory consumed  but not released
                                  xslprocessor.processxsl(l_pro,l_xsl,l_xml,l_parsedclob);
                                       --release NOTHING
                                  xmlparser.freeparser(l_par);
                                  xslprocessor.freeprocessor(l_pro);
                                                      l_ligne:='';
                                                      l_offset :=1;
                                                      l_pos := null;
                                                      l_pos2 := null;
                                                      if(li_loop=0) then
                                                           begin
                                                                --on ouvre le fichier et on sauve l'entete + les donnies dedans.
                                                                     l_pos:=dbms_lob.instr(l_parsedclob,'</DATA>');
                                                      if ( nvl(l_pos,0) > 0 ) then
                                                                          loop
                                                                          if(l_pos-1>l_amount + l_offset ) then
                                                                                    l_ligne:=dbms_lob.SUBSTR(l_parsedclob,l_amount,l_offset);
                                                                                    UTL_FILE.PUT(l_filehandler_out,l_ligne);
                                                                                    UTL_FILE.fflush(l_filehandler_out);
                                                                                    l_offset:=l_offset+l_amount;
                                                                               else
                                                                                    l_ligne:=dbms_lob.SUBSTR(l_parsedclob,l_pos-1 -l_offset ,l_offset);
                                                                                    UTL_FILE.PUT(l_filehandler_out,l_ligne);
                                                                                    UTL_FILE.fflush(l_filehandler_out);
                                                                                    exit;
                                                                               end if;
                                                                          end loop;
                                                                     else
                                                                          EXIT;
                                                                     end if;
                                                           end;
                                                      else
                                                           --on met les donnies donc on ne repete pas le debut
                                                           begin
                                                                     l_pos:=dbms_lob.instr(l_parsedclob,'<ITEM');
                                                      if ( nvl(l_pos,0) > 0 ) then
                                                                     l_pos2:=dbms_lob.instr(l_parsedclob,'</DATA>');
                                                      if ( nvl(l_pos2,0) > 0 ) then
                                                                          loop
                                                                          if(l_pos + l_amount <= l_pos2 -1 ) then
                                                                                    l_ligne:=dbms_lob.SUBSTR(l_parsedclob,l_amount,l_pos);
                                                                                    UTL_FILE.PUT(l_filehandler_out,l_ligne);
                                                                                    UTL_FILE.fflush(l_filehandler_out);
                                                                                    l_pos:=l_pos +l_amount;
                                                                               else
                                                                                    l_ligne:=dbms_lob.SUBSTR(l_parsedclob,l_pos2 -1 -l_pos,l_pos);
                                                                                    UTL_FILE.PUT(l_filehandler_out,l_ligne);
                                                                                    UTL_FILE.fflush(l_filehandler_out);
                                                                                    exit;
                                                                               end if;
                                                                          end loop;
                                                                          else
                                                                          exit;                                                                      
                                                                          end if;
                                                                     end if;
                                                           end;
                                                      end if;
                                                 li_loop:=li_loop + 1 ;
                                                 --UTL_FILE.FCLOSE(l_filehandler_in);
                                                 JAVA_GC();
                                                 EXIT WHEN L_NBROWKEEPTODO=0;
                                                 Exception
                                                 when others then
                                                      begin
                                                      -- IF(utl_file.is_open(l_filehandler_in)) THEN
                                                      --               utl_file.fclose( l_filehandler_in);
                                                      -- END IF;
                                                      IF(utl_file.is_open(l_filehandler_out)) THEN
                                                                     utl_file.fclose( l_filehandler_out);
                                                      END IF;
                                                      RAISE_APPLICATION_ERROR(-20001,'File with errors');
                                                      end;
                             END;
                             END LOOP;
    END LOOP;
    CLOSE l_cursor;
                        if ( xmlString is not null ) then
                                  dbms_lob.open(xmlString,dbms_lob.lob_readwrite);
                                  l_lobsize:= dbms_lob.Getlength(xmlString);
                                  if(l_lobsize>0) then
                                  dbms_lob.erase(xmlString,l_lobsize,1);
                                  end if;
                                  dbms_lob.close(xmlString);
                                  dbms_lob.freeTemporary( xmlString);
                        end if;
                        if(l_parsedclob is not null) then
                                  dbms_lob.open(l_parsedclob,dbms_lob.lob_readwrite);
                                  l_lobsize:= dbms_lob.Getlength(l_parsedclob);
                                  if(l_lobsize>0) then
                                       dbms_lob.erase(l_parsedclob,l_lobsize,1);
                                  end if;
                                  dbms_lob.close(l_parsedclob);
                                  dbms_lob.freetemporary(l_parsedclob);
                        end if;
                        UTL_FILE.NEW_LINE(l_filehandler_out);
                        l_ligne:='</DATA></CATALOG>';
                        UTL_FILE.PUT(l_filehandler_out,l_ligne);
                        UTL_FILE.FCLOSE(l_filehandler_out);                    
                   EXCEPTION
                   when others then
                             begin
                             IF(utl_file.is_open(l_filehandler_out)) THEN
                                       utl_file.fclose( l_filehandler_out);
                                  END IF;
                             end;     
              END;
    ******************************

    Thank you for the info - I had no idea I was puing myself in danger by cutting it so close.  Since your post I have moved my iphoto library to an external drive and now have 165 GB of space on my HD.  Following this I have 2 questions.
    1.  Since my available HD space was reduced by the size of the photo download it seems logical that the download is somewhere on my HD still.  Is there a place where these photos might be hiding on my HD even though they are not available on the iphoto library?
    2.  I was able to recover the .jpg files which are fine.  I also recovered the .mov files but they have been compromised.  I am hoping I can find the originals still on the HD somewhere.  If not, do you have any suggestions for recovery methods or programs?  I have not used the SD card since the incident so I should be able to attempt another recovery to salvage the .mov files if there is an alternative method/program available.
    Thanks again!

  • How to apply XSLT to XML file while importing XML data using XSU plsql API

    I need to load XML file with nested repeating elements into Oracle tables and I am using XSU PLSQL API utility package dbms_xmlSave.insertXML. Can use XMLGen package also!!
    I found out through documentation that I need to have XML file with ROWSET/ROW tags around the elements. As I have no control of XML file coming from external source, so I wish to apply XSLT to XML. I found setXSLT/setStylesheet procedures but it's not working as expected.
    Can you help me with some sample code for the purpose.
    Thanks

    I'm new at XML and XSL as well, but maybe the following code I built can help:
    CREATE OR REPLACE PACKAGE Xml_Pkg AS
    /* this record and table type are used for the transformTags procedure */
    TYPE TagTransform_t IS RECORD (
    old_tag VARCHAR2(255),
    new_tag VARCHAR2(255) );
    TYPE TagTransformList_t IS TABLE OF TagTransform_t INDEX BY BINARY_INTEGER;
    /* use DBMS_OUTPUT to print out a CLOB */
    PROCEDURE printClobOut(p_clob IN OUT NOCOPY CLOB);
    /* using a list of old/new tags, transform all old into new in XML2 */
    PROCEDURE transformTags(
    p_List TagTransformList_t,
    p_XML1 IN OUT NOCOPY CLOB,
    p_XML2 IN OUT NOCOPY CLOB);
    END Xml_Pkg;
    CREATE OR REPLACE PACKAGE BODY Xml_Pkg AS
    /* print a CLOB using newlines */
    PROCEDURE printClobOut(p_clob IN OUT NOCOPY CLOB) IS
    buffer_overflow EXCEPTION;
    PRAGMA EXCEPTION_INIT(buffer_overflow,-20000);
    l_offset NUMBER;
    l_len NUMBER;
    l_o_buf VARCHAR2(255);
    l_amount NUMBER; --}
    l_f_amt NUMBER := 0; --}To hold the amount of data
    l_f_amt2 NUMBER; --}to be read or that has been
    l_amt2 NUMBER := -1; --}read
    l_offset2 NUMBER;
    l_amt3 NUMBER;
    l_chk NUMBER := 255;
    BEGIN
    l_len := DBMS_LOB.GETLENGTH(p_clob);
    l_offset := 1;
    WHILE l_len > 0 LOOP
    l_amount := DBMS_LOB.INSTR(p_clob,CHR(10),l_offset,1);
    --Amount returned is the count from the start of the file,
    --not from the offset.
    IF l_amount = 0 THEN
    --No more linefeeds so need to read remaining data.
    l_amount := l_len;
    l_amt2 := l_amount;
    ELSE
    l_f_amt2 := l_amount; --Store position of next LF
    l_amount := l_amount - l_f_amt; --Calc position from last LF
    l_f_amt := l_f_amt2; --Store position for next time
    l_amt2 := l_amount - 1; --Read up to but not the LF
    END IF;
    /* divide the read into 255 character chunks for dbms_output */
    IF l_amt2 != 0 THEN
    l_amt3 := l_amt2;
    l_offset2 := l_offset;
    WHILE l_amt3 > l_chk LOOP
    DBMS_LOB.READ(p_clob,l_chk,l_offset2,l_o_buf);
    DBMS_OUTPUT.PUT_LINE(l_o_buf);
    l_amt3 := l_amt3 - l_chk;
    l_offset2 := l_offset2 + l_chk;
    END LOOP;
    IF l_amt3 != 0 THEN
    DBMS_LOB.READ(p_clob,l_amt3,l_offset2,l_o_buf);
    DBMS_OUTPUT.PUT_LINE(l_o_buf);
    END IF;
    END IF;
    l_len := l_len - l_amount;
    l_offset := l_offset+l_amount;
    END LOOP;
    EXCEPTION
    WHEN buffer_overflow THEN
    RETURN;
    END printClobOut;
    /* shortcut "writeline" procedure for CLOB buffer writes */
    PROCEDURE wr(p_clob IN OUT NOCOPY CLOB, s VARCHAR2) IS
    BEGIN
    DBMS_LOB.WRITEAPPEND(p_clob,LENGTH(s)+1,s||CHR(10));
    END;
    /* the standard XSLT should include the identity template or the output XML will be malformed */
    PROCEDURE newXsltHeader(p_xsl IN OUT NOCOPY CLOB, p_identity_template BOOLEAN DEFAULT TRUE) IS
    BEGIN
    DBMS_LOB.TRIM(p_xsl,0);
    /* standard XSL header */
    wr(p_xsl,'<?xml version="1.0"?>');
    /* note that the namespace for the xsl is restricted to the w3 1999/XSL */
    wr(p_xsl,'<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">');
    IF p_identity_template THEN
    /* create identity template (transfers all "other" nodes) */
    wr(p_xsl,' <xsl:template match="node()">');
    wr(p_xsl,' <xsl:copy>');
    wr(p_xsl,' <xsl:apply-templates/>');
    wr(p_xsl,' </xsl:copy>');
    wr(p_xsl,' </xsl:template>');
    END IF;
    END newXsltHeader;
    PROCEDURE newXsltFooter(p_xsl IN OUT NOCOPY CLOB) IS
    BEGIN
    /* standard xsl footer */
    wr(p_xsl,'</xsl:stylesheet>');
    END newXsltFooter;
    /* using the stylesheet in p_xsl, transform p_XML1 into p_XML2 */
    PROCEDURE transformXML(p_xsl IN OUT NOCOPY CLOB, p_XML1 IN OUT NOCOPY CLOB, p_XML2 IN OUT NOCOPY CLOB) IS
    l_parser XMLPARSER.Parser;
    l_doc XMLDOM.DOMDocument;
    l_xsl_proc XSLPROCESSOR.Processor;
    l_xsl_ss XSLPROCESSOR.Stylesheet;
    BEGIN
    /* parse XSL CLOB */
    l_parser := XMLPARSER.newParser;
    BEGIN
    XMLPARSER.showWarnings(l_parser,TRUE);
    XMLPARSER.parseClob(l_parser,p_xsl);
    l_doc := XMLPARSER.getDocument(l_parser);
    XMLPARSER.freeParser(l_parser);
    EXCEPTION
    WHEN OTHERS THEN
    XMLPARSER.freeParser(l_parser);
    RAISE;
    END;
    /* get Stylesheet from DOMDOC */
    l_xsl_ss := XSLPROCESSOR.newStylesheet(l_doc,NULL);
    BEGIN
    /* parse XML1 CLOB */
    l_parser := XMLPARSER.newParser;
    BEGIN
    XMLPARSER.showWarnings(l_parser,TRUE);
    XMLPARSER.parseClob(l_parser,p_xml1);
    l_doc := XMLPARSER.getDocument(l_parser);
    XMLPARSER.freeParser(l_parser);
    EXCEPTION
    WHEN OTHERS THEN
    XMLPARSER.freeParser(l_parser);
    RAISE;
    END;
    /* process doc to XML2 */
    l_xsl_proc := XSLPROCESSOR.newProcessor;
    BEGIN
    XSLPROCESSOR.processXSL(l_xsl_proc, l_xsl_ss, l_doc, p_xml2);
    XSLPROCESSOR.freeProcessor(l_xsl_proc);
    EXCEPTION
    WHEN OTHERS THEN
    XSLPROCESSOR.freeProcessor(l_xsl_proc);
    RAISE;
    END;
    XSLPROCESSOR.freeStylesheet(l_xsl_ss);
    EXCEPTION
    WHEN OTHERS THEN
    XSLPROCESSOR.freeStylesheet(l_xsl_ss);
    RAISE;
    END;
    END transformXML;
    /* transform XML1 into XML2 using list p_List of old/new tags */
    PROCEDURE transformTags(p_List TagTransformList_t, p_XML1 IN OUT NOCOPY CLOB, p_XML2 IN OUT NOCOPY CLOB) IS
    l_xsl CLOB;
    BEGIN
    /* create XSL CLOB */
    DBMS_LOB.CREATETEMPORARY(l_xsl,TRUE);
    /* create standard header with identity template */
    newXsltHeader(l_xsl,TRUE);
    /* create one template for each node translation */
    FOR i IN 1..p_List.COUNT LOOP
    wr(l_xsl,' <xsl:template match="'||p_List(i).old_tag||'">');
    wr(l_xsl,' <'||p_List(i).new_tag||'><xsl:apply-templates/></'||p_List(i).new_tag||'>');
    wr(l_xsl,' </xsl:template>');
    END LOOP;
    /* create standard footer */
    newXsltFooter(l_xsl);
    -- dbms_output.put_line('l_xsl:');
    -- dbms_output.put_line('--------------------');
    -- printClobOut(l_xsl);
    -- dbms_output.put_line('--------------------');
    transformXML(l_xsl, p_XML1, p_XML2);
    DBMS_LOB.FREETEMPORARY(l_xsl);
    /* -- unit testing
    set serveroutput on size 100000
    Declare
    queryContext DBMS_XMLQUERY.ctxType;
    xList XML_PKG.TagTransformList_t;
    xmlCLOB CLOB;
    xmlCLOB2 CLOB;
    Begin
    DBMS_LOB.CREATETEMPORARY(xmlCLOB,true);
    DBMS_LOB.CREATETEMPORARY(xmlCLOB2,true);
    xList(1).old_tag := 'A';
    xList(1).new_tag := 'MyTag1';
    xList(2).old_tag := 'B';
    xList(2).new_tag := 'MyTag2';
    queryContext := DBMS_XMLQUERY.newContext('Select * from t');
    xmlCLOB := DBMS_XMLQUERY.getXML(queryContext);
    DBMS_XMLQuery.closeContext(queryContext);
    dbms_output.put_line('xmlCLOB:');
    dbms_output.put_line('--------------------');
    XML_PKG.printClobOut(xmlCLOB);
    dbms_output.put_line('--------------------');
    xml_pkg.transformTags(xList,xmlCLOB,xmlCLOB2);
    dbms_output.put_line('xml2CLOB:');
    dbms_output.put_line('--------------------');
    XML_PKG.printClobOut(xmlCLOB2);
    dbms_output.put_line('--------------------');
    DBMS_LOB.FREETEMPORARY(xmlCLOB);
    DBMS_LOB.FREETEMPORARY(xmlCLOB2);
    End;
    END transformTags;
    END Xml_Pkg;

  • Error in adpatch while upgrading from 11.5.3 to 11.5.5

    Error while applying adpatch for upgrading workflow from 2.5 to 2.6(patch number - 2032040, database driver)
    ATTENTION: All workers either have failed or are waiting.
    Restarting all failed workers... (restart # 1)
    Fixed: file xmlparserv2.zip on worker 1 for product fnd username APPLSYS.
    Restarted: file xmlparserv2.zip on worker 1 for product fnd username APPLSYS.
    FAILED: file xmlparserv2.zip on worker 1 for product fnd username APPLSYS.
    ATTENTION: All workers either have failed or are waiting:
    FAILED: file xmlparserv2.zip on worker 1.
    while upgrading as first step I installed java(1.3) and altered file jserv.properties.
    I didnot reset path and classpath as it was not mentioned in their document
    then i was to xmlparser,
    HOW TO LOAD XML PARSER, XML SQL UTITLITY and XMLGEN PKG INTO THE 11i DATABASE
    To load the XML parser:
    10. loadjava -user apps/apps -r -v xmlparserv2.jar
    while doing this step i got 108 errors.
    then from metalink, i saw username/pwd should be sys/change_on_install
    then I got just one error.
              --------------------------- I got one error here
              cannot resolve org/xml/sax/helpers/AttributeListImpl
    I ignored and continued
    after doing remaining steps, i did
    load the XML SQL utility (XSU):
    create the XMLGEN package body:
    which went fine
    after that while applying patch 2032040, I got file xmlparserv2.zip on worker 1.
    I restarted the worker many times, but no success
    Regards
    Deepak

    Please review the following notes:
    Note: 400159.1 - Unable To Run Technology Stack Validation Report On Db Tier
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=400159.1
    Note: 362042.1 - Technology Stack Validation Utility Error on the Database Tier: ERRORMSG: Invalid APPS database user credentials
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=362042.1

  • Help Needed -- Oracle XML/SQL utility and PL/SQL parser

    Let's say we have an xml file
    <?xml version="1.0" standalone="no"?>
    <abc>
    <def>
    <ghi>test</ghi>
    </def>
    <jkl>
    <mno>testing</mno>
    </jkl>
    </abc>
    We can store the <def> tag in one table say def and <jkl> tag in another table say jkl.
    Is there a way to combine def and jkl and insert in one table so that there in one row with two columns test and testing??
    null

    Hi,
    Are u sure that it is a java enabled database? The most common
    case of failure with the xmlgen package is because the loadjava
    command did not succeed.
    Please make sure that oraclexmlsqlload.bat file loaded all the
    java procedures successfully. If not then u would have to java-
    enable your database by running the initjvm script. (please see
    the docs).
    Thx
    Murali
    Iveta Vojtko (guest) wrote:
    : Hi,
    : I have downloaded XML SQL Utility for Java against Oracle
    8.0.5
    : on WindowsNT. The xmlgen package was created successfully but
    : its body is invalid and my PL/SQL test has failed because of
    : following error: PLS-00103: Encountered the symbol "NAME"
    : when expecting one of the following: := . ( @ % ; not null
    range
    : renames default character. The symbol ":= was inserted abefore
    : "NAME" to continue.
    : Is it because I am not using Oracle8i? I just want to use the
    : server side of XML SQL. Please, reply asap. Thank you.
    Oracle Technology Network
    http://technet.oracle.com
    null

Maybe you are looking for

  • Can SAP take scrap into account with determining open production order qty?

    SAP appears to completely ignore scrap on production orders.  This isn't working for us.  What we would like is something like this: If the production order is for 20, we've confirmed scrap of 2, and confirmed 10 good, then the open quantity should b

  • Can not control / observe when no user logged in

    Been fighting this for weeks. Searched the forum but found no relief. Using ARD 3.2 we can control / observe from our office to several workstations both in our same building and in other offices around the country. On all but one we can control / ob

  • Load balancing RD Session host servers & Certificate error

    I have three RD Session host servers  Named RDSH1, RDSH2 and RDSH3. Two servers RDSH1 and RDSH2, are user  in addition to RD SH as RD CB and RD WA.  I have deploy both in  HE deployment with Windows NLB. RD CB and RD WA use the same  url CBPub.domain

  • Acrobat 8 & Online View Of Bookmarks

    I have a user that has noticed since upgrading to acrobat 8 that the bookmarks are no longer showing by default in the adobe reader online view. They seem to be fine when setting reader 8 to open locally in the preferences, but once you set the reade

  • Dynamically selecting value from SelectOneMenu

    I have a form where all employee records are displayed. On clicking Edit button for a particular employee,his details are displayed in another form. I am not able to select his name dynamically from h:SelectOneMenu . How to do it???????????? any idea