Parsing xml in clob field remove non utf-8 characters

hi all,
i have an issue where a stored procedure runs during a nightly process and parses xml contained in a clob field. There are some records that contain non-utf8(they paste characters from word)characters and therefore the parse fails when using performing an xquery select against the clob field as xmltype. I was wondering if anyone knew of a handy way to handle such a situation? I have looked around a bit and not found anything that seemed tailored to my situation, and I would like something a bit more generic than doing a replace on individual characters that i have found causing issues...thx in advance! -- jp

Hi,
Like BluShadow I'm curious to see a test case...
Depending on the way it's been created, the encoding declared in the XML prolog doesn't necessarily reflects the actual encoding of the content.
What's your database character set, and version?
Please also post the error message you get (LPX-00200 probably?).

Similar Messages

  • Parse XML from CLOB field

    How can I parse XML from CLOB field? I need to replace or delete the node from XML document and update the database with new XML. I am using Oracle 9i release 2.
    Here is the XML. In this XML if section1 and section2 exists then I need to delete the section1 node. If section2 doesn't exist, replace section1 with section2 node.
    <Document ID='2' TypeID='2'>
    <Body>
    <Page Name='Page1'>
    <Sec ID='section1' Title='Section 1' GroupID='' />
    <Sec ID='section2' Title='Section 2' GroupID='' />
    </Page>
    </Body>
    </Document>
    Please help.. Thank you..

    In 9.2, you are limited into your options. Have a look into, among others, updateXML. Updating tp 10gR2 will give you more options to succeed.

  • Removing non UTF-8 character set from xml in OSB

    Hi,
    We have a OSB service where we are receiving lot special characters like (~, – ) in the data between xml tags. As a result these messages are failing in our subsequent EDI systems (though they are getting processed successfully in our OSB). How do I remove these non UTF-8 characters when processing a xml message in OSB?
    If I set the Request-Encoding to UTF-8 to the proxy service that is receiving these messages, would these messages be rejected?
    Thanks,
    Aditya

    Hi,
    No silver bullet here... I think you will need a java call in order to clean up the special characters from your message...
    Cheers,
    Vlad

  • Parsing text from CLOB field that's stored as XML

    I have a CLOB field that contains an XML string. That looks like the text below. Is it possible to parse out the text string Denied NOW!!!. I basically want to parse out the data between the first encounter of the <CommentBody> tag.
    <CommentHeader>Whatever<CommentDate>2010-01-21-15.16.48.000000
    </CommentDate></CommentHeader><CommentBody>Denied NOW!!!</CommentBody>
    <CommentHeader>Whatever<CommentDate>2010-01-21-15.10.38.000000
    </CommentDate></CommentHeader><CommentBody>Denied YESTERDAY!!!</CommentBody>
    Thanks all!!
    Edited by: user11938977 on Jun 28, 2010 11:32 AM

    Thanks everyone! I'm using Oracle 11.1.0.7.0
    It seems to work as long as the Text Contents of CommentBody tag is one word without spaces. If there are spaces in between the tags it errors out. Here's the SQL:
    SELECT extractvalue( xmltype('<root>'||t.comments||'</root>'),
    'root/CommentBody[1]' ) as "CommentBody"
    FROM AP_VCHR_AW t
    When COMMENTS contains this data it errors out:
    <CommentHeader> <CommentDate>2010-03-04-17.52.53.000000
    </CommentDate></CommentHeader><CommentBody>This is an approved vuocher</CommentBody>
    <CommentHeader> <CommentDate>2010-03-04-17.52.53.000000
    </CommentDate></CommentHeader><CommentBody>This is an approved vuocher</CommentBody>
    When COMMENTS contains this data the SQL succeeds:
    <CommentHeader>at <CommentDate>2010-01-21-15.16.48.000000
    </CommentDate></CommentHeader><CommentBody>Denied!!!</CommentBody>
    <CommentHeader> at <CommentDate>2010-01-21-15.10.38.000000
    </CommentDate></CommentHeader><CommentBody>Denied!!!</CommentBody>

  • How to parse/extract XML from clob field using ODI

    Hi,
    I am very new to ODI. I have an oracle table which has clob field. This clob field contains xml. I would like to parse this xml and convert it to oracle table. Means I would like to make all the tags of xml as oracle table columns.
    I have created a PL/SQL procedure and used XMLTABLE function and I have achieved my goal. The same this I am trying to do with ODI. Since I am new to ODI so any help is appreciated.
    Thanks

    In 9.2, you are limited into your options. Have a look into, among others, updateXML. Updating tp 10gR2 will give you more options to succeed.

  • Removing non-alpha-numeric characters from a string

    How can I remove all non-alpha-numeric characters from a string? (i.e. only alpha-numerics should remain in the string).

    Or even without a loop ?
    Extract from the help for the Search and Replace String function :
    Right-click the Search and Replace String function and select Regular Expression from the shortcut menu to configure the function for advanced regular expression searches and partial match substitution in the replacement string.
    Extract from the for the advanced search options :
    [a-zA-Z0-9] matches any lowercase or uppercase letter or any digit. You also can use a character class to match any character not in a given set by adding a caret (^) to the beginning of the class. For example [^a-zA-Z0-9] matches any character that is not a lowercase or uppercase letter and also not a digit.
    Message Edité par JB le 05-06-2008 01:49 PM
    Attachments:
    Example_VI_BD4.png ‏2 KB

  • Oracle DB: How to parse XML where element names are non-standard ?

    I'm in the unfortunate situation that I have illegal XML that I would like Oracle to parse. By 'illegal' in my case is that there are element names that start with an illegal character, such as a digit. Apart from this the XML is syntactically valid.
    Here is an example of the XML I have stored as a column in the database:
    <schedule>
        <1stweek>
        </1stweek>
        <2ndweek>
        </2ndweek>
    </schedule>Right now I'm doing text search-and-replace on the XML text before I let Oracle parse it, for example replacing '<1stweek>' with '<x1stweek>' and so on. Needless to say this is very slow.
    My question is if there is a way to tell the XML parser in the Oracle DB (I'm using version 10.2) to be a bit more forgiving ? ... so that it will accept element names that start with e.g. a digit ? I know that such an option exist in some XML parsers but what about Oracle's and if so how to set the option?
    And before you ask I'll answer myself: No, I'm not the one who created the non-standard XML. It is from a third-party application which I cannot change myself and cannot get the vendor to change either.
    Thank you.

    if you cast your clob to an xmltype then you can search and extract values based on tags.
    Heres an example where the table is a clob and value is cast and I'm looking for an existing attribute_name.
    Check out the Oracle XML developers Guide
    select u.*
    FROM preload_xml
    , XMLTable(
    '/ApplicationProfile/ScriptFragment' PASSING xmltype(xml)
    COLUMNS name varchar2(50 char) PATH '/ScriptFragment/@Name'
    ) u

  • Servlet encoding for non UTF-8 characters

    Hi whenever i ran my following code its working in the standalone application
    While i am trying in the servlet its showing invalid(?) characters in the output format.
    Standalone: String temp="Buôn Ma Thuột";
    System.out.println("Test Buôn Ma Thuột:"+temp);
    out put:
    Test Buôn Ma Thuột:Buôn Ma Thuột
    Web application:
    String temp="Buôn Ma Thuột";
    System.out.println("Test Buôn Ma Thuột:"+temp);
    out put:
    Test Buôn Ma Thu?t:Buôn Ma Thu?t
    i changed the content type in the two ways
    a.UTF-8
    b.ISO-8859-1
    Even though i wont get required output.
    Kindly help me.
    Edited by: user12145487 on Aug 10, 2011 12:37 AM

    Is the device you are printing on capable of displaying those characters? and why are you calling System.out.println() in a Webapp?

  • ASP & Clob fields in the Oracle Database 8i

    Hi All,
    This is the first time I am posting a question. We are having a problem interfacing ASP pages with Clob fields int he Oracle Database.
    We are trying to display clob fields in an oracle database from ASP PAge. The ASP Page does a select to a clob field from a table. But we lose the formatting od the data inside the clob field when we display it out using ASP. We display it as a
    single stream of data. But when we display the clob using SQLPLUS we do see the formatted data.
    How can we solve this issue or circumvent it ?
    We are not looking to parse through the clob field in ASP, rather we already have a stored procedure that parses the data for us. The parsed data is then stored in a clob field already formatted the way we need it. The problem occurs when the ASP
    page reads the clob field. The ASP page reads it as one continuos string instead of the formatted data that exists in the clob field.
    I imported the data from Oracle to Access in order to view the raw data. The data is shown formatted properly in Access, so we know our stored procedure is doing what it supposed to do. As far as getting the data to display. The only way to retrieve (as far as I know) a clob field using ASP is by a built in function called GetChunk(). Is there a better method of displaying the formatted data aside from parsing on the client side, using ASP?
    Let me know if anyone has a solution to this problem.
    Thanks for your help and time. Sanjiv.

    Sanjiv, you might want to try some of the Windows development forums:
    ODBC: http://forums.oracle.com/forums/forum.jsp?id=763957
    New .NET provider forum: http://forums.oracle.com/forums/forum.jsp?id=1015160
    Oracle Objects for OLE: http://forums.oracle.com/forums/forum.jsp?id=763961
    Oracle Provider for OLE DB: http://forums.oracle.com/forums/forum.jsp?id=763961
    Oracle Services for MTS: http://forums.oracle.com/forums/forum.jsp?id=763960
    You'll reach a more appropriate audience than just the Web services audience.
    Mike.

  • Parse xml containing ? symbol in fields

    Hi! my problem is that I try to parse xml files with jdom 6 and some fields may contain question marks, if this happens my java program fails.
    I solved the problem of parsing odd characters (like inverted question mark, spanish symbols...) but it is not solved for ? symbol, maybe it is used as tokenizer in jdom? can anybody help me?
    Thank u in advance

    The xml code is
    <ShortDescription>�Cansado de esperar? Tenemos tu soluci�n...</ShortDescription>
    but I couldn�t get the exception message. I�m sure it is the ? character cos I removed it and it works good even when the text contain spanish characters as in the example.
    Thank u very much

  • Form or form on report to update XML tagS stored in CLOB field.

    I would like to create a form or a form on a report
    where i can update xml tags. The xml data is stored in a CLOB field.
    sample CLOB DATA
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE preferences SYSTEM 'http://java.sun.com/dtd/preferences.dtd'>
    <preferences EXTERNAL_XML_VERSION="1.0">
    <root type="user">
    <map />
    <node name="com">
    <map />
    <node name="mynode">
    <map />
    <node name="utils">
    <map />
    <node name="properties">
    <map>
    <entry key="Save" value="ON" />
    <entry key="TM_PORT" value="55555" />
    <entry key="TM_PORT2" value="7777" />
    <entry key="SubID" value="all" />
    <entry key="UserDBUsr" value="myuser" />
    <entry key="JMS_JDBC" value="OFF" />
    <entry key="Side" value="BUY" />
    <entry key="HEALTH_MONITOR_CRITICAL_DISK_SPACE" value="500" />
    <entry key="HEALTH_MONITOR_WARNING_DISK_SPACE" value="750" />
    <entry key="HEALTH_MONITOR_PERIOD" value="600000" />
    </map>
    </node>
    </node>
    </node>
    </node>
    </root>
    </preferences>
    the goal is to have a form where i can view and update the "value" of following:
    TM_PORT
    TM_PORT2
    SubID
    UserDBUsr
    JMS_JDBC
    Side
    HEALTH_MONITOR_CRITICAL_DISK_SPACE
    HEALTH_MONITOR_WARNING_DISK_SPACE
    HEALTH_MONITOR_PERIOD
    I have searched around this forum but could not find an example.
    it would be cool if I could also load the an xml file into the clob.
    Thank you.

    Hi,
    I think you just study first the topics about XML DB to understand how to manupulate xml data in the database.
    See:
    http://www.oracle.com/technology/tech/xml/xmldb/index.html
    and
    XML DB
    Regards,
    Cafer

  • Select fields from XML in CLOB column

    Hi,
    I have the following XML stored in a table as CLOB field. What i want is to select specific fields into Relational Data.
    <?xml version=1.0 encoding=UTF-8?>
    <msgContext>
        <JMSHeaders xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">
            <jms1:JMSDeliveryMode>PERSISTENT</jms1:JMSDeliveryMode>
            <jms1:JMSTimestamp>1329217943352</jms1:JMSTimestamp>
            <jms1:JMSExpiration>0</jms1:JMSExpiration>
            <jms1:JMSRedelivered>false</jms1:JMSRedelivered>
            <jms1:JMSPriority>4</jms1:JMSPriority>
        </JMSHeaders>
        <OtherProperties>
            <auditPartnerId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">010000000001189CC2BC2C</auditPartnerId>
            <auditServiceId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">Auth</auditServiceId>
            <correlationTransactionId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">d0022064-1df3-43ef-be5b-93aedc96b3b2</correlationTransactionId>
            <auditReceivedDate xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">2012-02-14 12:12:23.346 +0100</auditReceivedDate>
            <auditStatus xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">ok</auditStatus>
            <auditForwardedDate xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">2012-02-14 12:12:23.351 +0100</auditForwardedDate>
            <auditMsisdn xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms"/>
            <auditEngineId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">dpNorthLog</auditEngineId>
            <ns0:auditInfo xmlns:ns0="http://www.tibco.com/schemas/Project_gig_reporting/tib_bw_reporting/Resources/Schemas/auditInfo.xsd">
                <ns0:dp-logpoint>response</ns0:dp-logpoint>
                <ns0:dp-target-url/>
                <ns0:dp-port>20565</ns0:dp-port>
                <ns0:dp-uri>/comp_am</ns0:dp-uri>
                <ns0:dp-size>1365</ns0:dp-size>
                <ns0:dp-replytoengine/>
            </ns0:auditInfo>
        </OtherProperties>
    </msgContext>I tried to use the xml_query below with no luck :
    SELECT  x.auditPartnerId,
                 x.auditServiceId
       FROM source s
         , XMLTable(
             '/msgContext/OtherProperties'
              passing s.messagetext
              columns
              auditPartnerId   VARCHAR2(20) PATH 'auditPartnerId'
            , auditServiceId     VARCHAR2(20) PATH 'auditServiceId'
            ) x;Any help appreciated

    alekons wrote:
    Any help appreciatedYou will have to convert it to xmltype first. See below:
    SQL> select * from v$version ;
    BANNER
    Oracle Database 10g Release 10.2.0.5.0 - Production
    PL/SQL Release 10.2.0.5.0 - Production
    CORE     10.2.0.5.0     Production
    TNS for Linux: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    SQL> with src as ( select to_clob('<msgContext>
    <JMSHeaders xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">
    <jms1:JMSDeliveryMode>PERSISTENT</jms1:JMSDeliveryMode>
    <jms1:JMSTimestamp>1329217943352</jms1:JMSTimestamp>
    <jms1:JMSExpiration>0</jms1:JMSExpiration>
    <jms1:JMSRedelivered>false</jms1:JMSRedelivered>
    <jms1:JMSPriority>4</jms1:JMSPriority>
    </JMSHeaders>
    <OtherProperties>
    <auditPartnerId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">010000000001189CC2BC2C</auditPartnerId>
    <auditServiceId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">Auth</auditServiceId>
    <correlationTransactionId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">d0022064-1df3-43ef-be5b-93aedc96b3b2</correlationTransactionId>
    <auditReceivedDate xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">2012-02-14 12:12:23.346 +0100</auditReceivedDate>
    <auditStatus xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">ok</auditStatus>
    <auditForwardedDate xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">2012-02-14 12:12:23.351 +0100</auditForwardedDate>
    <auditMsisdn xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms"/>
    <auditEngineId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">dpNorthLog</auditEngineId>
    <ns0:auditInfo xmlns:ns0="http://www.tibco.com/schemas/Project_gig_reporting/tib_bw_reporting/Resources/Schemas/auditInfo.xsd">
    <ns0:dp-logpoint>response</ns0:dp-logpoint>
    <ns0:dp-target-url/>
    <ns0:dp-port>20565</ns0:dp-port>
    <ns0:dp-uri>/comp_am</ns0:dp-uri>
    <ns0:dp-size>1365</ns0:dp-size>
    <ns0:dp-replytoengine/>
    </ns0:auditInfo>
    </OtherProperties>
    </msgContext>') as messagetext from dual )
    SELECT x.auditPartnerId,
    x.auditServiceId
    FROM src s
    , XMLTable(
    '/msgContext/OtherProperties'
    passing s.messagetext
    columns
    auditPartnerId VARCHAR2(20) PATH 'auditPartnerId'
    , AUDITSERVICEID VARCHAR2(20) PATH 'auditServiceId'
    ) x;
    36   37  passing s.messagetext
    ERROR at line 33:
    ORA-00932: inconsistent datatypes: expected - got CLOB
    with src as ( select xmltype(to_clob('<msgContext>
    <JMSHeaders xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">
    <jms1:JMSDeliveryMode>PERSISTENT</jms1:JMSDeliveryMode>
    <jms1:JMSTimestamp>1329217943352</jms1:JMSTimestamp>
    <jms1:JMSExpiration>0</jms1:JMSExpiration>
    <jms1:JMSRedelivered>false</jms1:JMSRedelivered>
    <jms1:JMSPriority>4</jms1:JMSPriority>
    </JMSHeaders>
    <OtherProperties>
    <auditPartnerId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">010000000001189CC2BC2C</auditPartnerId>
    <auditServiceId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">Auth</auditServiceId>
    <correlationTransactionId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">d0022064-1df3-43ef-be5b-93aedc96b3b2</correlationTransactionId>
    <auditReceivedDate xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">2012-02-14 12:12:23.346 +0100</auditReceivedDate>
    <auditStatus xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">ok</auditStatus>
    <auditForwardedDate xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">2012-02-14 12:12:23.351 +0100</auditForwardedDate>
    <auditMsisdn xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms"/>
    <auditEngineId xmlns:jms1="http://www.tibco.com/namespaces/tnt/plugins/jms">dpNorthLog</auditEngineId>
    <ns0:auditInfo xmlns:ns0="http://www.tibco.com/schemas/Project_gig_reporting/tib_bw_reporting/Resources/Schemas/auditInfo.xsd">
    <ns0:dp-logpoint>response</ns0:dp-logpoint>
    <ns0:dp-target-url/>
    <ns0:dp-port>20565</ns0:dp-port>
    <ns0:dp-uri>/comp_am</ns0:dp-uri>
    <ns0:dp-size>1365</ns0:dp-size>
    <ns0:dp-replytoengine/>
    </ns0:auditInfo>
    </OtherProperties>
    </msgContext>')) as messagetext from dual )
    SELECT x.auditPartnerId,
    x.auditServiceId
    FROM src s
    , XMLTable(
    '/msgContext/OtherProperties'
    passing s.messagetext
    columns
    auditPartnerId VARCHAR2(20) PATH 'auditPartnerId'
    , AUDITSERVICEID VARCHAR2(20) PATH 'auditServiceId'
    37  ) x;
    AUDITPARTNERID          AUDITSERVICEID
    010000000001189CC2BC Auth

  • Export XML data from a CLOB field using sql developer

    I have a table that contains a CLOB field, each record is a complete XML in itself. After running the select query i am exporting this data by right clicking on the answer set, while the export completes the data for each record gets truncated.
    When i chose to save the export in loader format i get the complete records but now there are n files created for n records exported.
    Is there a way i can get alll the records in a single file wirthout any truncation.
    Thanks in advance!

    You might try delimited format or csv, with no enclosures if desired.

  • Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field

    Hello,
    I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
    Table structures are mentioned below:
    OP:
    Name                             Null                    Type        
    OP_NBR                    NOT NULL      NUMBER(4)    (Primary Key)
    OP_DESC                                        VARCHAR2(50)
    OP_PAYLOD_XML                           CLOB       
    GM:
    Name                          Null                   Type        
    GM_NBR                  NOT NULL       NUMBER(4)    (Primary Key)
    GM_DESC                                       VARCHAR2(40)
    OP_NBR               NOT NULL          NUMBER(4)    (Foreign Key)
    GM_PAYLOD_XML                          CLOB   
    DM:
    Name                          Null                    Type        
    DM_NBR                  NOT NULL         NUMBER(4)    (Primary Key)
    DM_DESC                                         VARCHAR2(40)
    GM_NBR                  NOT NULL         NUMBER(4)    (Foreign Key)
    DM_PAYLOD_XML                            CLOB       
    DE:
    Name                          Null                    Type        
    DE_NBR                     NOT NULL           NUMBER(4)    (Primary Key)
    DE_DESC                   NOT NULL           VARCHAR2(40)
    DM_NBR                    NOT NULL           NUMBER(4)    (Foreign Key)
    DE_PAYLOD_XML                                CLOB    
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    SELECT
    j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
    i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
    h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
    g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
    FROM
    DE g, DM h, GM i, OP j
    WHERE
    h.dm_nbr = g.dm_nbr(+) and
    i.gm_nbr = h.gm_nbr(+) and
    j.op_nbr = i.op_nbr(+)
    +++++++++++++++++++++++++++++++++++++++++++++++++++++
    I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
    Current O/P:
    <resultSet>
         <Record1>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <DM_PAYLOD_XML1>
              <DE_PAYLOD_XML1>
         </Record1>
         <Record2>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML2>
              <DM_PAYLOD_XML2>
              <DE_PAYLOD_XML2>
         </Record2>
         <RecordN>
              <OP_PAYLOD_XMLN>
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XMLN>
         </RecordN>
    </resultSet>
    Now i want to change my SQL query so that i get following output structure:
    <resultSet>
         <Record>
              <OP_PAYLOD_XML1>
              <GM_PAYLOD_XML1>
              <GM_PAYLOD_XML2> .......
              <GM_PAYLOD_XMLN>
              <DM_PAYLOD_XML1>
              <DM_PAYLOD_XML2> .......
              <DM_PAYLOD_XMLN>
              <DE_PAYLOD_XML1>
              <DE_PAYLOD_XML2> .......
              <DE_PAYLOD_XMLN>
         </Record>
         <Record>
              <OP_PAYLOD_XML2>
              <GM_PAYLOD_XML1'>
              <GM_PAYLOD_XML2'> .......
              <GM_PAYLOD_XMLN'>
              <DM_PAYLOD_XML1'>
              <DM_PAYLOD_XML2'> .......
              <DM_PAYLOD_XMLN'>
              <DE_PAYLOD_XML1'>
              <DE_PAYLOD_XML2'> .......
              <DE_PAYLOD_XMLN'>
         </Record>
    <resultSet>
    Appreciate your help in this regard!

    Hi,
    A few questions :
    How's your first query supposed to give you an XML output like you show ?
    Is there something you're not telling us?
    What's the content of, for example, <OP_PAYLOD_XML1> ?
    I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
    What's the db version BTW?

  • Parsing XML stored in CLOB (PL/SQL)

    Hello,
    I would like to parse XML document like the example below.
    When it is stored in VARCHAR2 column, parsing works well.
    When it is stored in CLOB column, I get error message:
    "ORA-20100: Error occurred while parsing: Invalid char in text."
    The <text> section contains valid characters of ISO-8859-2 encoding.
    If <text> section contains only ASCII compatible characters, parsing works well.
    <?xml version="1.0" encoding="ISO-8859-2"?>
    <body>
    <text> &igrave;&egrave;&oslash;}amiz&ugrave; </text>
    </body>
    Is it a bug? Or where is problem?
    Any help would be appreciated.

    I used such an example to parse several Varchar2 strings in a given DB session:
    BEGIN
    parser := xmlparser.newparser ;
    xmlparser.parsebuffer(parser,xmlout) ;
    domdoc := xmlparser.getDocument(parser) ;
    xmlparser.FREEPARSER(parser) ;
    parser.id := -1 ;
    nodes := xslprocessor.selectNodes(
    xmldom.makenode(domdoc),
    'Positionen/Position') ;
    for i in 1 .. xmldom.getLength(nodes) loop
    node := xmldom.item(nodes,i-1) ;
    -- do s/thing with the node
    end loop ;
    xmldom.freedocument(domdoc) ;
    RETURN(komponenten) ;
    EXCEPTION
    WHEN OTHERS THEN
    if parser.id <> -1 then xmlparser.freeparser(parser) ;
    end if ;
    if domdoc.id <> -1 then xmldom.freedocument(domdoc) ;
    end if ;
    RAISE ;
    END ;
    However, after about 2000 of nodes lists parsed, I get an ArrayIndexOutOfBoundsException from XMLNodeCover. Obviously, I should release the nodes or the nodelist, but I have not found any procedure to do this.
    Pascal

Maybe you are looking for