conversion of XML node to a string using Xquery transformation in OSB

How to convert XML node to a string using a built in function by using Xquery transformation in OSB? In BPEL, we the Xpath function ora extension: getContentAsString() to do the same.

Do you mean fn - bea:serialize()?

http://download.Oracle.com/docs/CD/E13159_01/OSB/docs10gr3/Userguide/XQuery.html#wp1104692

Tags: Fusion Middleware

Similar Questions

  • converting string to XML using Xquery transformation in OSB node

    How to convert the string to XML node elementusing built in function by using Xquery transformation in OSB?

    Discover this - http://www.javamonamour.org/2011/06/fn-beainlinedxml.html

    If in SOA (BPEL & mediator), you can use oraext:parseXML.

    You must analyze in depth where to implement your requirement as some good practices advise to implement logic more complex in SOA and let OSB only connect to endpoints of services.

    Hope this helps,

    A.

  • Error of Conversion of forms - XML nodes more than 64K can not be inserted [ORA-31167]

    Hello

    I'm trying to convert a set of Modules of Oracle (*.fmb files, version 9) form to
    Oracle Application Express. When creating a new project of conversion, while
    Download files of forms XML (... "myform_fmb.xml"), I get, for most of them, the
    following error message:

    ORA-31167: cannot insert XML nodes more than 64 K in size.

    … Back by demand.

    My development environment is:

    Oracle 10.2.0.4.0 Linux Database
    Request Express 3.2.1.00.12

    Is it possible to avoid the 64K limit (or I'm doing something wrong)? Someone at - it
    any experience in this?
    How would be possible to identify the nodes (> 64K) offending?
    Would it be useful to try to perform the migration in a 11g environment, and then import the
    converted to 10g application?
    Are there improvements in the conversion process when you use Apex 4.0?
    Any suggestions?

    Thank you very much in advance for your answer.


    Prague, 24.6.10

    Alexander,

    Hi Alexander,.

    Indeed, it is a restriction of 10g. 10g a text inside a tag in XML (text) cannot exceed 64 KB. There are
    also no work around in 10g. In 11g this limitation was liftet - then it should work in 11g

    Does this help... ?

    Best regards

    Carsten-

  • How to train a xml using a comma separated string in Xquery

    Hi all

    In my application, I need to write an Xquery query that should be an xml document. Admission to the XQuery function is an xml with an element that has the strings separated by commas. For

    example of

    < root >
    < StringComma > Hi, Hello, welcome < / StringComma >
    < / root >

    I need form an xml in such a way that it should have as many tags as the strings in < StringComma > element of the foregoing. For example, is what I want

    < Root1 >
    < String1 > Hello < / String1 >
    < String2 > Hello < / String2 >
    Welcome < String3 > < / String3 >
    < / Root1 >

    something like that. How could we do it using XQuery. Kindly help me in this.


    Thank you.

    Hello

    You can do it like this:

    declare variable $input := document{ Hi,Hello,Welcome };
    
    
    {
      for $i at $pos in fn:tokenize($input/Root/StringComma, ",")
      return element {fn:concat("String", $pos)} {$i}
    }
    
    
  • Alteration of the content of an XML node in java

    Hi all

    I change the contents of an XML node using java, using the method of setTextContent() a node.

    Sometimes I also add child nodes of a node. In this case, when I add the child nodes of a given node, when I print the xml data, I see the added nodes.

    for example:

    Initial XML:

    < a > < / a >
    < b > < / b >
    < c > < / c >


    For my project requirement, based on certain conditions, I do 'a' 'b', 'c' as children nodes nodes. I reached this output.


    The problem is

    FINAL XML:

    < a > < b > < / b > < c > < / c > < / a >


    I get the nodes children in the same line as above. But the power required should be as below.


    REQUIRED XML

    < a >
    < b > < / b >
    < c > < / c >
    < /a >

    I also used the Doc.normalize () function. But still, it helps strength.

    Kindly help me in this regard.

    Thank you
    Sabarisri. N

    Hello

    You can try to transform the result as below:

    Transformer transformer = TransformerFactory.newInstance () .newTransformer ();
    transformer.setOutputProperty (OutputKeys.INDENT, 'yes');

    initialize the StreamResult with the object of the file to save to file
    StreamResult result = new StreamResult (new StringWriter());

    DOMSource source = new DOMSource (doc); Here, the doc is you XML document.
    transform. Transform (source, result);

    String xmlString = result.getWriter (m:System.NET.SocketAddress.ToString ());
    System.out.println (xmlString);

    Thank you best regards &,.
    Nilesh Sahni (www.infocepts.com)

    Published by: Nilesh on August 30, 2011 12:31

  • No idea how to loop and add the value to the attribute of the xml node?

    I work on a lot of flattening of project using a watched folder.

    I have a process parent to locate the directory and call a sub-process to flatten PDF files.

    I want to write the directory failed to XML.

    If there are several directory failed locations and if I want to add it to the node, he doesn't let me do.

    If I set the Xpath location like/process_data/outputXML/flattenDirectoryRequestMessage/failureFileLocation[x]/@path it gives me invalid character exception. I use 'x' for looping and incrementing.

    If I do not use the [x]. The directory is overwritten.

    No idea how loop and add all the directories failed to attribute of the xml node?

    I understand that you can not browse the xml code to assign the value at each node. Rather you can assign only one time to the node.

    I realized that it is not possible to do it this way. Then concatenate it as strings, and then attach to the xml once.

  • Replace the current XML node with another node in XML fragments

    Hello

    Please help, trying to replace an XML node with other fragments XML using XML DB, updateXML/deleteXML functions don't receive the desired result, on the front of the image below, this is what I have, and the transom is the replacement with new values XML fragment, I expect to see, there is a list of records from the XML that I need to open and do the replacement of the < broker-retail > according to the number of records to be inserted.

    Before the photo:

    < Broker-benefits-link >

    < hpp-rule > 0 < / hpp-rule >

    LISP < in.-CVCA-benefits-type > < / po-CVCA-benefits-type >

    < commit / >

    <broker-retail >

    < broker-entity-not > 1000947836 < / broker-entity-not >

    < broker-pct > 100 < / broker-pct >

    Y < principal > < / main >

    < / broker-retail >

    < / Broker-benefits-link >


    After photo (expected result):

    < Broker-benefits-link >

    < hpp-rule > 0 < / hpp-rule >

    LISP < in.-CVCA-benefits-type > < / po-CVCA-benefits-type >

    < commit / >

    <broker-retail >

    < broker-entity-not > 65656524 < / broker-entity-not >

    < broker-pct > 25 < / broker-pct >

    N < principal > < / main >

    < / broker-retail >

    <broker-retail >

    < broker-entity-not > 122224444 < / broker-entity-not >

    < > 75 broker-pct < / broker-pct >

    Y < principal > < / main >

    < / broker-retail >

    < / Broker-benefits-link >

    Kind regards

    Qwestion

    You can use DELETEXML and INSERTCHILDXML

    SQL> set long 10000
    SQL> column xmldata_new format a100
    SQL> set linesize 150
    SQL>
    SQL> with t
      2  as
      3  (
      4  select
      5  xmltype('
      6    0
      7    LISP
      8    
      9    
     10      1000947836
     11      100
     12      Y
     13    
     14  ') xmldata from dual
     15  )
     16  select xmlserialize
     17         (
     18             document
     19             insertchildxml
     20             (
     21                deletexml
     22                (
     23                    xmldata
     24                  , '/broker-benefit-link/broker-detail'
     25                )
     26              , '/broker-benefit-link'
     27              , 'broker-detail'
     28              , xmltype
     29                (
     30                '
     31                    
     32                        65656524
     33                        25
     34                        N
     35                    
     36                    
     37                        122224444
     38                        75
     39                        Y
     40                    
     41                 ').extract('/broker-master/broker-detail')
     42             )
     43             as clob indent size = 2
     44         ) xmldata_new
     45    from t;
    
    XMLDATA_NEW
    ----------------------------------------------------------------------------------------
    
      0
      LISP
      
      
        65656524
        25
        N
      
      
        122224444
        75
        Y
      
    
    
    SQL>
    
  • Find the empty XML node on a table with 15 M lines

    I have a query that runs to always seek to empty xml node.

    CREATE TABLE TEST_TAB (ID number, doc XMLTYPE);

    SELECT COUNT (1)

    OF test_tab

    WHERE ((XMLEXISTS (declare default element namespace "http://oracle.com/»;)))  * / EmployeeNode / text () [not (empty (.))]'

    PASSAGE DOC)));

    Are there specific oracle or operator XML text that is more effective to check null values or a specific type of text/xml index that is best suited looking for nulls in the whole of nodes?

    Thank you

    Kevin

    In the meantime, here's a test on a similar scenario.

    It seems that the structured XMLIndex gives the best response time. The obvious drawback is that she is very specific and cannot be used to solve other queries.

    SQL > drop table test_tab is serving;

    Deleted table.

    SQL > create table test_tab like

    2. select id, cast (level as number)

    3, xmlparse (document

    4'http://xmlns.example.org ">"

    5         || -case when mod (level 5) = 0 then end level

    6         || '' correct

    (7) doc

    8 double

    9 connect by level<= 100000="">

    Table created.

    SQL > set timing on

    SQL > define pages 100

    SQL > set lines 200

    SQL > set autotrace on explain

    SQL >

    SQL > exec dbms_stats.gather_table_stats (user, 'TEST_TAB');

    PL/SQL procedure successfully completed.

    Elapsed time: 00:00:00.92

    SQL > select count (*)

    2 of test_tab

    3 where (xmlexists)

    4 ' declare default element namespace "http://xmlns.example.org"; / root/item/Text () '

    5 passage doc

    6  ) ;

    COUNT (*)

    ----------

    20000

    Elapsed time: 00:00:09.09

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 2371188561

    --------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

    --------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |          |     1.   125.   271 (1) | 00:00:04 |

    |   1.  GLOBAL TRI |          |     1.   125.            |          |

    |*  2 |   FILTER |          |       |       |            |          |

    |   3.    TABLE ACCESS FULL | TEST_TAB |   100K |    11 M |   269 (1) | 00:00:04 |

    |   4.    XPATH EVALUATION.          |       |       |            |          |

    --------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    2 filter (EXISTS (SELECT 0 FROM))

    XPATHTABLE ('/ oraxq_defpfx:root / oraxq_defpfx:Item / Text () ' PASSING: B1)

    PATH OF XMLTYPE COLUMNS ' C_00$ ' '.')  "P"))

    SQL >

    With the index structured:

    SQL >

    SQL > create index test_tab_sxi on test_tab (doc)

    2 indextype is xdb.xmlindex

    () 3 parameters

    4Q ' {XMLTABLE test_tab_xt

    5 XMLNAMESPACES (default 'http://xmlns.example.org'),

    6 ' / root/item / text () '

    {7 item_value PATH VARCHAR2 COLUMNS (30) '.'} "

    8  ) ;

    The index is created.

    Elapsed time: 00:00:10.13

    SQL >

    SQL > exec dbms_stats.gather_table_stats (user, 'TEST_TAB');

    PL/SQL procedure successfully completed.

    Elapsed time: 00:00:01.69

    SQL >

    SQL > select count (*)

    2 of test_tab

    3 where (xmlexists)

    4 ' declare default element namespace "http://xmlns.example.org"; / root/item/Text () '

    5 passage doc

    6  ) ;

    COUNT (*)

    ----------

    20000

    Elapsed time: 00:00:00.18

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 3461631238

    -------------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

    -------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |             |     1.    28.   290 (1) | 00:00:04 |

    |   1.  GLOBAL TRI |             |     1.    28.            |          |

    |*  2 |   HASH JOIN RIGHT SEMI |             | 22015 |   601K |   290 (1) | 00:00:04 |

    |*  3 |    TABLE ACCESS FULL | TEST_TAB_XT | 22015 |   343K |    20 (0) | 00:00:01 |

    |   4.    TABLE ACCESS FULL | TEST_TAB |   100K |  1171K |   269 (1) | 00:00:04 |

    -------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    2 - access ("TEST_TAB". ROWID = "SYS_SXI_0." ("' RID ')

    3 - filter("SYS_SXI_0".") ITEM_VALUE' IS NOT NULL)

    With an index not structured:

    SQL > drop index test_tab_sxi;

    The index is deleted.

    Elapsed time: 00:00:00.11

    SQL >

    SQL >

    SQL > create index test_tab_uxi on test_tab (doc)

    2 indextype is xdb.xmlindex

    3 parameters ("PATH of TABLE test_tab_pt

    4 PATHS (INCLUDE (/ root/point))

    (5 MAPPING of namespace (xmlns = "http://xmlns.example.org"))');

    The index is created.

    Elapsed time: 00:01:20.99

    SQL >

    SQL > exec dbms_stats.gather_table_stats (user, 'TEST_TAB');

    PL/SQL procedure successfully completed.

    Elapsed time: 00:00:06.56

    SQL >

    SQL > select count (*)

    2 of test_tab

    3 where (xmlexists)

    4 ' declare default element namespace "http://xmlns.example.org"; / root/item/Text () '

    5 passage doc

    6  ) ;

    COUNT (*)

    ----------

    20000

    Elapsed time: 00:00:00.45

    Execution plan

    ----------------------------------------------------------

    Hash value of plan: 2464052102

    ---------------------------------------------------------------------------------------------

    | ID | Operation | Name | Lines | Bytes | TempSpc | Cost (% CPU). Time |

    ---------------------------------------------------------------------------------------------

    |   0 | SELECT STATEMENT |             |     1.    42.       |   773 (1) | 00:00:10 |

    |   1.  GLOBAL TRI |             |     1.    42.       |            |          |

    |*  2 |   HASH JOIN RIGHT SEMI |             |  6547 |   268K |  2176K |   773 (1) | 00:00:10 |

    |*  3 |    TABLE ACCESS FULL | TEST_TAB_PT | 53020 |  1553K |       |   283 (2) | 00:00:04 |

    |   4.    TABLE ACCESS FULL | TEST_TAB |   100K |  1171K |       |   269 (1) | 00:00:04 |

    ---------------------------------------------------------------------------------------------

    Information of predicates (identified by the operation identity card):

    ---------------------------------------------------

    2 - access ("TEST_TAB". ROWID = "SYS_P0." ("' RID ')

    3 - filter("SYS_P0".") PATHID "= HEXTORAW ('061D') AND"

    SYS_XMLI_LOC_ISTEXT ("SYS_P0". "LOCATOR", "SYS_P0" "." " PATHID') = 1)

    (tested on 11.2.0.2)

  • How to pass an xml CDATA in the string element when OSB call a webservice?

    How to pass an xml CDATA in the string element when OSB call a webservice?

    I have a business service (biz) this route to exploitation of a Web service.

    An example of this legacy Web service request:
    < soapenv:Envelope xmlns:soapenv = 'http://schemas.xmlsoap.org/soap/envelope/' xmlns: ex = "example" >
    < soapenv:Header / >
    < soapenv:Body >
    < ex: run >
    < ex: arg > <! [CDATA [< searchCustomerByDocumentNumber >
    < documentNumber > 12345678909 < / documentNumber >
    [[< / searchCustomerByDocumentNumber >]] > < / ex: arg >
    < / ex: run >
    < / soapenv:Body >
    < / soapenv:Envelope >

    type ex: arg is a string.

    How to pass this structure CDATA webservice in OSB?

    Steps to resolve this problem:
    1 create an XML schema. For example:


    elementFormDefault = "unqualified" >


              
                   
                        
                             
                             

                        

                        
                             
                        

                   

         

         

         
         

    With this XSD, XML can be generating:


    documentNumber

    2 create an XQuery query to create a ComplexType searchCustomerByDocumentNumber. For example:
    (: pragma bea: element global-element-return = "searchCustomerByDocumentNumber" location = "searchCustomerByDocumentNumber.xsd" ::))

    declare namespace xf = "http://tempuri.org/NovoSia/CreateSearchCustomerByDocumentNumber/";

    declare function xf:CreateSearchCustomerByDocumentNumber($documentNumber_as_xs:string)
    as {(searchCustomerByDocumentNumber)}

    {$documentNumber}

    };

    declare the variable $documentNumber as XS: String external;

    XF:CreateSearchCustomerByDocumentNumber ($documentNumber)

    3. in your step in proxy pipeline add to assign the created the XQuery function call from the number of the document of your payload.
    Assign to a variable (for example: called searchCustomerByDocumentNumberRequest)

    4. create an another Transformation of XQuery (XQ) to create a request to the existing Web service. For example:
    {fn - bea: serialize ($searchCustomerByDocumentNumberRequest)}

    For more information about xquery Serialize function:
    41.2.6 fn - bea: serialize()
    You can use the fn - bea: serialize() function if you need to represent an XML document as a string instead of as an XML element. For example, you can share an XML document through an EJB interface and the EJB method takes the string as an argument. The function has the following signature:

    FN - bea: serialize($input as item()) as xs: string

    Source: http://docs.oracle.com/cd/E14571_01/doc.1111/e15867/xquery.htm

  • Date in format XML nodes

    I work with XML in AS3. I'm loading in an xml with dates in a format such as:

    2011-1-12-10-00-a

    I am to convert those to the actual Date of Flash in order to compare them and use the methods of the class Date, etc. I prefer convert once and then store them in the XML node, they came.

    Is it possible to store complex values such as date or what you have in an XML?

    Yes, or more directly using:

    var ms:int=date.getTime();

    var newDate:Date = new Date (ms);

  • How to set the value of the xml node.

    Hello

    I have the PDF application can be entered by the user using the key. When sending

    I use following code to set the value of the xml node.

    XFA. Data.assignnode ("Employee.ID", "123", 0):

    If its generators of xml as below.

    < employee >.

    < id > 123 / < ID >.

    < / name >

    < / employee >

    Now, I need to generate xml as below.

    < employee id = '123' >

    < / name >

    < / employee >

    So, how together create the id of node as above?

    Thanks in advance.

    Kind regards

    Dhiyane

    Hi Dhiyane,

    You must set contains the property if the node id to "metadata", i.e.;

    xfa.data.assignNode ("employee.id", "123", 0);
    XFA. Data.Employee.ID.Contains = 'metadata ';

    Very awkward, if you have a number of them, in which case you might want to look at using E4X.

    Good luck

    Bruce

  • analysis with different names of XML nodes

    Hello

    How can I find out the label of different node names parsing xml?

    I'm using something like

    It's the xml structure

    < DB >

    < image label 'design' = / >

    < familia label = "familias" / >

    < table label = "products" / >

    < /bd >

    This is the code

    var myXML:XML = new XML();
    myXML = XML (event.target.data);
    for (var i = 0; i < = myXML.length (); i ++) {}
    trace ("Nome da image" + myXML.tabela.label + "\n");
    }

    It locates my node names, but ignores the midle, because it is not designated as image

    what I need is to know how and what names has my xml

    Thank you

    the label is an attribute...

    for (var i: uint = 0; i< l;="">
    trace (XM. Children() [i] .@label);
    }

  • How to add the XML attribute to an element using BPEL assign

    I have a xml request to a bpel process that contains no attribute.
    After some process, I need to create this missing attribute and specify a value.

    I tried to use the XML fragment in the business to be divested. But how do I create an attribute?
    This XML node which I am trying to create an attribute is a very large knot with many dynamic typing(xsi:type). I can just re - create the complete xml code with the required nodes.

    Anyone know how I can create an attribute xml using the BPEL entitlement? I don't want to use the Java code in my process.

    Thank you.

    You can use the attribute bpelx:insertMissingToData on the item to copy, for example:




    Query="/client:process/@time"/ >

    If not there is time of the attribute in the process element, it will be added.

  • Problem with to access the XML nodes whose namespace

    Hello
    I have a XML file with the following format;

    "" "" "< graphml version ="1.3"xmlns =" http://graphml.graphdrawing.org/xmlns/graphml ' xmlns:y = ' http://www.yworks.com/xml/graphml ' xmlns: xsi = " http://www.w3.org/2001/XMLSchema-instance" > "

    < graph id = 'G' edgedefault 'ordered' = >

    < key data 'd11' = >
    < y: SharedData >
    < name there: Brush = "SolidBrush" color = "Black" id = "1" / >
    < / y: SharedData >
    < / data >

    < node id = "G:n0" >
    < y: Labels >
    < y: Text > <! [CDATA [start]] > < / Text: y >
    < / y: Labels >
    < / node >

    < node id = "G:n1" >
    < y: Labels >
    < y: Text > <! [CDATA [end]] > < / Text: y >
    < / y: Labels >
    < / node >

    < / chart >

    < / graphml >


    I access this file as < mx:XML id = "layoutXml" source = "tmp.xml" / > "

    I have no application debugging and found that the layoutXml object contains the xml file as it is. Now when I try to access any child node of layoutXml, every time I found null. Same instruction layoutXml.graph.toXMLString () or layoutXml.graph.toString () returns null.

    I have tryied the following approach as well, but did not work,
    var nameSpace:Namespace = new Namespace (" http://www.yworks.com/xml/graphml");
    var str:String = layoutXml.graph.node. (@id == ' G:n0").nameSpace::Labels.nameSpace::Text.toXMLString();")
    also, this property returns null.

    If anyone has the solution, please answer.

    Thank you.

    Namespace var sets default namespace:
    lack of namespace xml = nameSpace;

    You should then be able to reference nodes normally.

    Tracy

  • Extract the value of the node only using XQuery

    Hello

    I have a xml as XMLType stored in the table. XML is,

    < ocaStatus xmlns = "http://xmlbeans.apache.org/ocastatus" >
    < status >
    < > 990 statusCode < / statusCode >
    < statusDate > 2010 - 01 - 19 < / statusDate >
    < user name > OcaNimsAcf < / userId >
    < comment > DocumentnotinNIMS < / comment >
    < / status >
    < status >
    < > 990 statusCode < / statusCode >
    < statusDate > 2010 - 01 - 19 < / statusDate >
    < user name > OcaNimsAcf < / userId >
    < comment > DocumentnotinNIMS < / comment >
    < / status >
    < / ocaStatus >

    I use a combination of normal SQL and XQuery queries to extract data from table.
    I have a requirement where I have to shoot only value of XML node as only * 990 * without tags < statusCode >.
    I wonder if it's possible ass I've tried with two or three combinations of function extract().

    Thank you.

    Hello

    Different ways to do it, assuming you want the results in a relational table.

    XMLTable using:

    WITH t as (
     select xmltype('
    
    990
    2010-01-19
    OcaNimsAcf
    DocumentnotinNIMS
    
    
    990
    2010-01-19
    OcaNimsAcf
    DocumentnotinNIMS
    
    ') doc
     from dual
    )
    SELECT x.*
    FROM t, xmltable(
     xmlnamespaces(default 'http://xmlbeans.apache.org/ocastatus'),
     'ocaStatus/status'
     passing t.doc
     columns
      status_code number path 'statusCode'
    ) x;
    

    Using the 'old' (and obsolete) XMLSequence:

    WITH t as (
     SELECT xmltype('
    
    990
    2010-01-19
    OcaNimsAcf
    DocumentnotinNIMS
    
    
    990
    2010-01-19
    OcaNimsAcf
    DocumentnotinNIMS
    
    ') doc
     FROM dual
    )
    SELECT extractvalue( x.column_value,
                         'status/statusCode',
                         'xmlns="http://xmlbeans.apache.org/ocastatus"' ) as status_code
    FROM t, table(
     xmlsequence(
      extract(t.doc, 'ocaStatus/status', 'xmlns="http://xmlbeans.apache.org/ocastatus"')
     )
    ) x;
    

    Otherwise, targeting a specific node:

    WITH t as (
     select xmltype('
    
    990
    2010-01-19
    OcaNimsAcf
    DocumentnotinNIMS
    
    
    990
    2010-01-19
    OcaNimsAcf
    DocumentnotinNIMS
    
    ') doc
     from dual
    )
    SELECT extractvalue( t.doc,
                         'ocaStatus/status[1]/statusCode',
                         'xmlns="http://xmlbeans.apache.org/ocastatus"' ) as status_code_1
    FROM t;
    

Maybe you are looking for