Remove the specific node of an XML stored as XMLType

Hello

I have a XML stored as XMLType,

< ocaStatus xmlns = "http://xmlbeans.apache.org/ocastatus" >
< status >
< > 700 statusCode < / statusCode >
< statusDate > 2010 - 03 - 31 12:39:41.580 GMT + 05:30 < / statusDate >
< username > 1234 < / userId >
< comment > Document is deleted from the OCA. < / comment >
< / status >
< status >
< > 934 statusCode < / statusCode >
< statusDate > 2010 - 03 - 31 12:39:41.580 GMT + 05:30 < / statusDate >
< username > 1234 < / userId >
< comment > Document is deleted from the OCA. < / comment >
< / status >
< status >
< > 934 statusCode < / statusCode >
< statusDate > 2010 - 03 - 31 12:39:41.580 GMT + 05:30 < / statusDate >
< username > 1234 < / userId >
< comment > Document is deleted from the OCA. < / comment >
< / status >
< / ocaStatus >

I have a requirement where the first occurrence of statusCode 934 should be removed from the XML.
I can do through a java program. But that is costly.
Is there a way that this can be done by a SQL XMLQuery/XPath statement?

Help, please.
Thanks in advance.

You can use DELETEXML:

SQL> select xml from myxml;

XML
--------------------------------------------------------------------------------


700
2010-03-31 12:39:41.580 GMT+05:30
1234
Document is deleted from OCA.


934
2010-03-31 12:39:41.580 GMT+05:30
1234
Document is deleted from OCA.


934
2010-03-31 12:39:41.580 GMT+05:30
1234
Document is deleted from OCA.



SQL> update myxml
  2  set xml = deletexml(xml,'//status[statusCode="934"][1]',
  3                          'xmlns="http://xmlbeans.apache.org/ocastatus"');

1 row updated.

SQL> select xml from myxml;

XML
--------------------------------------------------------------------------------


700
2010-03-31 12:39:41.580 GMT+05:30
1234
Document is deleted from OCA.


934
2010-03-31 12:39:41.580 GMT+05:30
1234
Document is deleted from OCA.


Max
http://oracleitalia.WordPress.com

Tags: Database

