Using XML clob in loop

Hi,
I need to extract data from a given piece of XML. If I pass the xml to the procedure as clob and query it in a loop, it returns no rows. However if I include the actuall xml in the loop query it returns the data I'm looking for. Why doesn't it return data when using the clob?
1. Example code below works with xml included in the loop query:
BEGIN
   FOR x IN (    SELECT x.*
                   FROM XMLTABLE (
                           xmlnamespaces (
                              'http://schemas.xmlsoap.org/soap/envelope' AS "x",
                              'http://www.w3.org/2001/XMLSchema-instance' AS "xsi"),
                           PASSING xmltype (
                                      '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <loadServiceListResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <loadServiceListReturn href="#id0"/>
      </loadServiceListResponse>
      <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns1:ExternalSystemOutput" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="java:ExternalSystemOutput.TestIPA.nhsia.nhs">
         <standardOutput href="#id1"/>
         <systemData soapenc:arrayType="ns2:ExternalSystemData[2]" xsi:type="soapenc:Array" xmlns:ns2="java:ExternalSystemData.TestIPA.nhsia.nhs">
            <systemData href="#id2"/>
            <systemData href="#id3"/>
         </systemData>
      </multiRef>
      <multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:ExternalSystemData" xmlns:ns3="java:ExternalSystemData.TestIPA.nhsia.nhs" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
         <description xsi:type="soapenc:string">Prescription</description>
         <url xsi:type="soapenc:string">http://192.168.21.131:8080/nhsia/TestIPA/validate.jsp?sdwlhqw@5)vhuylfh@Suhvfulswlrq33509</url>
      </multiRef>
      <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:StandardOutput" xmlns:ns4="java:StandardOutput.TestIPA.nhsia.nhs" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
         <auditID xsi:type="soapenc:string"/>
         <statusID xsi:type="soapenc:string">0</statusID>
         <systemAvailability xsi:type="soapenc:string">Available</systemAvailability>
      </multiRef>
      <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns5:ExternalSystemData" xmlns:ns5="java:ExternalSystemData.TestIPA.nhsia.nhs" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
         <description xsi:type="soapenc:string">Appointment</description>
         <url xsi:type="soapenc:string">http://192.168.21.131:8080/nhsia/TestIPA/validate.jsp?vgzoktzC8,ykx|oikCGvvuotzsktz61409</url>
      </multiRef>
   </soapenv:Body>
</soapenv:Envelope>').
                                   EXTRACT (
                                      '//multiRef',
                                      'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"')
                           COLUMNS description VARCHAR2 (30) PATH 'description',
                                   url VARCHAR2 (250) PATH 'url') x)
   LOOP
      DBMS_OUTPUT.PUT_LINE('Rec:  '||x.description||' '||x.url);
   END LOOP;
END;
/Returns:
Rec:  
Rec:  Prescription http://192.168.21.131:8080/nhsia/TestIPA/validate.jsp?sdwlhqw@5)vhuylfh@Suhvfulswlrq33509
Rec:  
Rec:  Appointment http://192.168.21.131:8080/nhsia/TestIPA/validate.jsp?vgzoktzC8,ykx|oikCGvvuotzsktz614092. If I assign the XML to CLOB variable and reference the clob variable in loop query it returns no data:
DECLARE
   resp   CLOB :=             
                   '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <loadServiceListResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <loadServiceListReturn href="#id0"/>
      </loadServiceListResponse>
      <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns1:ExternalSystemOutput" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="java:ExternalSystemOutput.TestIPA.nhsia.nhs">
         <standardOutput href="#id1"/>
         <systemData soapenc:arrayType="ns2:ExternalSystemData[2]" xsi:type="soapenc:Array" xmlns:ns2="java:ExternalSystemData.TestIPA.nhsia.nhs">
            <systemData href="#id2"/>
            <systemData href="#id3"/>
         </systemData>
      </multiRef>
      <multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:ExternalSystemData" xmlns:ns3="java:ExternalSystemData.TestIPA.nhsia.nhs" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
         <description xsi:type="soapenc:string">Prescription</description>
         <url xsi:type="soapenc:string">http://192.168.21.131:8080/nhsia/TestIPA/validate.jsp?sdwlhqw@5)vhuylfh@Suhvfulswlrq33509</url>
      </multiRef>
      <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:StandardOutput" xmlns:ns4="java:StandardOutput.TestIPA.nhsia.nhs" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
         <auditID xsi:type="soapenc:string"/>
         <statusID xsi:type="soapenc:string">0</statusID>
         <systemAvailability xsi:type="soapenc:string">Available</systemAvailability>
      </multiRef>
      <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns5:ExternalSystemData" xmlns:ns5="java:ExternalSystemData.TestIPA.nhsia.nhs" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
         <description xsi:type="soapenc:string">Appointment</description>
         <url xsi:type="soapenc:string">http://192.168.21.131:8080/nhsia/TestIPA/validate.jsp?vgzoktzC8,ykx|oikCGvvuotzsktz61409</url>
      </multiRef>
   </soapenv:Body>
</soapenv:Envelope>';
BEGIN
   FOR x IN (    SELECT x.*
                   FROM XMLTABLE (
                           xmlnamespaces (
                              'http://schemas.xmlsoap.org/soap/envelope' AS "x",
                              'http://www.w3.org/2001/XMLSchema-instance' AS "xsi"),
                           PASSING xmltype (resp).
                                   EXTRACT (
                                      '//multiRef',
                                      'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"')
                           COLUMNS description VARCHAR2 (30) PATH 'description',
                                   url VARCHAR2 (250) PATH 'url') x)
   LOOP
      DBMS_OUTPUT.PUT_LINE('Rec:  '||x.description||' '||x.url);
   END LOOP;
END;
/I would appreciate any help this one.
Cheers,
Andy.

Why do you have 4 rows? I don't understand why you have two rows for 100 bottles?
Building on Odie's answer and my example plus adding in the needed outer join we have, using Oracle's outer join syntax of (+)
SQL> with my_sample_table as (
  2      select xmltype('<?xml version="1.0" encoding="UTF-8" ?>
  3  <request>
  4  <identification>
  5  <requestid>12345</requestid>
  6  <periodunit>DAY</periodunit>
  7  <days>MONDAY</days>
  8  </identification>
  9  <product>
10  <productname>ABC PRODUCT</productname>
11  <brand>
12  <brandname>CELL</brandname>
13  <ndccode>A58048</ndccode>
14  <ndccode>A49210</ndccode>
15  </brand>
16  </product>
17  <product>
18  <productname>100 bottles</productname>
19  </product>
20  </request>') xmldoc
21      from dual
22    )
23  select x.*, y.*
24    from my_sample_table t
25       , xmltable(
26          'let $e := $d/request/identification
27           for $i in $d/request/product
28           return element r {
29             $e/requestid
30           , $e/days
31           , $e/periodunit
32           , $i/productname
33           , $i/brand/brandname
34           , $i/brand/ndccode
35           }'
36          passing t.xmldoc as "d"
37          columns requestid  number       path 'requestid'
38                , days       varchar2(30) path 'days'
39                , periodunit varchar2(10) path 'periodunit'
40                , prductname varchar2(20) path 'productname'
41                , brandname  varchar2(20) path 'brandname'
42                , ndccodexml xmltype      path 'ndccode'
43         ) x,
44         xmltable('/ndccode'
45                  PASSING x.ndccodexml
46                  COLUMNS
47                  ndccode    VARCHAR2(10) PATH '.') (+) y;
REQUESTID DAYS                           PERIODUNIT PRDUCTNAME           BRANDNAME            NDCCODEXML                                                                       NDCCODE
     12345 MONDAY                         DAY        ABC PRODUCT          CELL                 <ndccode>A58048</ndccode><ndccode>A49210</ndccode>                               A58048
     12345 MONDAY                         DAY        ABC PRODUCT          CELL                 <ndccode>A58048</ndccode><ndccode>A49210</ndccode>                               A49210
     12345 MONDAY                         DAY        100 bottles                                                                                                                If you prefer the ANSI syntax it would be (just showing changed section)
       ) x
       LEFT OUTER JOIN
       xmltable('/ndccode'
                PASSING x.ndccodexml
                COLUMNS
                ndccode    VARCHAR2(10) PATH '.') y
       ON 1=1;

Similar Messages

  • Using xmldom.writeToClob to update xml clob corrupts clob

    We are storing an xml document in a clob field in the db. As part of a data check we need to parse the xml and possibly remove a node. I can do that, and check the results using 'xmldom.writeToBuffer'.
    When I try to write the data back to the db using 'xmldom.writeToClob' I get strange results. Data seems to be appended to the end of the clob and contains chr(13) characters at the end of each line.
    Also does anyone know if the existence of whitespace in the xml clob would cause a parse/search to be slower?
    I am new to xml and might be missing something fairly basic in the following code. Thanks in advance for any help.
    Here is some of the code:
    doc xmldom.DOMDocument;
    curNode xmldom.DOMNode;
    parentNode xmldom.DOMNode;
    theNodeList xmldom.DOMNodeList;
    str varchar2(4000);
    begin
    -- open xml_rec cursor (xml is the clob field opened for update)
    -- Loop through all item elements
    theNodeList := xmldom.getElementsByTagName(doc, 'item');
    for m in 0..xmldom.getLength(theNodeList)-1 loop
    curNode := xmldom.item(theNodeList,m);
    --perform a check and possibly delete the current node
    parentNode := xmldom.getParentNode(curNode);
    parentNode := xmldom.removechild(parentNode, curNode);
    xmldom.writeToBuffer(doc, str);
    --I check the results here and everything looks good
    xmldom.writeToClob(doc, xml_rec.xml);
    --When I check the clob the data is incorrect.
    null

    The next cod is a sample of the implementation xmldom.writeToClob used xmldom.DOMNode in the parameter of input.
    DECLARE
    XMLOut CLOB := EMPTY_CLOB();
    XMLIn Varchar2(2000);
    XSLPath Varchar2(2000);
    BEGIN
    DBMS_LOB.CREATETEMPORARY(XMLOut,TRUE); -- Give permit
    DBMS_LOB.OPEN (XMLOut, DBMS_LOB.LOB_READWRITE); --open the file of read and write
    XSLPath := '/users/gcardona/plantillas/report.xsl';
    GE_BSXMLCONVERT.createElementName('COLUMN');
    GE_BSXMLCONVERT.createElementAttribute('name', 'OUTXML');
    GE_BSXMLCONVERT.addElement();
    GE_BSXMLCONVERT.createElementName('table');
    GE_BSXMLCONVERT.createElementAttribute('name', 'X1');
    GE_BSXMLCONVERT.createElementAttribute('width', '100');
    GE_BSXMLCONVERT.addElement();
    XMLIn := GE_BSXMLCONVERT.toXML();
    XSLTranform(XMLIn, XSLPath, XMLOut);--XMLOut is a variable in out in the procedure,
    --here is where is return the file XML Process
    insert into in_prueba (ID,XML_CLOB) values (200, XMLOut);
    DBMS_LOB.CLOSE (XMLOut); -- Close File
    DBMS_LOB.FREETEMPORARY(XMLOut); --free memory
    GE_BSXMLCONVERT.clearMemory();
    commit;
    END;
    null

  • Unable to view image if the size is more than 3KB using XML Publisher.

    Hello,
    We are printing PO approver signature using xml publisher (rtf) on a pdf.
    If the size of the image is 3KB or less, the image gets printed.
    But, if the size is more than 3KB the image does not get printed.
    Additional Info:
    1. The signature is stored as jpg image in fnd_lobs table.
    2. On following code is mentioned in the rtf
    <fo:instream-foreign-object content-type="image/jpg">
    <xsl:value-of select="IMG_SIGNATURE"/>
    </fo:instream-foreign-object>
    3. We are using the following function that converts BLOB to CLOB.
    CREATE OR REPLACE FUNCTION XX_BLOBTOBASE64
    b IN BLOB
    RETURN CLOB
    IS
    sizeb PLS_INTEGER := 4080 ;
    buffer RAW(4080);
    offset PLS_INTEGER DEFAULT 1;
    RESULT CLOB;
    BEGIN
    -- dbms_lob.createtemporary
    -- lob_loc => RESULT
    -- , cache => FALSE
    -- , dur => dbms_lob.CALL
    -- LOOP
    -- BEGIN
    -- dbms_lob.READ
    -- ( lob_loc => b
    -- , amount => sizeb
    -- , offset => offset
    -- , buffer => buffer
    -- EXCEPTION
    -- WHEN no_data_found
    -- THEN
    -- EXIT;
    -- END;
    -- offset := offset + sizeb;
    -- dbms_lob.append
    -- ( dest_lob => RESULT
    -- , src_lob => to_clob(utl_raw.cast_to_varchar2(utl_encode.base64_encode(buffer)))
    -- END LOOP;
    DBMS_LOB.createtemporary(lob_loc => RESULT, CACHE => FALSE, dur => 0);
    Wf_Mail_Util.EncodeBLOB ( b, RESULT );
    RETURN RESULT;
    END;
    Requesting any of you to let us know if there is any method to resolve this issue.
    Thanks,
    Angelica.

    Hi,
    Are you using Outlook.com to send/receive emails? Based on my research, we can only add an image/ picture in your e-mail signature that’s Web based (picture that is available in existing websites or stored in an online storage). See:
    http://answers.microsoft.com/en-us/outlook_com/forum/osettings-oemailset/add-logo-to-outlookcom-signature/4455facf-0926-42a6-aad7-756de662a865
    Since this forum is for general questions and feedback related to Outlook desktop application, if you are using Outlook.com, I'd recommend you post your question in the Outlook.com forum:
    http://answers.microsoft.com/en-us/outlook_com/forum?tab=Threads
    The reason why we recommend posting appropriately is you will get the most
    qualified pool
    of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    Steve Fan
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Write XML CLOB 10 MB in size to an XML file

    Hi,
    I am trying to export a table into an XML file. Using various examples, I have learned that is really easy to handle objects smaller that 32767 bytes (characters).
    The problem is working with big chunks. My XML CLOB is just over 10 MB in size. I can easilly break it into smaller pieces but then I risk to write chr(10) in the middle of a XML Tag (which happened). I have an idea of finding a way around the problem but there are two issues:
    1. DBMS_LOB.instr function returns 0 if offset grows above appx 1100.
    2. I tried this in oreder to avid the limitation from item 1.:
    for c = 1..dbms_lob.getlength(CLOB) loop
    dbms_lob.read(CLOB,c,1,MyString);
    if MyString = chr(10) then
    utl_file.put_line(MyLine);
    MyLine := '';
    else
    MyLine := MyLine || MyString;
    end if;
    end loop;
    This way I generate perfect XML structure, and it takes about an hour of cpu time to create 2.3 MB file. I have tried to run ir for a big one, and it took just over 7 hours to get to 10.2 MB when I had shut it down.
    Does anybody has any suggestions?

    utl_file.put(...) will write the contents of the buffer without a newline
    utl_file.put_line will write the contents of the buffer plus a newline character. So, if you use utl_file.put_line(largebuffer) you will get a newline character after the buffer that may break tags.
    The following should produce the string:
    <tag>
    in a file:
    utl_file.put(fil, '<ta');
    utl_file.put(fil, 'g>');
    the following PL/SQL code will produce the string:
    <ta
    g>
    in a file:
    utl_file.put_line(fil, '<ta');
    utl_file.put_line(fil, 'g>');
    Are you saying that utl_file.put() is putting newlines in a file?
    This can be because you are not setting MAXLINESIZE for the file to 32767 (or >= your buffer size ) in fopen:
    UTL_FILE.FOPEN (
    location IN VARCHAR2,
    filename IN VARCHAR2,
    open_mode IN VARCHAR2,
    max_linesize IN BINARY_INTEGER) <<<<<<<<<<< set this to 32767 >>>>>>>>>>>>>>>>>>
    RETURN file_type;
    Larry

  • How Do You Use XML To Create Image Upload On A WebSite?

    Hello,
    Could some one please help me understand how to create web image gallery and web video gallery using XML? I have found few xml codes that could be used to do this but I am not so sure how to use them. I want my clients to be able upload images and videos with linking thumbnails to Image and or Videos. Do you think the codes I included in this question will help me achive this goal? And do I need to put all in one and in the same directory so it will work? Please help with your idea and tell me how you would use these codes and how you may step-by-step implement the idea your self to your own web site.
    I have also included the instruction I found on the web with the codes.
    Starting with You Tube, API on their video gallery, here are the codes I found,
    Assume you are to use the YouTube, XML code; What will you change here so it will work on your own www.domain.com?
    <% Dim xml, xhr, ns, YouTubeID, TrimmedID, GetJpeg, GetJpeg2, GetJpeg3, thumbnailUrl, xmlList, nodeList, TrimmedThumbnailUrl Set xml = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
    xml.async = False
    xml.setProperty "ServerHTTPRequest", True
    xml.Load("http://gdata.youtube.com/feeds/api/users/Shuggy23/favorites?orderby=updated") If xml.parseError.errorCode <> 0 Then
        Response.Write xml.parseError.reason End If Set xmlList = xml.getElementsByTagName("entry") Set nodeList = xml.SelectNodes("//media:thumbnail") For Each xmlItem In xmlList
        YouTubeID = xmlItem.getElementsByTagName("id")(0).Text
        TrimmedID = Replace(YouTubeID, "http://gdata.youtube.com/feeds/api/videos/", "")
        For Each xmlItem2 In nodeList
            thumbnailUrl = xmlItem2.getAttribute("url")
            Response.Write thumbnailUrl & "<br />"
        Next     Next    
    %>
    For the image gallery, the following are the codes I found with your experience do I need to use the entire codes or just some of them that I should use?
    CODE #01Converting Database queries to XML
    Using XML as data sources presumes the existence of XML. Often, it is easier to have the server create the XML from a database on the fly. Below are some scripts for common server models that do such a thing.
    These are starting points. They will need to be customized for your particular scenario.
    All these scripts will export the data from a database table with this structure:
    ID: integer, primary key, autoincrement
    AlbumName: text(255)
    ImagePath: text(255)
    ImageDescription: text(2000)
    UploadDate: datetime
    The output of the manual scripts will look like:
    <?xml version="1.0" encoding="utf-8" ?>
      <images>
         <image>
              <ID>1</ID>
              <album><![CDATA[ Family ]]></album>
              <path><![CDATA[ /family/us.jpg ]]></path>
              <description><![CDATA[ here goes the description ]]></description>
              <date><![CDATA[ 2006-11-20 10:20:00 ]]></date>
         </image>
         <image>
              <ID>2</ID>
              <album><![CDATA[ Work ]]></album>
              <path><![CDATA[ /work/coleagues.jpg ]]></path>
              <description><![CDATA[ here goes the description ]]></description>
              <date><![CDATA[ 2006-11-21 12:34:00 ]]></date>
         </image>
      </images>
    These are all wrapped in CDATA because it is will work with all data types. They can be removed if you know you don't want them.
    Note: If using the column auto-generating versions, ensure that all the column types are text. Some databases have data type options like 'binary', that can't be converted to text. This will cause the script to fail.
    CODE #02ASP Manual: This version loops over a query. Edit the Query and XML node names to match your needs.
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <%
    Dim MM_conn_STRING
    MM_conn_STRING = "dsn=image_gallery;uid=xxxx;pwd=xxxx"
    %>
    <%
    Dim rsImages
    Dim rsImages_cmd
    Dim rsImages_numRows
    ' Query the database and get all the records from the Images table
    Set rsImages_cmd = Server.CreateObject ("ADODB.Command")
    rsImages_cmd.ActiveConnection = MM_conn_STRING
    rsImages_cmd.CommandText = "SELECT ID, AlbumName, ImagePath, ImageDescription, UploadDate FROM images"
    rsImages_cmd.Prepared = true
    Set rsImages = rsImages_cmd.Execute
    ' Send the headers
    Response.ContentType = "text/xml"
    Response.AddHeader "Pragma", "public"
    Response.AddHeader "Cache-control", "private"
    Response.AddHeader "Expires", "-1"
    %><?xml version="1.0" encoding="utf-8"?>
    <images>
      <% While (NOT rsImages.EOF) %>
         <image>
              <ID><%=(rsImages.Fields.Item("ID").Value)%></ID>
              <album><![CDATA[<%=(rsImages.Fields.Item("AlbumName").Value)%>]]></album>
              <path><![CDATA[<%=(rsImages.Fields.Item("ImagePath").Value)%>]]></path>
              <description><![CDATA[<%=(rsImages.Fields.Item("ImageDescription").Value)%>]]></description>
              <date><![CDATA[<%=(rsImages.Fields.Item("UploadDate").Value)%>]]></date>
         </image>
        <%
           rsImages.MoveNext()
         Wend
    %>
    </images>
    <%
    rsImages.Close()
    Set rsImages = Nothing
    %>
    CODE #03
    Automatic: This version evaluates the query and automatically builds the nodes from the column names.
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
    <%
    Dim MM_conn_STRING
    MM_conn_STRING = "dsn=image_gallery;uid=xxxx;pwd=xxxx"
    %>
    <%
    Dim rsAll
    Dim rsAll_cmd
    Dim rsAll_numRows
    ' Query the database and get all the records from the Images table
    Set rsAll_cmd = Server.CreateObject ("ADODB.Command")
    rsAll_cmd.ActiveConnection = MM_conn_STRING
    rsAll_cmd.CommandText = "SELECT * FROM Images"
    rsAll_cmd.Prepared = true
    Set rsAll = rsAll_cmd.Execute
    ' Send the headers
    Response.ContentType = "text/xml"
    Response.AddHeader "Pragma", "public"
    Response.AddHeader "Cache-control", "private"
    Response.AddHeader "Expires", "-1"
    %><?xml version="1.0" encoding="utf-8"?>
    <root>
      <% While (NOT rsAll.EOF) %>
         <row>
             <%
                 For each field in rsAll.Fields
                 column = field.name
             %>
              <<%=column%>><![CDATA[<%=(rsAll.Fields.Item(column).Value)%>]]></<%=column%>>
              <%
                 Next
              %>
         </row>
        <%
           rsAll.MoveNext()
         Wend
    %>
    </root>
    <%
    rsAll.Close()
    Set rsAll = Nothing
    %>

    OK, I understand - thanks for that.
    I thought the whole process was supposed to be a bit more seemless? Having to upload/download documents and manually keep them in sync will leave a lot of room for errors.
    It's kinda painful the way iOS doesn't have folders. It makes things incompatible with the Mac and means you can't group files from multiple apps into a single project - who organises their digital life by the apps they use?
    I think I'll recommend they use their iPad only.
    Thanks for that.
    Cheers
    Ben

  • How to write a procedure to load the data into a table using xml file as input to the procedure?

    Hi,
    Iam new to the xml,
    can u please anyone help me how to write procedure to load the data into a table using xml as input parameter to a procedure and xml file is as shown below which is input to me.
    <?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>.
    Regards,
    vikram.

    here is the your XML parse in 11g :
    select *
      from xmltable('//Entity' passing xmltype
    '<?xml version="1.0"?>
    <DiseaseCodes>
    <Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    <Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity>
    </DiseaseCodes>
    ') columns
      "dcode" varchar2(4000) path '/Entity/dcode',
      "ddesc" varchar2(4000) path '/Entity/ddesc',
      "reauthflag" varchar2(4000) path '/Entity/reauthflag'
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    Using this parser you can create procedure as
    SQL> create or replace procedure myXMLParse(x clob) as
      2  begin
      3    insert into MyXmlTable
      4      select *
      5        from xmltable('//Entity' passing xmltype(x) columns "dcode"
      6                      varchar2(4000) path '/Entity/dcode',
      7                      "ddesc" varchar2(4000) path '/Entity/ddesc',
      8                      "reauthflag" varchar2(4000) path '/Entity/reauthflag');
      9    commit;
    10  end;
    11 
    12  /
    Procedure created
    SQL>
    SQL>
    SQL> exec myXMLParse('<?xml version="1.0"?><DiseaseCodes><Entity><dcode>0</dcode><ddesc>(I87)Other disorders of veins - postphlebitic syndrome</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J04)Acute laryngitis and tracheitis</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity><Entity><dcode>0</dcode><ddesc>(J17*)Pneumonia in other diseases - whooping cough</ddesc><claimid>34543></claimid><reauthflag>0</reauthflag></Entity></DiseaseCodes>');
    PL/SQL procedure successfully completed
    SQL> select * from MYXMLTABLE;
    dcode                                                                            ddesc                                                                            reauthflag
    0                                                                                (I87)Other disorders of veins - postphlebitic syndrome                           0
    0                                                                                (J04)Acute laryngitis and tracheitis                                             0
    0                                                                                (J17*)Pneumonia in other diseases - whooping cough                               0
    SQL>
    SQL>
    Ramin Hashimzade

  • File is corrupted error while creating excel using xml

      Hi have created one excel file using XML code and sent it to mail as attachement. But when i open it, it displays error  message - file is corrupted and cannot be opened.
    below is my code - please review and tell what is wrong in it ASAP :
    * Creating a ixml Factory
       l_ixml = cl_ixml=>create( ).
    * Creating the DOM Object Model
       l_document = l_ixml->create_document( ).
    * Create Root Node 'Workbook'
       l_element_root  = l_document->create_simple_element( name = 'Workbook'  parent = l_document ).
       l_element_root->set_attribute( name = 'xmlns'  value = 'urn:schemas-microsoft-com:office:spreadsheet' ).
       ns_attribute = l_document->create_namespace_decl( name = 'ss'  prefix = 'xmlns'  uri = 'urn:schemas-microsoft-com:office:spreadsheet' ).
       l_element_root->set_attribute_node( ns_attribute ).
       ns_attribute = l_document->create_namespace_decl( name = 'x'  prefix = 'xmlns'  uri = 'urn:schemas-microsoft-com:office:excel' ).
       l_element_root->set_attribute_node( ns_attribute ).
    * Create node for document properties.
       r_element_properties = l_document->create_simple_element( name = 'TEST_REPORT'  parent = l_element_root ).
       l_value = sy-uname.
       l_document->create_simple_element( name = 'Author'  value = l_value  parent = r_element_properties  ).
    * Styles
       r_styles = l_document->create_simple_element( name = 'Styles'  parent = l_element_root  ).
    * Style for Header
       r_style  = l_document->create_simple_element( name = 'Style'   parent = r_styles  ).
       r_style->set_attribute_ns( name = 'ID'  prefix = 'ss'  value = 'Header' ).
       r_format  = l_document->create_simple_element( name = 'Font'  parent = r_style  ).
       r_format->set_attribute_ns( name = 'Bold'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Interior' parent = r_style  ).
       r_format->set_attribute_ns( name = 'Color'   prefix = 'ss'  value = '#92D050' ).
       r_format->set_attribute_ns( name = 'Pattern' prefix = 'ss'  value = 'Solid' ).
       r_format  = l_document->create_simple_element( name = 'Alignment'  parent = r_style  ).
       r_format->set_attribute_ns( name = 'Vertical'  prefix = 'ss'  value = 'Center' ).
       r_format->set_attribute_ns( name = 'WrapText'  prefix = 'ss'  value = '1' ).
       r_border  = l_document->create_simple_element( name = 'Borders'  parent = r_style ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Bottom' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Left' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Top' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Right' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
    * Style for Data
       r_style1  = l_document->create_simple_element( name = 'Style'   parent = r_styles  ).
       r_style1->set_attribute_ns( name = 'ID'  prefix = 'ss'  value = 'Data' ).
       r_border  = l_document->create_simple_element( name = 'Borders'  parent = r_style1 ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Bottom' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Left' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Top' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Right' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
    * Worksheet
       r_worksheet = l_document->create_simple_element( name = 'Worksheet'  parent = l_element_root ).
       r_worksheet->set_attribute_ns( name = 'Name'  prefix = 'ss'  value = 'Sheet1' ).
    *  r_worksheet->set_attribute_ns( name = 'Protected'  prefix = 'ss'  value = '1' ).    " WORKING
    * Table
       r_table = l_document->create_simple_element( name = 'Table'  parent = r_worksheet ).
       r_table->set_attribute_ns( name = 'FullColumns'  prefix = 'x'  value = '1' ).
       r_table->set_attribute_ns( name = 'FullRows'     prefix = 'x'  value = '1' ).
    * Column Formatting
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '40' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '140' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '150' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
       r_column = l_document->create_simple_element( name = 'Column'  parent = r_table ).
       r_column->set_attribute_ns( name = 'Width'  prefix = 'ss'  value = '90' ).
    * Blank Row
       r_row = l_document->create_simple_element( name = 'Row'  parent = r_table ).
    * Column Headers Row
       r_row = l_document->create_simple_element( name = 'Row'  parent = r_table ).
       r_row->set_attribute_ns( name = 'AutoFitHeight'  prefix = 'ss'  value = '1' ).
    * RFQ No.
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'RFQ No.'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    * RFQ Line Item No
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'RFQ Line Item No.'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    * Material
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'Material'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    * Quantity
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'Quantity'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    *  Order UNIT
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'Order Unit'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    *  Delivery Date
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'Delivery Date'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    *  RFQ Creation Date
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'RFQ Creation Date'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    *  RFQ Deadline Date
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'RFQ Deadline Date'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    * Price
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
       r_data = l_document->create_simple_element( name = 'Data'  value = 'Net Price'  parent = r_cell ).
       r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    ** Login
    *  r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
    *  r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Header' ).
    *  CONCATENATE 'Login - ' lv_date+6(2) '/' lv_date+4(2) '/' lv_date+0(4) INTO l_value.
    *  r_data = l_document->create_simple_element( name = 'Data'  value = l_value  parent = r_cell ).
    *  r_data->set_attribute_ns( name = 'Type'  prefix = 'ss' value = 'String' ).
    * Blank Row after Column Headers
       r_row = l_document->create_simple_element( name = 'Row'  parent = r_table ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
       r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
       r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
    * Data Table
       LOOP AT it_final1 INTO wa_final1.
         CLEAR l_value.
         r_row = l_document->create_simple_element( name = 'Row'  parent = r_table ).
    * RFQ No.
         r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
         r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
         CLEAR l_value.
         l_value = wa_final1-ebeln .
    *    CONDENSE l_value NO-GAPS.
         r_data = l_document->create_simple_element( name = 'Data'  value = l_value  parent = r_cell ).           " Data
         r_data->set_attribute_ns( name = 'Type'  prefix = 'ss'  value = 'String' ).                               " Cell format
    * Line Item No
         CLEAR l_value.
         r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
         r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
         l_value = wa_final1-ebelp.
         r_data = l_document->create_simple_element( name = 'Data'  value = l_value   parent = r_cell ).           " Data
         r_data->set_attribute_ns( name = 'Type'  prefix = 'ss'  value = 'Number' ).                               " Cell format
    * Material
         CLEAR l_value.
         r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
         r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
         l_value = wa_final1-txz01.
         r_data = l_document->create_simple_element( name = 'Data'  value = l_value   parent = r_cell ).           " Data
         r_data->set_attribute_ns( name = 'Type'  prefix = 'ss'  value = 'String' ).                               " Cell format
    * RFQ QTY
         CLEAR l_value.
         r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
         r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
         l_value = wa_final1-ktmng.
         r_data = l_document->create_simple_element( name = 'Data'  value = l_value   parent = r_cell ).           " Data
         r_data->set_attribute_ns( name = 'Type'  prefix = 'ss'  value = 'Number' ).                               " Cell format
    * UNIT
         CLEAR l_value.
         r_cell = l_document->create_simple_element( name = 'Cell'  parent = r_row ).
         r_cell->set_attribute_ns( name = 'StyleID'  prefix = 'ss'  value = 'Data' ).
         l_value = wa_final1-meins.
         r_data = l_document->create_simple_element( name = 'Data'  value = l_value   parent = r_cell

    How to make a particular column non editable?
    Make your style protected and pass that style name to your required column while passing data.
    for example:
    Find below the code for protection of a style.
    Last two lines are very important.
    * Style for Headert
       r_style  = l_document->create_simple_element( name = 'Style'   parent = r_styles  ).
       r_style->set_attribute_ns( name = 'ID'  prefix = 'ss'  value = 'Headert' ).
       r_format  = l_document->create_simple_element( name = 'Font'  parent = r_style  ).
       r_format->set_attribute_ns( name = 'Bold'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Interior' parent = r_style  ).
       r_format->set_attribute_ns( name = 'Color'   prefix = 'ss'  value = '#B2FF64' ).      
       r_format->set_attribute_ns( name = 'Pattern' prefix = 'ss'  value = 'Solid' ).
       r_format  = l_document->create_simple_element( name = 'Alignment'  parent = r_style  ).
       r_format->set_attribute_ns( name = 'Vertical'  prefix = 'ss'  value = 'Bottom' ).
       r_format->set_attribute_ns( name = 'WrapText'  prefix = 'ss'  value = '1' ).
       r_border  = l_document->create_simple_element( name = 'Borders'  parent = r_style ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Bottom' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Left' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Top' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Border'   parent = r_border  ).
       r_format->set_attribute_ns( name = 'Position'  prefix = 'ss'  value = 'Right' ).
       r_format->set_attribute_ns( name = 'LineStyle'  prefix = 'ss'  value = 'Continuous' ).
       r_format->set_attribute_ns( name = 'Weight'  prefix = 'ss'  value = '1' ).
       r_format  = l_document->create_simple_element( name = 'Protection'  parent = r_style  ).
       r_format->set_attribute_ns( name = 'Protected'  prefix = 'ss'  value = '1' ).

  • Having to display only one record using XML tags in XML Publisher

    Hello,
    I have a query which returns two rows for one particular contract number. Output contains in the following style.
    ID | Contract_No | Item_Desc | Item_Num | colA | colB | Term_Dur
    1 ABC1 Item1 12 Y Y 20
    2 ABC1 Item2 13 Y Y 20
    the rows returned are having a column called 'Term_Duration' which is same and I'm using the for-each loop mean for every different Item_Desc column, corresponding terms are being displayed in the RTF document. Here I want the report to display the contract details only once if the 'Term_Dur' value is the same when queried up for a contract number.
    However the current RTF template is displaying both the two rows when the 'Term_Dur' is having a same value.
    P.S: I am a novice in using the XML Publisher and please provide your suggestions on the above requuirement.
    Thanks in advance,
    Uday

    Seshu,
    Do u want to display the inserted row...
    Regards,
    Gyan
    www.gyanoracleapps.blogspot.com
    www.querenttech.com

  • Need to update the xml clob-pls pls help!

    my xml is stored as blob, i can view,do string manipulation and churn out data etc...but now i have a request where i need to find some particualr node and modify its value.
    here is what i m doing now which works.
    select compressor2.blob_decompress2(xml_data) into l_blob
    from tablename where id=2008890;
    clob_data := utl2.blob2clob(l_blob);
    parser := xmlparser.newParser;
    xmlparser.parseClob(parser, clob_data);
    doc := xmlparser.getDocument(parser);
    nl := xmldom.getElementsByTagName(doc, '*');
    len := xmldom.getLength(nl);
    dbms_output.put_line('Length : ' || len);
    tag_name := 'Node Verson : ' || xmldom.getVersion(doc)|| '<br>';
    for counter in 0..len-1
    loop
    tag_name := '';
    node := xmldom.item(nl, counter);
    parent_node := xmldom.getParentNode(node);
    child_node := xmldom.getfirstchild(node);
    tag_name := 'Parent Name : ' || xmldom.getNodeName(parent_node) || '<br>';
    tag_name := tag_name || 'Node Name : ' || xmldom.getNodeName(node) || '<br>';
    IF xmldom.getNodeType(child_node) = xmldom.TEXT_NODE THEN
    tag_name := tag_name || 'Node Value : ' || xmldom.getNodeValue(child_node)|| '<br>';
    ELSE
    tag_name := tag_name || 'Node Value : Node has child.No Node value.' || '<br>';
    END IF;
    tag_name := tag_name || 'Node Type : '||xmldom.getNodeType(child_node) || '<br>';
    ele_name := xmldom.getDocumentElement(doc);
    child_nl := xmldom.getElementsByTagName(ele_name,'*');
    IF xmldom.isNull(doc) THEN
    htp.p('Document is null');
    ELSE
    htp.p(tag_name);
    END IF;
    end loop;
    b_blob := utl.clob2blob(tag_name);
    select compressor2.blob_compress2(b_blob) into b_blob2 from dual;
    insert into xupdate values (2008890,b_blob2);
    i still need to know how to update the xml clob... i want to know how to find the particular node and then modify the clob with the new value. rest i can update the table.
    pls pls help..on this.

    my oracle version.
    10.2.0.1.0
    i want to update here..
    <?xml version="1.0" encoding="utf-8"?>
    <TestData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
         <Status>CompletedNormally</TestCompletionStatus>
         <ComputerName>DUILT10</ComputerName>
         <StartTime>2008-03-19T15:12:23</StartTime>
    ---Some more noded----
    <Parameters>
              <RangeMeasured>
                   <Name>PDissBol-5[C]</Name>
                   <Min>1.22</Min>
                   <Max>1.36</Max>
                   <Units>W</Units>
              </RangeMeasured>
              <TextMeasured>
                   <Name>ComputerName</Name>
                   <Value>DUILT10</Value>
              </TextMeasured>
              <RangeMeasured>
                   <Name>TrackError25[C]To-5[C]</Name>
                   <Min>0.031</Min>
                   <Max>0.041</Max>
                   <Units>dB</Units>
              </RangeMeasured>
              <RangeMeasured>
                   <Name>Power-5[C]</Name>
                   <Min>1.988</Min>
                   <Max>1.061</Max>
                   <Units>dBm</Units>
              </RangeMeasured>
    ---some more noded---
    </Parameters>
    </TestData>
    the file is huge.
    what i need to chang==>
    I 1st need to find this PDissBol-5[C] within the <Parameters> Node and then change its <Min> and <Max>
    and then update the table.
    pls pls suggest.

  • Xml newbie - multiple loops for children in xml?

    Hi all,
    I am hoping someone can help me with this!
    I have what I guess is a pretty basic xml that I need to parse and insert in a table. I have the basic code where I loop through the node list and assign values in the table type, and then insert into the table.
    However, I have multiple levels of data that I plan to insert in one de-normailized table. So, for example:
    <POHDR>
    .. some fields...
    <POLINE>... several fields of info ...
    <PODISTLINE> ... more pieces of info ...
    </PODISTLINE>
    </POLINE>
    <POLINE>... several fields of info ...
    <PODISTLINE> ... more pieces of info ...
    </PODISTLINE>
    <PODISTLINE> ... more pieces of info ...
    </PODISTLINE>
    </POLINE>
    .. multiple such lines
    <POHDR>
    <POHDR>
    <POLINE>... several fields of info ...
    <PODISTLINE> ... more pieces of info ...
    </PODISTLINE>
    </POLINE>
    <POLINE>... several fields of info ...
    <PODISTLINE> ... more pieces of info ...
    </PODISTLINE>
    <PODISTLINE> ... more pieces of info ...
    </PODISTLINE>
    </POLINE>
    .. multiple such lines
    <POHDR>
    All this would go in one staging table with multiple lines of po_header, po_lines and distribution lines information.
    I have the pretty basic generic code, where I do the loop and assign values:
    v_parser := xmlparser.newParser;
    xmlparser.parseclob (v_parser, p_po_clob_file);
    v_doc := xmlparser.getDocument (v_parser);
    xmlparser.freeparser (v_parser);
    v_po_nl := xslprocessor.selectNodes(xml.makeNode(v_doc), 'POFILE');
    FOR i in 0.. sys.xmldom.getLength(v_po_nl)-1 LOOP
    v_po_n := sys.xmldom.item(v_po_nl, i)
    v_po_rec.extend;
    v_po_rec(v_po_rec.last).ponum := sys.xslprocessor.valueOf(v_po_n, 'PONUM');
    ...... etc.
    ... and then the insert.
    But I don't know what to do about getting the PO line and PO Distribution line child items. I guess I could do :
    v_po_rec(v_po_rec.last).polinnum := sys.xslprocessor.valueOf(v_po_n, 'POLINNUM');
    but wouldn't I need to do another loop to find the child line items - and then another to get line distributions?
    Please help!
    Thanks a lot!

    Thanks - and yes, understood.
    However, my XMLType data is not in a XMLType table (just a column of a regular table), so I cannot use the extract functions.
    I am not using XML Schemas - right now that is not in the works. We may look into that later.
    I did try using xmlsave - but again, that just saves the data in top rowset (PO Header, and does not insert any line items in the table)
    Isn't there a way to do this with just a loop? I tried looking at your child example Re: How to use PL/SQL to read and manipulate data from a xml file , but that does not loop to go through multiple children..
    Is there a way to do this with a loop using xmldom? Or a way to do it using xmlsave (but also saving the child rowsets?
    Again, any help will be most appreciated - if you can tell me there isn't then I will look into one of the other options.
    Thanks again!

  • Xml clob to file

    We are using the following java to write a PL/SQL generated xml clobs to the file system. The help in this forum has been priceless.
    At this point the xml filesare being produced but have character issues. I am guessing it is basic JAVA and yes I am new to JAVA.
    1. Small clobs have trailing box characters (carraige returns)
    2. Larger files have tags broken
    Any input is appreciated.
    Thanks
    create or replace and compile java source named sjs.write_CLOB as
    import java.io.*;
    import java.sql.*;
    import java.math.*;
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    public class write_CLOB extends Object
    public static void pass_str_array(oracle.sql.CLOB p_in,java.lang.String f_in)
    throws java.sql.SQLException, IOException
    File target = new File(f_in);
    FileWriter fw = new FileWriter(target);
    BufferedWriter out = new BufferedWriter(fw);
    Reader is = p_in.getCharacterStream();
    char buffer[] = new char[8192];
    int length;
    while( (length=is.read(buffer,0,8192)) != -1) {
    out.write(buffer);
    // out.newLine();
    is.close();
    fw.close();
    /

    We are still hung up on this. I tried implementing the code from STEVE'S XML book but still haven't resovled it.
    The clob is being created via XSU see below. The new char[8192] appeasr to force the output file to 8K
    with trailing characters on small clobs but adds a carraige return each 8K on larger ones.
    As usual any input is appreciated from all. Doese anyone know of a good JAVA forum like this one?
    Thanks
    PROCEDURE BuildXml(v_return OUT INTEGER, v_message OUT VARCHAR2,string_in VARCHAR2,xml_CLOB OUT NOCOPY CLOB) IS
    queryCtx DBMS_XMLquery.ctxType;
    Buffer RAW(1024);
    Amount BINARY_INTEGER := 1024;
    Position INTEGER := 1;
    sql_string VARCHAR2(2000) := string_in;
    BEGIN
    v_return := 1;
    v_message := 'BuildXml completed succesfully.';
    queryCtx := DBMS_XMLQuery.newContext(sql_string);
    xml_CLOB := DBMS_XMLQuery.getXML(queryCtx);
    DBMS_XMLQuery.closeContext(queryCtx);
    EXCEPTION WHEN OTHERS THEN
    v_return := 0;
    v_message := 'BuildXml failed - '||SQLERRM;
    END BuildXml;
    PROCEDURE WriteCLOB(v_return OUT INTEGER, v_message OUT VARCHAR2,result IN OUT NOCOPY CLOB,TargetDirectory IN VARCHAR2,FileName IN VARCHAR2) IS
    BEGIN
    v_return := 1;
    v_message := 'WriteCLOB completed succesfully.';
    write_CLOB(result,REPLACE(TargetDirectory||'\'||FileName,'\','/'));
    EXCEPTION WHEN OTHERS THEN
    v_return := 0;
    v_message := 'WriteCLOB failed - '||SQLERRM;
    END WriteCLOB;
    create or replace and compile java source named sjs.write_CLOB as
    import java.io.*;
    import java.sql.*;
    import java.math.*;
    import oracle.sql.*;
    import oracle.jdbc.driver.*;
    public class write_CLOB extends Object
    public static void pass_str_array(oracle.sql.CLOB p_in,java.lang.String f_in)
    throws java.sql.SQLException, IOException
    File target = new File(f_in);
    FileWriter fw = new FileWriter(target);
    BufferedWriter out = new BufferedWriter(fw);
    Reader is = p_in.getCharacterStream();
    char buffer[] = new char[8192];
    int length;
    while( (length=is.read(buffer)) != -1) {
    out.write(buffer);
    is.close();
    fw.close();
    /

  • Oracle XML CLOB out of memory error

    I am running several of Oracle's XML tools
    to store large XML documents in Oracle.
    I am successful with a 3 MB file, but not
    with a 20 MB file. I get an "out of memory"
    exception in LobPlsqlUtil.class.
    The CLOB is accessed through the method
    CLOB.getCharacterStream(), which is then
    handed off to an XMLParser class. The
    exact exception is below:
    Any ideas? Thanks, Rich
    ==========================================
    Unhandled exception breakpoint occurred at line 135 in file [D:\programs\jdev\jdbc\lib\oracle8.1.7\classes12.zip]\oracle\sql\LobPlsqlUtil.class: java.lang.OutOfMemoryError.
    ==============================

    I have some more information to add to the
    original post. I found that if I access the
    CLOB very fast then I can get all 20 MB of
    data from the CLOB. If I access it slowly
    (meaning that I pass CLOB.getCharacterStream
    to a parser) then it fails.
    I wrote my own InputStream as a wrapper
    around CLOB, using the CLOB.getChars()
    function. If I pass this input stream to
    a parser (one of Oracles, or Xerces) and
    get the data chunks on demand, it still
    fails. If, instead, I read all the CLOB
    data as fast as possible, and buffer it
    locally before passing it on to the parser,
    then I get all 20 MB. Go figure!!
    Also, when the CLOB reading fails, it doesn't
    help to get a new ResultSet, or to close and
    open a new Connection and try to start where
    it left off.

  • Loading Matrix using XML Data Source

    Hi Experts,
    I'm working on an addon where i need to fill up matrix with a set of data,
    i'm doing that using 'for loop'. my question is can v fill matrix using XML File i.e, using XML as Data Source.
    Thanks in Advance
    Jaideep

    Hi Jaideep !!!!
    here is the sample code which could help u n solve ur problem.
    if u got ny problem then please tell me ....
    Public Sub CreateLoad()
            Try
                ''' Load form
                Dim xml As Xml.XmlDocument
                xml = New Xml.XmlDocument
                xml.Load("C:\Temp\update data to the base table\Allowance\Abacus.srf")
                SBO_Application1.LoadBatchActions(xml.InnerXml)
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
            AddDataSourcetoform()
            BindataSource()
            GetDatafromDB()
        End Sub
        Public Sub AddDataSourcetoform()
            Try
                oForm = SBO_Application1.Forms.Item("Allowance")
                DBtable = oForm.DataSources.DataTables.Add("Supplier")
                SQL = "SELECT [@Supplier].* FROM [@Supplier] ORDER BY Cast( [@Supplier].Code AS INT)"
                DBtable.ExecuteQuery(SQL)
                'oDBDataSource = oForm.DataSources.DBDataSources.Item("@Supplier")
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
                'System.Windows.Forms.MessageBox.Show("Not Added Data Source to the Form")
            End Try
        End Sub
        Private Sub BindataSource()
            Try
                oForm = SBO_Application1.Forms.Item("Allowance")
                MatrixBind()
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub
        Private Sub MatrixBind()
            Try
                'Dim txt As SAPbouiCOM.EditText
                o_Matrix = oForm.Items.Item("MatAllow").Specific
                oColumns = o_Matrix.Columns
                oColumn = oColumns.Item("ColCode")
                oColumn.DataBind.Bind("Supplier", "Code")
                oColumn = oColumns.Item("ColName")
                oColumn.DataBind.Bind("Supplier", "Name")
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub
        Public Sub GetDatafromDB()
            Try
                oForm = SBO_Application1.Forms.Item("Allowance")
                o_Matrix = oForm.Items.Item("MatAllow").Specific
                Dim Code As String = 1
                o_Matrix.Clear()
                o_Matrix.LoadFromDataSource()
            Catch ex As Exception
                SBO_Application1.MessageBox(ex.Message)
            End Try
        End Sub

  • Splitting columns using xml path

    Please see my script below,
    This is one of the msdn user request but as he is newbie unable to put ddl and dmls.. but all he wants is doing pivot on values.. but I'm trying the same using dynamic pivot which I'm not able to achieve. Help is appreciated.
    Table Script:
    create table #temp(
    ProjectNO int,projectname varchar(10),client varchar(10),programmers varchar(10));
    declare @cols AS nvarchar(MAX)
    ,@QUERY AS NVARCHAR(MAX);
    Insert into #temp
    Select 01 , 'ave' , 'zica' , 'dee'
    UNION
    Select 01, 'ave', 'zica ', 'law'
    UNION
    Select 01 ,'ave', 'zica', 'amy'
    UNION
    Select 01 , 'ave' , 'rowan' , 'dee'
    UNION
    Select 01 ,'ave' ,'rowan' ,'law'
    UNION
    Select 01 ,'ave' ,'rowan' ,'amy'
    Select * from #temp
    Question 1: Desired output:
    ProjectNO. Prjtname Clt1 Clt2 Prog1 Prog2 Prog3
    01 ave zica rowan dee law amy
    Question 2: Query:
    Select distinct Replace((select distinct convert(char(8),client)
    from #temp
    FOR XML path('')) ,'";;#;;"',' ') as clients
    FROM #temp
    GROUP BY ProjectNO
    In the above query I'm doing xml path and I'm getting result in single row like
    clients 
    rowan    zica
    Instead can I get result like below using xml path?
    client1 client2
    rowan  zica
    - please mark correct answers

    For this particular problem we don't want to use XML path. I already answered in the other thread with a link to this article
    T-SQL:
    Dynamic Pivot on Multiple Columns
    Let me know if using that article code you will be able to achieve the goal. It's rather simple, actually, I can write up the mock up idea.
    declare @MaxClients int, @MaxProgrammers int
    select @MaxClients = max(ClientsCount) from (select ProjectNo, count(distinc(Client)) as ClientsCount from #Temp GROUP BY ProjectNo) X
    select @MaxProgrammers = max(ProgrammersCount) from (select ProjectNo, count(distinc(Programmer)) as ProgrammersCount from #Temp GROUP BY ProjectNo) X
    declare @SQL nvarchar(max), @Loop int
    set @Loop = 1
    Actually, that't the beginning of the idea and you should be able to figure this out till completion based on the article I pointed out. We would need to use 2 dense_rank functions.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Search informatio​ns about using XML to create scripts (automate tests)

    Hello,
    I search some (A LOT OF...) informations  about using XML in Labview. I know that Labview use a specific schema for XML, but I search examples or tutorials.
    My aim is to control a VI with a script in XML, I would know if I can generate "while loop", modified attributes etc... with my XML file?
    Bye

    Hi leo,
    first for all others: this is related to this thread!
    Then:
    Your script should be handled by LabView in an interpreter-style. So you read in the script and parse the commands. For each command that is supported you have to provide the functionality in a state-machine like handling routine.
    I would stay away from the before mentioned "LabView scripting", atleast for production-type programs as LV-Scripting is not supported by NI (and not easy to handle...)!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

Maybe you are looking for

  • My phone number is 00000000000, receiving no tap to pay link neither

    HI all, Dropped my S5 down the toilet, so bought a S6 edge to replace it. Did that, got a new sim (needed NFC and nano sized), but my number is showing up as 0000000000 in the status screen. I think this may be related to why i am not getting any lin

  • HT1848 How do I get all my songs on my iTunes on 1 computer to my Mac pro

    Put my iTunes on my other pro Mac

  • Hide/show dock no longer works

    Out of the blue, the dock has gone wonky. I have always had it set to hide/show, without problems. Now mousing over the bottom of the screen doesn't bring up the dock anymore. Even CMD-OPT D doesn't make the dock show its face, so I have to leave hid

  • Computer Re-sets Itself every 2-3 Minutes

    My Mac has recently started re-setting itself every 2-3 minutes. If I am working off another computer on my network, it will flash me out of there and I have to start over. Any suggestions? I have a Power Mac G5 OS10.4.11.

  • SEM BCS - Balance Carry Foward

    Hi, What is the prerequisites to execute task balance carry foward? I have already create task for carry foward and assign it to task hierarky, but the task doesn't appear in the consolidation monitor. Thanks in advance