Extract the plsql nested xml attributes

Hi, I need to extract xml file and insert 2 oracle tables. The xml file is the use of attributes, and I cannot retrieve the element 'code' nested with its attributes in the context of its parent element 'table '. Here is a sample of the xml data that I have to extract the date:

<? XML version = "1.0" encoding = "UTF-8"? >
< dataset - cv:dataset - cv dateProduced = "2011-09-19 11:50:45 ' xmlns:dataset - cv ="http://www.myurl.com/dataset-cv/1.0.0">"
< lov >
< id of the table = "00000000000001000" Name = "Role of the system" isSystem = "true" status = "Enabled" >
< id code = "00000000000000306" Name = "Helpdesk" code = "1" status = "Enabled" / >
< id code = "000000000000000307" Name = "Reviewer" code = "2" status = "Enabled" / >
< id code = "00000000000000308" Name = 'Administrator' code = '3' status = "Enabled" / >
< /table >
< id of the table = "00000000000002000" Name = 'Country' sSystem 'false' status = "Enabled" = >
< id code = "000000000000002004" Name = "AFGHANISTAN" code = "4" status = "Enabled" / >
< id code = "000000000000002008" Name = 'ALBANIA' code = '8' status = "Enabled" / >
< id code = "000000000000002010" Name = "ANTARCTICA" code = "10" status = "Enabled" / >
< /table >
< / lov >
< / dataset - cv:dataset - cv >

I have tried to use a query like this but does not retrieve the code attributes in the context of his record in the parent table.

SELECT ID, Name, frenchname, State, code
FROM XMLTABLE ('for $i //lov//table return $i"
In PASSING db_get_xml_from_file ("myfile.xml", "XMLORADIR")
ID VARCHAR2 COLUMNS (32) PATH '@id '.
, englishName PATH VARCHAR2 (32) "@englishName".
, frenchName PATH VARCHAR2 (32) "@frenchName".
, status VARCHAR2 (6) PATH '@status '.
code VARCHAR2 (6) path "/ / code / / code");

Any help will be much appreciated

Thank you

Dave

Hi Dave,.

Do you want something like this:

SQL> SELECT x1.id
  2       , x1.englishName
  3       , x1.frenchName
  4       , x1.status
  5       , x2.*
  6  FROM XMLTable(
  7         XMLNamespaces('http://www.myurl.com/dataset-cv/1.0.0' as "dc")
  8       , '/dc:dataset-cv/lov/table'
  9         passing xmltype(bfilename('TEST_DIR','myfile.xml'),nls_charset_id('AL32UTF8'))
 10         columns
 11           id          VARCHAR2(32) path '@id'
 12         , englishName VARCHAR2(32) path '@englishName'
 13         , frenchName  VARCHAR2(32) path '@frenchName'
 14         , status      VARCHAR2(6)  path '@status'
 15         , codes       XMLType      path 'code'
 16       ) x1
 17     , XMLTable(
 18         '/code'
 19         passing x1.codes
 20         columns
 21           codeId          VARCHAR2(32) path '@id'
 22         , codeEnglishName VARCHAR2(32) path '@englishName'
 23         , codeStatus      VARCHAR2(6)  path '@status'
 24         , code            NUMBER       path '@code'
 25       ) x2
 26  ;

ID                               ENGLISHNAME                      FRENCHNAME                       STATUS CODEID                           CODEENGLISHNAME                  CODESTATUS       CODE
-------------------------------- -------------------------------- -------------------------------- ------ -------------------------------- -------------------------------- ---------- ----------
00000000000001000                System Role                                                       Enable 00000000000000306                Helpdesk                         Enable              1
00000000000001000                System Role                                                       Enable 000000000000000307               Reviewer                         Enable              2
00000000000001000                System Role                                                       Enable 00000000000000308                Administrator                    Enable              3
00000000000002000                Country                                                           Enable 000000000000002004               AFGHANISTAN                      Enable              4
00000000000002000                Country                                                           Enable 000000000000002008               ALBANIA                          Enable              8
00000000000002000                Country                                                           Enable 000000000000002010               ANTARCTICA                       Enable             10

6 rows selected
 

Tags: Oracle Development