Similar Questions

  • How to call the specific node of the navigation model?

    Hello

    I have a portal application webcenter containing a custom navigation template. HIES model is used by the menu tree and bread crumbs.
    Users request a link in the template to navigate to the home page. I could make a case of navigation in my ADFC-config file to navigate to the home page, but I would rather use the navigation model. Is there a way to select a specific node in the navigation model and navigate using a button or a link?
    I've been looking for this much time, but could not find an example. It's has enough of the menu etc, but not cela.
    Thank you...

    You can use the same navigation model just like using the template of menu xml
    http://www.orastudy.com/oradoc/selfstu/Fusion/Web.1111/b31973/af_navigate.htm#CACDBFEI
    For more information on the el here chk
    http://docs.Oracle.com/CD/E21764_01/WebCenter.1111/e10148/jpsdg_app_els.htm#CHDCBJGJ

  • Is it possible to remove the specific backup folder.

    Hello

    Please find below RMAN backup scenario,

    JUNE_01 - LEVEL 0

    JUNE_02 - CUMULATIVE LEVEL 1

    JUNE_03 - CUMULATIVE LEVEL 1

    JUNE_04 - CUMULATIVE LEVEL 1

    JUNE_05 - CUMULATIVE LEVEL 1

    Here is my need,

    (1) can I delete specific folders (middle of the order's backup) which are below.

    03 JUNE - CUMULATIVE LEVEL 1

    04 JUNE - CUMULATIVE LEVEL 1

    So how to remove it.

    I tried with the following query that is not delteted, please find this query, is there any correction, or if you have the correct question to delete specific folder then pls share.

    (2) if I removed above at the mentioned date backup folder as below,

    03 JUNE - CUMULATIVE LEVEL 1 - deleted

    JUNE 04 - CUMULATIVE LEVEL 1 - deleted

    and have only one backup set that is have below.

    JUNE_01 - LEVEL 0

    JUNE_02 - CUMULATIVE LEVEL 1

    JUNE_05 - CUMULATIVE LEVEL 1

    Can I restore complete database from 01 June to 05 June, because I take the cumulative backup level.

    According to the Cumulative level 1 backup strategy, it backs up all recent changes each time after the recent level 0.

    And yet one thing I enrolled as PARAMETER RMAN

    BACKUP OPTIMIZATION,

    So, is this all possible and Impossible. Please, share your experience. Most welcome and thank you in advance

    Cumulative level 1 backups contain all changes since last level 0 backup. So if you do not need to restore from a specific date within your backup cumulative level 1, you can remove it. In your case, you can remove the 03 and 04 of June and can restore the database from June 01, 02 and 05 June as offers, depending on the availability of the last backups.

    If you can restore your database at any other time, beside your incremental backups, also depends on restoring archived newspapers available. In this case, restore you the database from a full or level 0 backup and recover the database using newspapers to check-in to the current or previous point in time.

    To remove specific backupsets, you can use the command "List backup RMAN summary" and use then 'delete backupset ' to delete the backup.

    http://docs.Oracle.com/CD/E11882_01/backup.112/e10643/rcmsynta027.htm#RCMRF132

  • How to remove the Parent node in the tree

    Hello

    I have a component of the tree in oracle adf and I want to delete a node in this tree. When I want to remove a child node, I don't have an error but when I want to delete a parent node, who have children, I have error. because it has foreign keys.

    Can someone help me?

    You can follow one of two approaches suggested by Timo

    I'd rather cascase remove option - see this https://www.silnium.com/blog/adf/implementing-adf-cascade-delete/

    Cascade Delete - ADF | Technology blog

    If you want to cross-see this

    Andrejus Baranovskis Blog: How browse ADF

  • remove the specific item in the arraylist

    Hey,.
    I just want to remove an element from a list of tables.

    private function addNewItem():void {
              object = new ObjectProxy();
              object.id = input.text;
              arrayList.addItem(object);
    }
    

    Now how can I remove the sound element identifying specific?

    something like this:

    arrayList.removeItem(object.id=="blabla");

    or

    for each (obj:Object in ArrayList){
              if(obj.id == "blabla"){
                   ArrayList.removeItem(obj.id);
              }
    }


    I hope you can help me.
    Greetings,
    Zombiecook

    Your second code example is close. Just remove the obj instead of the id when you find it like this:

    for each (obj:Object in list){          if(obj.id == "blabla"){               list.removeItem(obj);          }}
    

    Of course, it would be more efficient to simply do:

    for (var i:int = 0; i < list.length; i++){          if(obj.id == "blabla"){               list.removeItemAt(i);               break;          }}
    

    -Kevin

  • How can I remove the specific paths?

    I asked this question before, but in the other case, it was of two forms.

    This case, I've got various forms that overlap between them.

    How these forms of group and delete the specific paths in order to have only an outline (which is complete) left?

    Thank you!

    you mean each path in the perimeter of these form forms? "unite" in the pathfinder

  • If I remove the permission to add back apps stored on external hard drive?

    I'm selling my Mac. To help the sale, I wish I could say that it includes the iWork (Pages, Numbers, Keynote) applications that I bought when new and Aperture 3.  I ask because I don't mean a buyer they will have access to these applications, if this isn't the case. I live in a country where it is expected that when you buy a used computer, it will come with the applications already installed. These 'options', even if they won't use, contribute to the resale value.

    I backed up everything to an external hard drive for x - fer to my next computer, including the applications mentioned. If I scratch out / reformat the hard drive and then the new owner create their own Apple to download Yosemite or El Capitan ID (I'm in Mavericks now) I was able to connect my external drive for Mac, and then copy the apps on his Applications folder so that he would be able to use? I care is no longer using opening myself, having switched to Lightroom and I know that if it is possible these applications would no longer under my ID and that he would not be able to upgrade, but since I've paid for them, I would be able to transmit with the Mac without having to use my Apple ID of the to do.

    Unless you have records of installation for these applications, you can not legally include.

    This applies also to any OS you downloaded from the app store.

    In all cases, licenses for the operating system and applications downloaded on the app store are valid only for the Apple ID used to obtain them, and they are not transferable. If you leave these applications or the operating system, the buyer will not be able to update or reinstall the OS without your ID Apple and your password.

    Thus, you will need to completely erase the hard drive and you can then reinstall the original OS, the computer came with.

  • remove the specific element of the array

    Hello

    I would like to delete all the values '0' of the table.

    In the following table:

    -60

    -50

    0

    -60

    0

    0

    -55

    the leading array to return must be

    -60

    -50

    -60

    -55

    Any help will be greatly appreciated.

    Thank you

    hiNi.

    Have you tried a search? This issue has developed dozens of times.

    If the table is small table build in a loop as described is very good. However, for large networks, it's a BAD way to do it. Instead, you need an alternative

  • I have Microsoft vista, a dell inspiron 530 desktop computer and need to remove the specific .dll files from the registry which are files of Trojan horses. How can I do this?

    I found some information online to open my computer in safe mode, type regedit in the start menu and then double-click HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet n to locate and eliminate the malware file name. Everything was fine until the part of filename to locate because no file name appeared

    Hello

    Unless you know exactly what you do, in any case you are to change your registry database.

    This can make your operating system unusable.

    Download, install, update and scan your system with the free version of Malwarebytes AntiMalware in Mode safe mode with networking:

    http://www.Malwarebytes.org/products/malwarebytes_free

    And here's how to go in Safe Mode options; Select safe mode with networking from the list of options:

    http://Windows.Microsoft.com/en-us/Windows-Vista/start-your-computer-in-safe-mode

    See you soon.

  • Remove the XML node

    Dear adobe experts,

    I have a requirement to remove a node in the XML interface of a form of adobe (not only by removing a subform in the form). It must be a deletion, an empty node does not work (I read this in another post).

    The XML structure looks like this:

    < ITEM >

    < DATA >

    < ROW_IID > 0 < / ROW_IID >

    < PARENT > 0 < / PARENT >

    < CHILD > 0 < / CHILD >

    < / DATA >

    < DATA >

    < ROW_IID > 1 < / ROW_IID >

    < PARENT > 0 < / PARENT >

    < CHILD > 0 < / CHILD >

    < / DATA >

    < / ITEM >

    I want to, for example, to remove the second node of data including the underlying elements: row_iid, parent & child. Already tried: xfa.record.nodes.remove (oRemoveNode); I got it from http://partners.adobe.com/public/developer/en/xml/Adobe_XML_Form_Object_Model_Reference.pd f and several messages in this forum, but I get the following message appears in the error console: remove failed. I know that the somexpression is correct.

    Here's the code I used to try to remove the node.

    var node_loc;

    var del_node;

    [node_loc = ' xfa.record.ELEMENT.DATA [1 '];

    del_node = xfa.resolveNode (node_loc);

    xfa.record.Nodes.Remove (del_node);

    Anyone know what I am doing wrong?

    Kind regards

    Niels

    Hi Steve,.

    I fixed it myself. I adjusted my code a little, so the node, including the elements is successfully deleted.

    Here is the way that I fixed it:

    var node_loc;

    var del_node;

    [node_loc = ' xfa.record.ELEMENT.DATA [1 '];

    del_node = xfa.resolveNode (node_loc);

    xfa.record.ELEMENT.nodes.remove (del_node);

    Thanks for the help!

    Kind regards

    Niels

  • How to remove a node in an XML document

    Hello

    My flex plugin loads an XML document that is passed from the ExternalInterace. I have a list control that displays the data from the XML document.

    The XML looks like:
    < document >
    < response >
    < objectlist >
    < list type = "type" >
    < object type = "type" name = "Value name" id = "GUID value1" >
    < params >
    .........
    .........
    < params >
    < / object >
    <! - several items in this list - >

    < / list >
    < / objectlist >
    < / answer >
    < / document >

    I set the dataProvider of the list to xmlDoc.response.objectlist.list.object

    Here, I want to delete one of the object before displaying the data nodes (in other words, I don't want one of the nodes in the document XML should appear in the list).

    How can I do this? I couldn't find a way to remove a node in the XML api.

    -Gerard

    You can either use the operator 'delete ':
    delete xmlDoc.response.objectlist.list.object [5]
    When the object to delete can be the fifth down (you need to play with your xml code in debugging down actual values) or convert xmlListCollection. The xmlListCollection provides easy methods to remove the offending nodes or you can provide a function filterFunction for the collection that allows you to "hide" the node.

  • Remove the node text spaces

    Hello

    We are in the process to migrate our 10.2.0.4 db to 11.2.0.3 and discovered a problem with one of our requests - basically, extract us from the text of a node as a number and if this node consists of a space only, he is now back a 0 in 11.2.0.3 rather than the NULL value, it allows to return to 10.2.0.4 (and earlier versions).

    Here are examples I've worked with:
    select extract(xmltype('<root><test> </test></root>'), '/root/test/text()').getnumberval() from dual;
    select extract(xmltype('<root><test>
    </test></root>'), '/root/test/text()').getnumberval() from dual;
    I raised a SR with Oracle, due to the difference in the behavior of our 10 g database, but in the meantime, I need to work around this problem. If there's an orderly way to remove the whitespace node text? I would rather have to convert the xmltype to a clob to do a replacement, or the extraction of the node as text and then cut and replace and converted to a number, if possible.

    Hello

    I can reproduce the 'new' behavior on 10.2.0.5 too:

    SQL> select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE    10.2.0.5.0      Production
    TNS for 64-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
    
    SQL> select extract(xmltype('
      2  '), '/root/test/text()').getnumberval() as result
      3  from dual;
    
        RESULT
    ----------
             0
    

    On 11.2.0.3, if you can invest time in refactoring, I would say that rather use you no deprecated features:

    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    
    SQL> select xmlcast(
      2           xmlquery('normalize-space(/root/test)'
      3             passing xmltype('
      4   ')
      5             returning content
      6           )
      7           as number
      8         ) as result
      9  from dual ;
    
        RESULT
    ----------
    
    SQL> select xmlcast(
      2           xmlquery('normalize-space(/root/test)'
      3             passing xmltype('123')
      4             returning content
      5           )
      6           as number
      7         ) as result
      8  from dual ;
    
        RESULT
    ----------
           123
    
  • HP15: error Hp printer after you remove the program from the printer.

    I looked in the startup of Windows C. and ran msconfig, but can not find the files that has been said in the previous post.

    So what I do now? I want to get rid of this error message at the beginning upward

    Hey @vmundy2,

    Thanks for getting back to me on this subject.

    The HPStatusBl.dll is alerts ink Monitor on the computer. The uninstall process could not delete the shortcut for it.

    I can have you try the steps mentioned by my colleague @HevnLgh here: Re: DLL problem run to remove the specific file.

    Please let me know if these steps resolve the dll error. Good luck!

  • 12.2 EBS on CARS; Do I need to install the infrastructure of grid on the applications node?

    I have my cluster of 2 nodes running without any problem.

    I do the rapidwiz for applications and then when it got to the point where say you, it's what you want put on some RAC nodes, when I clicked on the button

    It gave me an error about how it has not found the RAC nodes in an .xml file.

    Is it because you have to have the infrastructure installed grid and back up and running for applications to be able to search the RAC nodes?

    Also, do I need to configure the grid Infrastructure on the node applications in some way?


    I found several guides on how to do it, but I'm running into some different questions.

    Thank you

    Lady Allora.

    Hello

    Yes, you need to have PAP/GRID services i.e., CRS, CSS etc. must be running.

    When you select CARS as installation on screen rapidwiz, it prompts you for the nodes on which RAC services are running.

    If you have 2 node RAC, it will list the 2 nodes and you will need to select them for your installation.

    It is not that I know of any special configuration required.

    Kind regards

    Hugues

  • Retrieve / search a specific node of the XML file

    Hello

    I have a question about reading the XML (search) in PL SQL file:

    There is an XML file with the following structure:
    <root>
      <Hnode1 attr1="value1" />
      <Hnode2 attr1="value1" /> 
         <node1_of_Hnode2 id="10" personname="Steven"/>
         <node2_of_Hnode2 id="20" personname="Christian"/>
         <node3_of_Hnode2 id="30" personname="Arnold"/>
         .
         .
      <Hnode2/>
    <root/>
    How it is possible to filter a node by one of its attribute value. For example:
    The id of a person - I guess that id = 20. In this case I would like to get the whole node (in this case node2_of_Hnode2) to get the personname = > 'Christian '.
    Just like a SELECT statement (WHERE ID = 20)

    Is it possible to get it in a single order or should it be buckled on all the lines in the Document. Can you please provide an example for me.

    Thank you for advice!

    The basic version is 10.

    Sorry, this is not a version.
    For example:

    SQL> select * from v$version;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
    PL/SQL Release 10.2.0.5.0 - Production
    CORE     10.2.0.5.0     Production
    TNS for 64-bit Windows: Version 10.2.0.5.0 - Production
    NLSRTL Version 10.2.0.5.0 - Production
     
    

    The use of the extraction of the values?
    1. better in a Select statement. assignment directli in a variable, or by using the xmlquery function?

    PL/SQL or SQL calls to the XMLType methods such as getStringVal() or extract() function should be equivalent (save the change of context).
    However, none of them are the right way to retrieve a scalar value of a given node.
    You must use the rather extractValue() function (SQL only) for immediate release< 11.2="" and="" xmlcast/xmlquery="" starting="" with="">

    Another Question:

    I've seen a lot of options for dealing with XML files.

    In my case only query data in XML files is relevant.

    I've seen to many API called XMLDOM, DMBS_XMLDOM, XMLTYPE...

    When to use these APIs. Can you give me feedback on this please?

    It is a broad topic.
    An appropriate response will depend on your condition.

    -You have to deal with large files and if so what size?
    -Performance/memory management is a concern for you?
    -You want to extract unique values or process the XML content in the form of relational data?

    If you have any specific test cases to show us, please post in the {forum: id = 34} forum and make sure to include all the necessary details (see the FAQ).

    Published by: odie_63 on 23 Feb. 2012 11:35

Maybe you are looking for