Add the xmltype attribute node

How can I add an attribute node to xml in an xmltype?
Say that I
declare
  t_xml xmltype;
begin
  t_xml := xmltype( '<x a="1"/>' );
end;
How can I manipulate this variable t_xml become
<x a="1" b="2"/>
Anton

Depends on the version.

Before 11.2.0.3:

SQL> with t as (  select xmltype('') as t_xml from dual )
  2  select insertchildxml(
  3           t_xml
  4         , '/x'
  5         , '@b'
  6         , '2'
  7         )
  8  from t;

INSERTCHILDXML(T_XML,'/X','@B'
--------------------------------------------------------------------------------

 

On 11.2.0.3, by using XQuery Update:

select /*+ no_xml_query_rewrite */
       xmlquery(
        'copy $d := .
         modify ( insert node attribute b {$val} into $d/x )
         return $d'
        passing t_xml
              , '2' as "val"
        returning content
       )
into t_xml
from dual
;

(not tested, but should be close)

Marco Gralike wrote:
You should be able to build up the little together 'back' in a dynamic method, but for now, don't ask me how (mark)?

The generic approach would require market the entire tree down recursively to the copy existing nodes and add the new in the right place.
Although XQuery (without involving XQUF) can do it, it's more of a task for XSLT:

SQL> with t as (  select xmltype('') as t_xml from dual )
  2  select xmltransform(
  3           t_xml
  4         , xmlparse(document
  5  '
  6    
  7    
  8    
  9      
 10        
 11      
 12    
 13    
 14      
 15        
 16      
 17    
 18  '
 19           )
 20         , q'{att="'2'"}'
 21         )
 22  from t;

XMLTRANSFORM(T_XML,XMLPARSE(DO
--------------------------------------------------------------------------------


 

Tags: Database

Similar Questions

  • Where to add the transitional attribute at the level of the entities or view level? And where to use {return getTransientAttribute()} in the entity or view?

    Mr President

    JDev 12.2.1.

    Where to add the transitional attribute at the level of the entities or view level?

    And where to use {return getTransientAttribute()} in the entity or view?

    public Number getAmount()  
      {  
        return getTransientAttribute();  
        //return (Number) getAttributeInternal(AMOUNT);  
      }  
    
    

    Concerning

    A difference I could think: place a transient attribute on EO level will make transaction dirty (DBTransaction.isDirty returns true) when the field is changed.

    From a design point of view, I tend to place the transient fields at the level VO, because most of the time they are for the presentation of the data in the user interface.

    Only when the transient fields are involved in DML operations (for example when you call a stored procedure EntityImpl.doDML) I place the transitional area on EO.

  • How to add the transient attribute for LOV (object of the view read-only)

    I have a view called CustomerView and attribute DepartmentId is present in it.

    Also exists DepartmentView and CustomerView.DepartmentId has an LOV from this point of view.

    I need to add a transient attribute to CustomerView which express the DepartmentName attribute in the LOV.

    Because of the view are read-only there is no entity object don't match them.

    How can I write the groovy for the transitional object expression.

    The name of the view accessor Lov's DepartmentView1

    Looking for your help. Thank you.

    Hi gcoban

    I do not understand your question correctly,

    you are not able to write to the expression property in viewObject?

    or you want to know how to write groovy for that?

    for writing groovy you need viewAccessor and you who have, you can try as Alejandro Tovar Lanz suggested

    or you can write code in RowImpl to fill in the name of the Ministry of the accessor

    See -https://blogs.oracle.com/adf/entry/combo_lov_how_to_display

    Thank you

  • No data is recovered to add the Dimension attribute in Excel

    Hi Experts,

    IAM facing the question below when retrieving values for an attribute dimension in excel, add in.

    We have three types of regime, namely AAAA/BBBB/CCCC, which have been refreshed to Essbase. BENAMER will get data on YYYY revenues and employee data of the CCBC through an XREF function.

    While recovery data on revenues for the attribute ATTRI1 to the size of the merge attribute member, if we collect of AAAA, he has no problem while when pull us the BENAMER, at the business unit level parent values extracted successfully, but when we drill down to a profit of level 0 Center then values are not recovered. Attributes are associated with level 0 of the dimension of the base members. The above works fine when extract us data from a data form by using the connection of planning.

    Any help is appreciated on the above.

    Thank you.

    So your fragmented senior level members are dynamically calculated?

    I wonder if it is interacting with the order of the attribute size calc and not rewarding as you wish.

    The SER60 has a lot of good things about the attributes: http://download.oracle.com/docs/cd/E10530_01/doc/epm.931/html_esb_dbag/dattrib.htm

    You can think of to senior level members in the function stored/never share and see if you get the result you're looking for. If the function is sparse, I should think long and seriously if I really want these members to be calculated dynamically due to the impact on retrieval performance.

    Kind regards

    Cameron Lackpour

  • Add the dimension attribute

    Hello

    Anyone know how to add the attribute dimension on Hyperion Planning?

    Thanks in advance.

    Kind regards
    Stephan

    Hello

    If you have more than 1 size of the attribute associated with a dimension, then when you reverse the planning application in the dimension you will get a column for every dimension of the attribute.

    So if you have a TestAttrib1, TestAttrib2 associated with the entity, reverse dimension model.

    Look in the entity of the inverse model dimension, you will see the TestAttrib1 and TestAttrib2 columns.

    Now in your workload file, you can load into the columns in your source file.

    Ok?

    See you soon

    John
    http://John-Goodwin.blogspot.com/

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

  • Add the XML attribute

    Right now I work with a very simple .xml file that retrieves data ultimately resulting in the generation of run-time components. Here is a simplified version:

    < data >
    < article type = "Button" x = "50" y = "100" label = "Button 1" / >
    < article type = "Button" x = "50" y = "300" label = "Button 2" / >
    < / data >

    I figured out how to remove an attribute, such as the "label" with this:

    If (. name(). attributes() [i] myXML.item [0] == "label" "")
    {
    delete myXML.build.item [0]. attributes() [i];
    i-- ;
    }

    Now, the question is how can I add another attribute - like the "height"? Any help would be greatly appreciated. Thank you.

    Okay, I just stumbbled on the solution:

    x 1. @["name"] = "test 2"; "

    This seems to do. I don't know if the reverse works just not or if I did it all just bad. Thanks for your help.

  • How to add custom XML attributes

    How to add the custom attribute recusrivly. With the order of the sequences.

    Before xml: -.

    var myxml:XML =

    < root >
    < leval0 >
    < leval1 >
    < leval2 > < / leval2 >
    < leval2 > < / leval2 >
    < / leval1 >
    < leval1 >
    < leval2 > < / leval2 >
    < leval2 > < / leval2 >
    < / leval1 >
    < / leval0 >
    < / root >

    After xml:

    var myxml:XML =

    < root >

    < leval0 levalid = '0' >

    < leval1 levalid = "0_0" >

    < leval2 = "0_0_0" levalid > < / leval2 >

    < leval2 = "0_0_1" levalid > < / leval2 >

    < / leval1 >

    < leval1 levalid = '0_1' >

    < leval2 = "0_1_0" levalid > < / leval2 >

    < leval2 = "0_1_1" levalid > < / leval2 >

    < / leval1 >

    < / leval0 >

    < / root >

    Call this method

    trace (AddAttribute (myXML));

    method

    private void addAttribute(node:XML,_depth:String_=_""):XML

    {

    If (node.hasComplexContent ())

    {

    var int count = 0;

    var: String prefix = 0< depth.length="" depth="" +="" "_"="" :="">

    var currentAtt:String;

    for each (var nodeItem:XML of in node.children ())

    {

    currentAtt = prefix + count;

    nodeItem.@levalid = currentAtt;

    addAttribute (nodeItem, currentAtt);

    Count ++;

    }

    }

    return the node;

    }

  • To add the details of the namespace in an XmlDocument

    Hi friends,

    I need to add the details of the namespace in an XML document

    Details of Namespace are

    "

    <? XML version = "1.0" encoding = "UTF-8" standalone = "yes"? >

    < DeriveCoverageRequest xmlns = "urn: XYZ:ccw:config:common: data" xmlns:ns1 = "urn: XYZ:ccw:config:msa: data" >

    "

    the XML data is derived from a function and the code how it ends

    "

    ...................

    l_xmltype: = dbms_xmldom.getXmlType (l_domdoc);

    dbms_xmldom.freeDocument (l_domdoc);

    dbms_output.put_line (l_xmltype.getClobVal);

    "

    the value of l_xmltype give the xml data

    as

    < Majorline >

    ..........................data .. data

    ..........................

    < Majorline >

    I want to concatenate

    <? XML version = "1.0" encoding = "UTF-8" standalone = "yes"? >

    < DeriveCoverageRequest xmlns = "urn: XYZ:ccw:config:common: data" xmlns:ns1 = "urn: XYZ:ccw:config:msa: data" > with l_xmltype then the out put of l_xmltype would be


    <? XML version = "1.0" encoding = "UTF-8" standalone = "yes"? >

    < DeriveCoverageRequest xmlns = "urn: XYZ:ccw:config:common: data" xmlns:ns1 = "urn: XYZ:ccw:config:msa: data" >

    < Majorline >

    ..........................data .. data

    ..........................

    < Majorline >

    So why not use the DOM all along and add the missing root node in the service as well?

    If this approach is to give the output in the required format.

    All can do the DOM is also possible using the SQL/XML functions, much less tedious way.

    Anyway... This should give the expected results:

    select '' ||
           xmlserialize(document
             xmlelement("DeriveCoverageRequest"
             , xmlattributes(
                 'urn:XYZ:ccw:config:common:data' as "xmlns"
               , 'urn:XYZ:ccw:config:msa:data' as "xmlns:ns1"
               )
             , l_xmltype
             )
             as clob
           )
    from dual;
    

    Your DB character occupies AL32UTF8?

    If so, no problem encoding to hardcode a "UTF-8" don't like this.

    Otherwise, it is false since the actual coding of the data will not reflect in the XML prolog.

  • change the value of the location attribute in db jca file with the configuration file

    Hello

    How can I change the value of attribute of 'place' in the jca adapter db file by using the configuration level if possible?

    I have the database map file where the first two lines are:

    < name of the adapter-config = "getParty" = 'Database adapter' adapter wsdlLocation = "getParty.wsdl" xmlns =" " http://platform.integration.Oracle/blocks/adapter/FW/metadata ">

    < connection-factory location = ' ist/DB/CRP1"UIConnectionName ="crp1_apps"adapterRef =" "/ >

    ...

    I need to replace the configuration file

    EIS/DB/CRP1

    with

    EIS/DB/DEV

    but this isn't the case. I think that I am not referencing correctly but I don't know how he is correct, that I couldn't find examples for composites and wsdl content, JCA file.

    Please share the idea.

    Thank you

    Anatoliy

    Anatolly salvation,

    You can assign a new value to the property of JCA by using either the Ombudsman as BPEL.

    Pick click entitled value option and add the right attribute to the property JCA jca.db.DataSourceName.

    In BPEL will zoom click the invoke for the DB adapter, go to the Properties tab and add the right attribute to the property JCA jca.db.DataSourceName.

    (edit)

    If you want to use a configuration file to set the value, I suggest a BPEL property, the value can be replaced by using a configuration file and can be assigned to the JCA property using ora: getPreference ("prefName as string");

    When you use a mediator does not have a preference, and you can use a placeholder that you change when you compile the SCA composite. With ANT in combination with hudson, you can easily replace the value (hard) by the environment.

    See you soon,.

    Robert van Molken

    Specialist of the integration of Oracle

    Post edited by: robertvm

  • How to add the attribute authorization 4.2 GBA

    Dear experts, ACS,

    I am using 4.2 ACS to authenticate and authorize the GANYMEDE + traffic from the appliance Steelhead of Riverbed WAN Optimizers.  One of the tasks of configuration is to add the attribute authorization following the 4.2 ACS.

    Service = {rbt-exec
    local-user-name = 'monitor '.
    }

    After reviewing all options on ACS configuration, I am at lost.  I don't know where to put this attribute.  Please point me in a good direction.

    Thank you very much!

    Hi Kevin - I can steer you in the right direction-

    1. Go to Configuration of the Interface > GANYMEDE + (Cisco)
    2. Under the terms of new Services, check the option box and type "rtb-exec" to the terms of Service and "Unknown" under the Protocol
    3. Press send
    4. Go to your ACS group and under settings GANYMEDE + it must be a new Service
    5. Fill in service as follows:

    This should help some of the way-this article suggests a problem where it won't give you full access, but I have not tested:

    http://community.riverbed.com/T5/Steelhead-appliance/TACACS-authentication-monitor-access/m-p/7417

  • Oracle BPEL 2.0 - add the child node

    Hi guys,.

    SOA 11.1.1.7, BPEL 2.0

    I have a child screaming master BPEL BPEL flow flow in a ForEach loop.

    I have part of the answer like this:

    < caseResponses >

    < caseResponse >... < / caseResponse >

    < caseResponse >... < / caseResponse >

    < / caseResponses >

    CaseResponse items come from child BPEL flows.

    I'm trying to add each of these elements in the element parent < caseResponses > but when running I get "The Exception is thrown because the in-specs on the 112 line are assessed to be empty," where the line 112 is the line append.

    My code is:

    < assign the name = "AppendToResponse" >

    < extensionAssignOperation >

    < bpelx: Add >

    < bpelx: go > $InvokeHandleSingleCarglassCase_process_OutputVariable.payload / ns1:caseResponse < / bpelx: go >

    < bpelx: to > $outputVariable.payload / client: caseResponses < / bpelx: to >

    < / bpelx: Add >

    < / extensionAssignOperation >

    < / assign >

    If I add a copy - just like a test rule-

    < assign the name = "AppendToResponse" >

    < copy >

    < a > $InvokeHandleSingleCarglassCase_process_OutputVariable.payload / ns1:caseResponse < / from >

    < to > $outputVariable.payload/client:caseResponses/client:caseResponse < /pour >

    < / copy >

    < extensionAssignOperation >

    < bpelx: Add >

    < bpelx: go > $InvokeHandleSingleCarglassCase_process_OutputVariable.payload / ns1:caseResponse < / bpelx: go >

    < bpelx: to > $outputVariable.payload / client: caseResponses < / bpelx: to >

    < / bpelx: Add >

    < / extensionAssignOperation >

    < / assign >

    I works as expected: all caseResponse items are added and there is also one more copy activity.

    What can I do so that I don't get the "The Exception is thrown because the in-specs on the 112 line are assessed to be empty" exception without copy assign?

    Thank you!

    By the way

    Rather than add it, you can use the copy, but instead of the normal copy you must change the code a bit to something like:

    $InvokeHandleSingleCarglassCase_process_OutputVariable.payload / ns1:caseResponse

    $outputVariable.payload / client: caseResponses[$ForEachCounter]/ client: caseResponse

    If you add the counter and checks that I wrote in the previous answer basically it will create a node at position x (x being the value of the counter) and the copy of your result

  • Cannot add the attribute Pro-VO again after the creation of VO.

    Hi all

    Earlier during the creation of the VO, I switched a few columns of EO to VO, and they were defined as calculated attributes.

    Now since I had need of a few more added (enabled/disabled) columns of EO, I rocked them but they are created as transient attributes.

    Even if I'm unable to match to the column in the query, if I click on mapped to the column, or SQL, is not applied do.

    Is it possible to add attribute (columns) calculated of EO to VO, so that I can make transactions through them.

    Thank you and best regards,

    Gauthier

    Hi all

    Just tried it after step and succeeded.

    Please follow the steps if you want to have the EO based attribute (when the transitional attribute is be created instead) below.

    Step 1: Add the column to the table in the SQL query.

    Step 2: Turn the column that you want to use in vol. (it can be created as transitional).

    Apply, save and close the J-developer (to avoid unwanted problems)

    Step 3: File Open XML of the VO.

    This is what it looks like when you have transient attribute:

    <>

    Name = "CreatedByUser".

    IsSelected = "false".

    IsPersistent = "false".

    Precision = "255".

    Type = "Java.lang.String"

    ColumnType = "VARCHAR2".

    AliasName = 'CREATED_BY_USER. '

    SQLType = 'VARCHAR' >

    Step 4:

    Change the tags as below:

    <>

    Name = "CreatedByUser".

    EntityAttrName = "CreatedByUser".

    EntityUsage = "XxxxxXEO".

    AliasName = "CREATED_BY_USER" >

    Please note the name, EntityAttrName and Alias name must be identical to that available in OT.

    Step 5:

    Open Jdeveloper and rebuild the project. Open the VO and check to confirm if it had changed and calculated attribute.

    Thank you and best regards,

    Gauthier

  • How to add a transient attribute of a table values in the new attribute group wise transient that is to say wise customer?

    Mr President.

    How to add a transient attribute of a table values in the new attribute group wise transient that is to say wise customer?

    as below

    custwisevalue.png

    Concerning

    Hello world

    for an overview in the following form

    This is the sql query that reach this format

    SELECT c.name customer_name,
            p.name product_name,
            sl.sal_qty,
            sl.unit_sal_price,
            sl.sal_qty*sl.unit_sal_price AS salesvalue,
            CASE
              WHEN ROW_NUMBER () OVER (partition by c.cust_id order by p.prod_id desc,sl.sal_id desc) = 1 THEN
                  SUM (sl.sal_qty*sl.unit_sal_price) OVER (PARTITION BY c.cust_id)
            END totals
    FROM customer c INNER JOIN sales s ON s.cust_id = c.cust_id
    INNER JOIN salesline sl ON sl.sal_id = s.sal_id
    INNER JOIN product p ON p.prod_id = sl.prod_id
    ORDER BY c.cust_id,p.prod_id,sl.sal_id
    

    Cheers and enjoy

    Respect of

  • Simple: How do I add the title for af:InputText attribute

    Hi guys,.

    I have a simple question, is it possible to have the title attribute for af:InputText as the value of input field?

    Thank you

    Aerts

    Hi Timo,

    Oracle JDeveloper 11g Release 1 11.1.1.6.0

    If we do a view source of the inputText field, you will see a title attribute get generated when you have a certain value in your area. If the user wants to any other title except for the value, there is no other way except using shortDesc but there is a problem with the help of the attribute "shortDesc" because it shows the note window. At the moment there is no way to add the title with using attribute shortDesc and we cannot use shortDesc because of the notewindow.

    It's a thing that oracle should be corrected in future versions (the ability to add existing or custom html attributes to a tag)

    Thank you

    Aerts

Maybe you are looking for