Similar Questions

  • How to extract the party date XML dateTime data type

    Hi all

    I have a problem with the extraction of the date part of the dateTime data type. I am getting my output * 2012-09 - 28 T 21: 49:45 * in this format. I need to extract the date part which is

    * 2012-09-28 * excluding the time. Kindly help me out by doing this. I'm new to the world of xml. Sorry if this question seems to be too stupid, but I'm quite help less.

    Thank you

    What error do you get?

    These two work for me:

    let $myDateTime := xs:dateTime("2012-09-28T21:49:45")
    return {$myDateTime cast as xs:date}
    
    let $myDateTime := xs:dateTime("2012-09-28T21:49:45")
    return {xs:date($myDateTime)}
    
  • How to extract the Image to XML Format?

    Hello

    I use Oracle as our database.
    In the Employee Table, it the column of Type Blob.


    I extract all the data (such as name, Sal, age, Dept) of the Employee Table in XML format.

    Now, there's also a column Blob added, please tell me how can I extract this Image Format as XML?

    Thank you.

    You can use base 64 format.

  • extract the pdf form xml data

    Hello

    What are the conditions to be able to extract data from a pdf form? I thought, that it is necessary to have the XML schema data connection and that all fields in the form must be bound to this data connection.

    But today I found, that domains can use the right connection 'use name (FieldName)', it's something by default - and that explicit data connection is necessary for this purpose.

    What is the common approach to the design of forms, which must be extracted by LC processFormSubmission?

    Thank you.

    All the data that is retrieved from an XFA form designed will be in xml format. The question then becomes how to control the format of the data that results. By default, the xml structure will follow the hierarchy (it is the Fieldname binding or binding normal use). If you want the data to follow a particular structure (so that you can use it with other systems that have a specific format) so that's when you would use sample XML or a schema in the data connection. Then by nodes of connection in the connection data in the fields, the form knows how to create the desired structure. If the structure is unimportant, then just stick with normal links and that no data connection is necessary.

    Hope that helps

    Paul

  • Extract xml nested with attributes using plsql

    Hi, I need to extract xml file and insert 2 oracle tables. The xml file is the use of attributes, and I cannot retrieve the element 'code' nested with its attributes in the context of its parent folder "table." Here is a sample of the xml data that I have to extract the date:

    <? XML version = "1.0" encoding = "UTF-8"? >
    < dataset - cv:dataset - cv dateProduced = "2011-09-19 11:50:45 ' xmlns:dataset - cv ="http://www.myurl.com/dataset-cv/1.0.0">"
    < lov >
    < id of the table = "00000000000001000" Name = "Role of the system" isSystem = "true" status = "Enabled" >
    < id code = "00000000000000306" Name = "Helpdesk" code = "1" status = "Enabled" / >
    < id code = "000000000000000307" Name = "Reviewer" code = "2" status = "Enabled" / >
    < id code = "00000000000000308" Name = 'Administrator' code = '3' status = "Enabled" / >
    < /table >
    < id of the table = "00000000000002000" Name = 'Country' sSystem 'false' status = "Enabled" = >
    < id code = "000000000000002004" Name = "AFGHANISTAN" code = "4" status = "Enabled" / >
    < id code = "000000000000002008" Name = 'ALBANIA' code = '8' status = "Enabled" / >
    < id code = "000000000000002010" Name = "ANTARCTICA" code = "10" status = "Enabled" / >
    < /table >
    < / lov >
    < / dataset - cv:dataset - cv >


    I use a query like this that seems to work to get all the attributes of table or all attributes of code element element, but not the code attributes in the context of his record from the table parent.

    SELECT id
    englishname
    status
    FROM XMLTABLE ('for $i //lov//table return $i"
    FROM db_get_xml_from_file (p_file_name, p_directory)
    ID VARCHAR2 COLUMNS (32) PATH '@id '.
    , englishname PATH VARCHAR2 (50) '@englishName '.
    , status VARCHAR2 (10) PATH '@status '.
    )

    Any help will be much appreciated

    Thank you

    Dave

    user12036327 wrote:
    I use a query like this that seems to work to get all the attributes of table or all attributes of code element element, but not the code attributes in the context of his record from the table parent.

    To get the nested data, that you need to implement nested xmltable statements. for example

    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select xmltype('
      2  
      3    
      4      
      5        
      6        
      7        
      8      
    9 10 11 12 13
    14
    15
    ') as xml from dual) 16 -- 17 -- end of sample data 18 -- 19 select tbl.id tbl_id 20 ,tbl.englishname as tbl_englishname 21 ,tbl.issystem as tbl_issystem 22 ,tbl.status as tbl_status 23 ,cd.id as cd_id 24 ,cd.englishname as cd_englishname 25 ,cd.code as cd_code 26 ,cd.status as cd_status 27 from t 28 ,xmltable(xmlnamespaces('http://www.myurl.com/dataset-cv/1.0.0' as "dataset-cv"), 29 '/dataset-cv:dataset-cv/lov/table' 30 passing t.xml 31 columns id varchar2(32) path '/table/@id' 32 ,englishname varchar2(20) path '/table/@englishName' 33 ,issystem varchar2(5) path '/table/@isSystem' 34 ,status varchar2(10) path '/table/@status' 35 ,code xmltype path '.' 36 ) tbl 37 ,xmltable(xmlnamespaces('http://www.myurl.com/dataset-cv/1.0.0' as "dataset-cv"), 38 '/table/code' 39 passing tbl.code 40 columns id varchar2(32) path '/code/@id' 41 ,englishname varchar2(20) path '/code/@englishName' 42 ,code number path '/code/@code' 43 ,status varchar2(10) path '/code/@status' 44* ) cd SQL> / TBL_ID TBL_ENGLISHNAME TBL_I TBL_STATUS CD_ID CD_ENGLISHNAME CD_CODE CD_STATUS -------------------------------- -------------------- ----- ---------- -------------------------------- -------------------- ---------- ---------- 00000000000001000 System Role true Enabled 00000000000000306 Helpdesk 1 Enabled 00000000000001000 System Role true Enabled 000000000000000307 Reviewer 2 Enabled 00000000000001000 System Role true Enabled 00000000000000308 Administrator 3 Enabled 00000000000002000 Country false Enabled 000000000000002004 AFGHANISTAN 4 Enabled 00000000000002000 Country false Enabled 000000000000002008 ALBANIA 8 Enabled 00000000000002000 Country false Enabled 000000000000002010 ANTARCTICA 10 Enabled 6 rows selected.
  • Extract the total result of webService and the display in the console

    Hi team,

    IAM I invoke merger currency WebService: CurrenciesService? WSDL

    IAM able to run it.

    How can I extract the load output xml from it?

    the following is extracted from java code:

    // Add your code to call the desired methods.
    try {}
    System.out.println ("method call");
    variableName = currenciesService.getDailyConversionType (conversionType);
    System.out.println ("Value of the Variable name->" + VariableName);
    System.out.println ("Data->" + variableName.attribute1);
    System.out.println ("The Type of Conversion->" + variableName.conversionType);
    System.out.println ("User Conv TYpe->" + variableName.get);
    } catch (ServiceException e) {}
    }

    I don't think you can get it from the object rather either must implement a handler as in the related documentation or marshall to the string using JAXB XML. Including a sample for the latter:

    import java.io.StringWriter;

    Import javax.xml.bind.JAXBContext;

    Import javax.xml.bind.JAXBElement;

    Import javax.xml.bind.Marshaller;

    import javax.xml.namespace.QName

    ...

    Rule = creditRuleService.getRule (test);

    JAXBContext jaxbContext = JAXBContext.newInstance (Rule.class);

    Marshaller marshaller = jaxbContext.createMarshaller ();

    marshaller.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);

    StringWriter stringWriter = new StringWriter();

    JAXBElement jaxbElement = new JAXBElement (new QName("Rule"), Rule.class, rule);

    marshalling. Marshal (jaxbElement, stringWriter);

    String xmlString = stringWriter.toString ();

    Note that while I tested it it works I thought not performance etc.

    --

    Jani Rautiainen

    Relationship with the developers of Applications in fusion

    https://blogs.Oracle.com/fadevrel/

  • How to handle xml attributes?

    Hallo,

    I am new to Livecycle and I have some difficulties to understand how reading/identification of the attributes XML in LiveCycle Designer.

    If I drag-and - drop items (#data of display data), they appear without problems. But if I drag an attribute (@attributename) they always show the empty to the PDF.

    For example, I have an XML file that looks like this:

    < product >

    ....

    < price >

    < ParamPrice visible = "true" >

    < prixUn visible = "false" > 1.350,00 < / prixUn >

    < priceB visible = "true" > 1.350,00 < / priceB >

    < price visible = "true" > 20.00 < / price >

    < price visible = "false" > 0,00 < / price >

    < / if >

    < NouveauPrix visible = "true" >

    < prixUn visible = "false" > 1.350,00 < / prixUn >

    < priceB visible = "true" > 1.350,00 < / priceB >

    < price visible = "true" > 20.00 < / price >

    < price visible = "false" > 0,00 < / price >

    < / sonderpreise >

    < / price >

    ...

    < / product >

    I tried to link like this: price.oldprice. (visible.value == "true") .priceA, but it does not work.

    I can´t really find some good information about the manipulation of XML attribute in LiveCycle. Can you please help me or tell me where to find more information on this topic.

    Thank you!!!

    What about Kat

    It is not the relationship between the presence of the object property and your visible attribute to date.

    But you can use a script to create such a thing.

    Put this in the event layout: ready for a text field, you want to be hidden or shown depending on the value of the visible attributes.

    this.presence = this.dataNode.visible.value === "true" ? "visible" : "hidden";
    
  • How to extract an XML attribute

    I need to extract the NetworkConnection network name (none) in the following XML:

    " < ns6:NetworkConnection network = 'none' needsCustomization = 'true' xmlns =" http://www.VMware.com/vCloud/versions "xmlns:ns2 =" http://schemas.dmtf.org/OVF/Envelope/1 "xmlns:ns3 =" http://schemas.dmtf.org/wbem/wscim/1/Common "xmlns:ns4 =" http://schemas.dmtf.org/wbem/wscim/1/CIM-Schema/2/CIM_VirtualSystemSettingData "xmlns:ns5 =" http://schemas.dmtf.org/wbem/wscim/1/CIM-Schema/2/CIM_ResourceAllocationSettingData "xmlns:ns6 =" http://www.VMware.com/vCloud/v1.5 "xmlns:ns7 =" http://www.VMware.com/Schema/OVF "xmlns:ns8 =" http://schemas.dmtf.org/OVF/Environment/1 "xmlns:ns9 =" http://www.VMware.com/vCloud/extension/v1.5 "> " "" "" ""

    < ns6:NetworkConnectionIndex > 0 < / ns6:NetworkConnectionIndex >

    < ns6:IsConnected > false < / ns6:IsConnected >

    < ns6:MACAddress > 00:50:56:3f:03:5 c < / ns6:MACAddress >

    < ns6:IpAddressAllocationMode > NONE < / ns6:IpAddressAllocationMode >

    < / ns6:NetworkConnection >

    I have:

    nsXML var = ns.toXml ();

    var doc = new XML (nsXML);
    default xml namespace = doc.namespace ();
    networkName var = doc.NetworkConnection.network;
    System.log (networkName);

    and am getting null

    I don't know how to refer to the attribute.

    You can try with

    doc.attribute("network")
    

    or

    doc.@network
    
  • Questions to extract the XMLtype column attributes

    I cannot retrieve the values of a column of the XML data type. There are 16 fields and when I try to extract the data the XML snippet is that each of them in 1 great return value. I have tried everything but the problem seems to be that the domain name is an attribute and everything I try fails. I appreciate any help in advance and I'm extremely new XML so please let me know if you need more information.

    With the help of Oracle 11.2.0.2 Express

    -Created table that has a column of XMLTYPE OF CLOB
    CREATE THE TABLE HR. XMLTABLESTORE (key_id VARCHAR2 (10) PRIMARY KEY, xmlloaddate date, xml_column XMLTYPE) AS CLOB XmlType xml_column STORE;

    -Insert the XML code in the column
    INSERT INTO HUMAN RESOURCES. VALUES XMLTABLESTORE (HR. XMLSEQUENCE. NEXTVAL, SYSDATE, XMLType (bfilename ('XMLDIRX', 'PROD_20110725_211550427_220b.xml'),
    nls_charset_id ('AL32UTF8')));

    I managed to get the values for

    SELECT extract (xml_column, ' / / MapItem/@ProductNum "") ProductNum go OF HR. XMLTABLESTORE

    '63481062975'

    Vain, get the data under the domain name, as it is to return all names or values

    SELECT extract (xml_column, ' / / MapItem/Field/@Name "") OF HR. XMLTABLESTORE

    'lowDispUnitsPerPackdosageFormmedicaidUnitTypemedicareUnitTypemedicareUnitsPerPackunitConversiontypeunitMeasurepricingUnitMeasurelabelerCodeproductNumdescriptionlongDescriptiondesiIndicatorgenericBrandTypeendoOrgCode'

    How can I return a row of data both for the name and value?

    <? XML version = "1.0"? > < entries >
    < ProductNum category = NDC "634810629" = "634810629" Name = "634810629" Ndc9Flag = "true" >
    < = field name "type" Type = "java.lang.String" Value = "Category" / > "
    < name of field = "productNum" Type = "java.lang.String" Value = "634810629" / > "
    "" "< MapItem ProductNum = NDC"63481062975"="63481062975"Ndc9Flag ="false"name ="PERCOCET 10/325 MG x 100 UD' status = "0" Description ="PERCOCET 10/325 MG x 100 UD ' MedicaidUnitsPerPack ="100.0"MarketEntryDate ="2001-11-23 00:00:00 "FirstSalesDate =" 2001-11-23 00:00:00 "fdaApprovalDate ="2001-11-23"fdaRegName ="000000006348162975"ManuTermDate ="2003-09-30 00:00:00 "ShelfLifeExpDate =" 2003-09-30 00:00:00 "drugType ="Rx"DrugCategory =" N"TheraCode ="NR"EligibleForVA ="false"EligibleForPHS ="false"EligibleForASP ="false"EligibleForMedicaid ="true"NonCmtyPharmaDrug ="false">"
    * < name of field = "lowDispUnitsPerPack" Type = "java.lang.String" Value = "1000" / > * "
    * < name of field = 'dosageForm"Type =" java.lang.String"Value = 'TAB' / > *"
    * < name of field = "medicaidUnitType" Type = "java.lang.String" Value = 'TAB' / > * "
    * < name of field = "medicareUnitType" Type = "java.lang.String" Value = 'TAB' / > * "
    * < name of field = "medicareUnitsPerPack" Type = "java.lang.String" Value = "100.0" / > * "
    * < name of field = "unitConversion" Type = "java.lang.String" Value = "1" / > * "
    * < = field name "type" Type = "java.lang.String" Value = "Item" / > * "
    * < name of field = 'unitMeasure' Type = "java.lang.String" Value = "EA" / > * "
    * < name of field = "pricingUnitMeasure" Type = "java.lang.String" Value = "EA" / > * "
    * < name of field = "labelerCode" Type = "java.lang.String" Value = "63481" / > * "
    * < name of field = "productNum" Type = "java.lang.String" Value = "63481062975" / > * "
    * < field name = "description" Type = "java.lang.String" Value ="PERCOCET 10/325 MG x 100 UD" / > * "
    * < field name = "longDescription" Type = "java.lang.String" Value ="PERCOCET 10/325 MG x 100 UD" / > * "
    * < name of field = "desiIndicator" Type = "com.modeln.bp.catalog.CMnDesiDrugIndicator" Value = "2" / > * "
    * < name of field = "genericBrandType" Type = "com.modeln.bp.struct.contract.enums.CMnGenericBrandItemType" Value = "BRND" / > * "
    * < name of field = "endoOrgCode" Type = "java.lang.String" Value = "0010" / > * "
    < / MapItem >
    < / category >
    < / input >

    Thank you
    Shawn

    You can get a picture with lines like ['name', 'value']

    with t as
    (select xmltype('
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ') xml from dual)
    
    select  x.name, x.value
    from t
        ,xmltable('/Entries/Category/MapItem/Field'
                  passing t.xml
                  columns name varchar2(20) path '@Name',
                   value varchar2(20) path '@Value'
                 ) x 
    
    NAME                 VALUE
    -------------------- --------------------
    lowDispUnitsPerPack  1.000
    dosageForm           TAB
    medicaidUnitType     TAB
    medicareUnitType     TAB
    medicareUnitsPerPack 100.0
    unitConversion       1
    type                 Item
    unitMeasure          EA
    pricingUnitMeasure   EA
    labelerCode          63481
    productNum           63481062975
    description          PERCOCET 10/325MG x
    longDescription      PERCOCET 10/325MG x
    desiIndicator        2
    genericBrandType     BRND
    endoOrgCode          0010                 
    
    16 rows selected           
    
  • POOR RECOVERY OF THE XML ATTRIBUTE VALUES

    Hi all

    I searched this forum and the web a way to get the value of an xml attribute. The solutions I found always had a problem, the values returned when concatenated without any separators, so I can't know every value.

    Here's how:

    BEGIN

    l_bfile: = BFILENAME ('CTEMP1', nome_fich);
    DBMS_LOB. FileOpen (l_bfile);
    DBMS_LOB. LoadFromFile (l_clob, l_bfile, DBMS_LOB.lobmaxsize);
    DBMS_LOB. FileClose (l_bfile);
    xmlx: = XMLTYPE (l_clob);
    Str: = xmlx. Extract('rowset/Row/@id'). GETSTRINGVAL();

    dbms_output.put_line (' :'|| id values) (STR);
    END;

    Returns the string str: 123456654321 for this example

    <? XML version = "1.0" encoding = "UTF-8"? >
    rowset <>
    < row id = "123456" >
    < name > Peter < / name >
    < / row >
    < row id '654321' = >
    < name > Louis < / name >
    < / row >
    < / lines >


    I want to get each id concatenated for example values (123456:654321) instead, I get the concatenated values (123456654321).


    Does anyone know a work around for this problem?


    Cordially Pedro.

    11.2 you can use listagg()

    SQL> with t as (select xmltype('
      2    
      3      Peter
      4     
      5     
      6      Louis
      7     
      8    ') xcol from dual)
      9  select listagg(v.val,':') within group (order by null) val
     10  from t,xmltable('/rowset/row/@id'
     11  passing t.xcol
     12  columns val varchar2(1000) path '.') v;
    
    VAL
    ------------------------------------------------------------------------------------------------------------------------
    123456:654321  
    

    If not 11.2

    SQL> with t as (select xmltype('
      2  
      3  Peter
      4  
      5  
      6  Louis
      7  
      8  ') xcol from dual)
      9  select xmlquery('fn:string-join(/rowset/row/@id,'':'')'
     10  passing by value t.xcol  returning content) val
     11  from t;
    
    VAL
    ------------------------------------------------------------------------------------------------------------------------
    123456:654321
    
  • Extract the value of an xml file (LPX-00601: invalid token)

    Hello

    I have this kind of XML / example...

    declare
        l_clob clob;
        l_xml xmltype;
    
    
    begin
        l_clob := '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fu="http://www.fu.gov.si/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <soapenv:Body>
            <fu:BusinessPremiseResponse Id="data">
                <fu:Header>
                    <fu:DateTime>2015-10-02T10:56:40.416Z</fu:DateTime>
                    <fu:MessageID>2107C422-FC85-291C-E053-0CC910AC3C4F</fu:MessageID>
                </fu:Header>
                <fu:Error>
                    <fu:ErrorCode>S001</fu:ErrorCode>
                    <fu:ErrorMessage>eriworwiweorioweriorio</fu:ErrorMessage>
                </fu:Error>
            </fu:BusinessPremiseResponse>
        </soapenv:Body>
    </soapenv:Envelope>
    ';
     l_xml := xmltype(l_clob);
      put_xl_line(l_xml.extract('/soapenv:Envelope/soapenv:Body/fu:BusinessPremiseResponse/fu:Error/fu:ErrorCode/text()','xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"').getStringVal());
    
    end;
    

    what I want is to extract the /soapenv:Envelope / soapenv:Body / fu:BusinessPremiseResponse / fu:Error / fu:ErrorCode

    I get this kind of error:

    ORA-31011: XML parsing failed

    ORA-19202: an error has occurred in the processing of XML

    LPX-00601: token not valid in: ' / soapenv:Envelope / soapenv:Body / fu:BusinessPremiseResponse / fu:Error / fu:ErrorCode / text () '

    ORA-06512: at "SYS." XMLTYPE", line 107

    ORA-06512: at line 23

    Thank you

    Hi Peter,.

    What is your version of db?

    EXTRACT and related functions are all deprecated from 11.2.

    Use XMLTABLE or XMLQUERY.

    About the error:

    You have the XPath to the right, but missing the mapping prefix of "fu":

    (l_xml). Extract

    ' / soapenv:Envelope / soapenv:Body / fu:BusinessPremiseResponse / fu:Error / fu:ErrorCode / text () '

    "', ' xmlns:soapenv ="http://schemas.xmlsoap.org/soap/envelope/"

    xmlns:Fu ="http://www.fu.gov.si/" "."

    )

    Example with XMLTABLE:

    declare
      l_clob        clob;
      l_error_code  varchar2(30);
    begin
      l_clob := '
        
            
                
                    2015-10-02T10:56:40.416Z
                    2107C422-FC85-291C-E053-0CC910AC3C4F
                
                
                    S001
                    eriworwiweorioweriorio
                
            
        
    ';
    
      select errorcode
      into l_error_code
      from xmltable(
             xmlnamespaces(
               'http://schemas.xmlsoap.org/soap/envelope/' as "env"
             , default 'http://www.fu.gov.si/'
             )
           , '/env:Envelope/env:Body/BusinessPremiseResponse/Error'
             passing xmlparse(document l_clob)
             columns errorcode varchar2(30) path 'ErrorCode'
           ) ;
    
      dbms_output.put_line(l_error_code);
    
    end;
    /
    
  • Extract the attribute name (s) (not) - how to?

    version: 11.2.0.4 (standard no company)

    context: determine all fragment a (e) xml attribute names.

    Table ddl (just a shadow table for unit tests):

    CREATE TABLE FAR_XML
    (
      REQUIREMENT_ID  NUMBER,
      FAR             SYS.XMLTYPE
    )
    XMLTYPE FAR STORE AS SECUREFILE BINARY XML
    

    sample:

    <F_A_REQ>
      <RULES>
        <VALUE KEY="FADEF_PRESENT"><![CDATA[E239]]></VALUE>
        <VALUE KEY="FADEF_SECTIONS"><![CDATA[1.2]]></VALUE>
        <VALUE KEY="FADEF_DEFINITION"><![CDATA[E257]]></VALUE>
      </RULES>
    </F_A_REQ>
    

    question: How can I query a table with an xmltype column (not placed on a diagram) and derive what the KEY 'names' are for a single record?

    desired output:

    FADEF_PRESENT

    FADEF_SECTIONS

    FADEF_DEFINITION

    Thanks in advance for any guidance.

    -abe

    For example:

    SQL> select x.value_key
      2  from far_xml t
      3     , xmltable('/F_A_REQ/RULES/VALUE'
      4         passing t.far
      5         columns value_key varchar2(30) path '@KEY'
      6       ) x
      7  ;
    
    VALUE_KEY
    ------------------------------
    FADEF_PRESENT
    FADEF_SECTIONS
    FADEF_DEFINITION
    
  • How to remove the value of the XML attribute in the Indesign file with javascript

    Hi all

    How to remove the value of the XML attribute in the Indesign file.

    1.jpg

    What error is this?

    in any case try this as well (one another),

    var myDoc = app.activeDocument;
    attrDelete(myDoc);
    function attrDelete(elm)
    {
        for (var i = 0; i < elm.xmlElements.length; i++)
        {
            try{
                for(j=0; j
    

    Vandy

  • How to extract the XML with namespace?

    Hi all

    Here's the XML I:

    <? XML version = "1.0" encoding = "UTF-8"? >
    -< transaction xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns = "http://schemas.test.com/Support/Services/test1/2012" xsi: schemaLocation = "http://schemas.test.com/Support/Services/test1/2012 Support.test1.v1.xsd" >
    -< application >
    < > 10 Sam < / Sam >
    < > 32 Actid < / Actid >
    < Pax > 3 < / Pax >
    < > 10 - DEC - 2012 Flt < / Flt >
    < user name > WebUserNameTest < / name >
    < / request >
    < application >
    < Sam > 1 < / Sam >
    < Actid > 3 < / Actid >
    < > 2 Pax < / Pax >
    < Flt > 2012 - dec - 12 < / Flt >
    < user name > WebUserNameTest < / name >
    < / request >
    < / transaction >

    I need to extract the item values:

    The code below will help me when I have no namespace, what needs to be done in order to work with the value of the element namespace and etract

    v_string_xml: =.
    ' / / Query [' |] To_char (counter_xml) | '] / Sam / text () ';
    v_ssp_table (v_ssp_table. COUNTY) .memid: =.
    p_xml_in. EXTRACT (v_string_xml) .getnumberval ();


    v_string_xml: =.
    ' / / Query [' |] To_char (counter_xml) | '] / Actid / text () ';
    v_ssp_table (v_ssp_table. COUNTY) .actid: =.
    p_xml_in. EXTRACT (v_string_xml) .getnumberval ();

    v_string_xml: =.
    ' / / Query [']
    || To_char (counter_xml)
    || '] / Pax / text () ';
    v_ssp_table (v_ssp_table..) Pax COUNT): =.
    p_xml_in. EXTRACT (v_string_xml) .getnumberval ();

    v_string_xml: =.
    ' / / Query [' |] To_char (counter_xml) | '] / Flt / text () ';
    v_ssp_table (v_ssp_table..) Flt COUNT): =.
    p_xml_in. EXTRACT (v_string_xml) .getstringval ();

    v_string_xml: =.
    ' / / Query [']
    || To_char (counter_xml)
    || '] / Username / text () ';
    v_ssp_table (v_ssp_table. COUNTY) .username: =.
    p_xml_in. EXTRACT (v_string_xml) .getstringval ();
    declare
      v_xml xmltype := xmltype( '
    
    
    10
    32
    3
    2012-DEC-10
    WebUserNameTest
    
    
    1
    3
    2
    2012-DEC-12
    WebUserNameTest
    
    ' );
    begin
      for r_xml in ( select *
                     from xmltable( xmlnamespaces( default 'http://schemas.test.com/Support/Services/test1/2012' )
                                   , '/Transaction/Request'
                                   passing v_xml
                                     columns memid number path 'Memid'
                                           , actid number path 'Actid'
                                           , pax number path 'Pax'
                                           , flt varchar2(100) path 'Flt'
                                           , username varchar2(100) path 'Username'
                                  )
                   )
      loop
        dbms_output.put_line( r_xml.memid );
        dbms_output.put_line( r_xml.actid );
        dbms_output.put_line( r_xml.pax );
        dbms_output.put_line( r_xml.flt );
        dbms_output.put_line( r_xml.username );
      end loop;
    end;
    
  • Remove the XML attribute

    Hello

    I export xml data into our database files. Since the xsd has changed it can be exported directly to another db to a third-party tool and I (among others) remove an attribute of an element
    CREATE TABLE xml_test(
          message XMLTYPE
          )
    /
    INSERT INTO xml_test
    VALUES (q'[<?xml version="1.0" encoding="ISO-8859-1"?>
    <ZusyMeldung xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://www.zusy.de/2002/XMLSchema" 
    xsi:schemaLocation="http://www.zusy.de/2002/XMLSchema ZusyAZ01.xsd">
      <TransferHeader xsi:nil="true"/>
      <Daten>
        A lot more elements
      </Daten>
    </ZusyMeldung>]')
    /
    COMMIT;
    < TransferHeader xsi: Nil = 'true' / > should become < TransferHeader / >.

    I want to write files directly with the script next and tried to use updateXML in my SELECTION, but somehow I don't understand well.
    DECLARE
        CURSOR cur_out IS
            SELECT  message
            FROM    xml_test;
    BEGIN
        FOR r_out IN cur_out LOOP
            dbms_xslprocessor.clob2file (
                 r_out.message
                ,'DIR_XMLOUT'
                ,'out_name.xml'
                ,0
                );
        END LOOP;
    END;
    /
    Concerning
    Marcus

    Hi Marcus,

    Given that you want to remove, try deleteXML :

    select xmlserialize(document
             deletexml(
               message
             , '/ZusyMeldung/TransferHeader/@xsi:nil'
             , 'xmlns="http://www.zusy.de/2002/XMLSchema", xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"'
             )
           )
    from xml_test ;
    

    Note that the functions of XML DML Oracle (updateXML, deleteXML etc.) are not recommended in 11.2.0.3 for the update of XQuery:

    select xmlquery(
             'declare default element namespace "http://www.zusy.de/2002/XMLSchema"; (: :)
              copy $d := .
              modify ( delete node $d/ZusyMeldung/TransferHeader/@xsi:nil )
              return $d'
            passing message
            returning content
           )
    from xml_test ;
    

Maybe you are looking for

  • Failure recovery system Toshiba HDD on Satellite L300D

    I recently bought a new L300D Satellite and then quickly get it infected with a virus.I had nothing on the computer that I couldn't afford to lose, so rather than try and difficulty I decided to restore the system to factory State. I started the wiza

  • Pacilion g119dx 17: 17-g119dx Pavilion chassis disassemble problem

    Having a serious problem with disassembly.  Have check the user guide followed all instructions make sure that all screws are out.  Corners correctly pressures from all sides.  Hoever it seems ot at least 2 points of fixation, located towards the arr

  • Workout activity statistics

    After a workout with my Apple Watch, can I see information such as maximum heart rate achieved, average heart rate, maximum speed or speed average speed or pace. I don't see the information in the application of the activity. I know that I can see so

  • upgrade of Predator g3 - 710 Zotac gtx 980ti

    I want to update my graphics card to a Zotac Geforce GTX 980 TI amp but I don't know if it will fit so could you tell me if he would and it will make me lose the habit of my warranty I

  • Taskbar - move to the bottom of the screen

    original title: taskbar How can I get my taskbar to the bottom on my screen is presenlty on the right side of my screen?