Put the ID attributes on all nodes

Hello

I have a similar to the following XML

< root >
< elem >
< subElem >
< / subElem >
< / elem >
< elem >
< subElem >
< / subElem >
< subElem >
< / subElem >
< / elem >
< / root >


I'm putting a lot of 'Id' attributes on each item for easy access. I want a result similar to

< root >
< elem id = "1" >
< subElem id = "1" >
< / subElem >
< / elem >
< elem id = "2" >
< subElem id = "1" >
< / subElem >
< subElem id = "2" >
< / subElem >
< / elem >
< / root >

"So I can't access the second"sub"in the second /root/elem/@id="2"/sub/@id="2 item.

You have no way to put this attributes "Id" using XQuery or another way. I prefer a non programmatic method (that is, using Oracle, not Java).

I tried with the function this way InsertChildXML

Update xmlTable
Set insertChildXML = xmlField (xmlField, ' / root//*','@id','nothing');

It works, but how can I put the Id numbers for each element and each subitem?

Another way is to use XQuery, but now I get poor results.

Any help?

Thank you.

José Domingo Hernández

Published by: jdhernandez on Sep 2, 2009 08:28

Without knowing all the details of why you are trying to add an attribute id, beyond the 'easy access', why not just use an XPath like
/ root/elem [2] / subElem [2]
Instead of
/root/elem/@ID="2"/sub/@ID="2".

My Xpath using XML, said to get the second subElem in the second comp in the root node. This is in agreement with what your application, on the assumption that nothing reorganizes the XML during your treatment.

Tags: Database

Similar Questions

  • put the pc in french all programs

    put the pc in french

    Please select your language from the drop-down menu at the bottom of the page to post your question in the language of your choice. The forum in which you've posted is for English only. If you can't find the desired language, support for additional international sites options are by following the link below:

    Hello

    Please get your language in the drop-down list above pour post your question in the language of your choice. The forum you posted is in English only. If you can't find the language of your choice above, options of fees to pay to other international destinations can be found by following the link below:

    Thank you
    http://support.Microsoft.com/common/international.aspx

  • all the icons on the desktop are now all the same since I put the fake program to all *.ink files by default.

    desktop icons and the *.ink files are all set for an icon, even if in the designated program properties are correct. It is useless to try to change or restore the icon (in properties), because it does not react.

    How to get back to their originally assigned program icons?

    Hello

    . INK files are usually created on a Tablet PC

    Have you done something that their renamed? By the program files you mean DATA or the actual programs
    What should you run? Data files can be renamed to the correct extensions.

    How to associate a file Extension with a program Type in Vistahttp://www.vistax64.com/tutorials/69758-default-programs.html

    How to view and change an Extension of filename on Vista
    http://www.Vistax64.com/tutorials/103171-file-name-extension.html

    How Unassociate a Type of Extension file in Vista and a utility to help
    http://www.Vistax64.com/tutorials/91920-unassociate-file-extention-type.html

    Restore the Type Associations by default Vista file extensions
    http://www.Vistax64.com/tutorials/233243-default-file-type-associations-restore.html
    How to set default Associations for a program under Vista
    http://www.Vistax64.com/tutorials/83196-default-programs-program-default-associations.html

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • Extract all nodes and filter them based on the WHERE clause

    <?xml version="1.0" encoding="UTF-8"?>
    <report_repository_summary>
       <sql sql_id="gyn915ynqjspa" sql_exec_start="08/19/2015 22:23:02" sql_exec_id="16777217">
          <status>DONE</status>
          <sql_text>BEGIN DBMS_STATS.GATHER_FIXED_OBJECTS_STATS; END;</sql_text>
          <first_refresh_time>08/19/2015 22:23:10</first_refresh_time>
          <last_refresh_time>08/19/2015 22:24:52</last_refresh_time>
          <refresh_count>54</refresh_count>
          <inst_id>1</inst_id>
          <session_id>26</session_id>
          <session_serial>20363</session_serial>
          <user_id>0</user_id>
          <user>SYS</user>
          <con_id>3</con_id>
          <con_name>PDB01_1</con_name>
          <module>sqlplus@lab (TNS V1-V3)</module>
          <service>1_1.up.com</service>
          <program>sqlplus@lab (TNS V1-V3)</program>
          <plan_hash>0</plan_hash>
          <is_cross_instance>N</is_cross_instance>
          <stats type="monitor">
             <stat name="duration">110</stat>
             <stat name="elapsed_time">109822091</stat>
             <stat name="cpu_time">78295097</stat>
             <stat name="user_io_wait_time">1388002</stat>
             <stat name="application_wait_time">1228</stat>
             <stat name="concurrency_wait_time">9175702</stat>
             <stat name="cluster_wait_time">41691</stat>
             <stat name="plsql_exec_time">39369731</stat>
             <stat name="other_wait_time">20920371</stat>
             <stat name="buffer_gets">616087</stat>
             <stat name="read_reqs">837</stat>
             <stat name="read_bytes">22998016</stat>
          </stats>
       </sql>
    </report_repository_summary>
    
    
    

    With above document XML stored as varchar2 (4000) in 12.1.0.2.0, how can I retrieve and display the relevant information(sql_id,session_id,plan_hash,duration,read_bytes) based on the place where condition to filter on any node. For example.

    select * from (
    SELECT EXTRACT (xmltype.createxml (a.report_summary), '//stats/stat[2]/text()').getstringval () AS elap_time from dba_hist_reports a WHERE component_name = 'sqlmonitor'
    )
    where elap_time > 100000000
    /
    
    
    

    Here, I try to get sql_id, sql_exec_id, duration and other information stored in the xml document by applying the where on elapsed_time condition. But to do this, I must write the part EXTRACT for all nodes in the inline view which seems like very bad way of writing of XML query. Is there an easy way to get all the information of nodes so that I can freely apply node whatever, I want in the WHERE condition to filter the records? No better way to write the code then the code below?

    select     REPORT_ID,
               EXTRACT (xmltype(a.report_summary), '//sql/@sql_id')                                    "sql_id",
               EXTRACT (xmltype(a.report_summary), '//sql/@sql_exec_id')                               "sql_exec_id",
               EXTRACT (xmltype(a.report_summary), '//sql/@sql_id')                                    "sql_exec_start",
               EXTRACT (xmltype(a.report_summary), '//status/text()')                                  "status",
               EXTRACT (xmltype(a.report_summary), '//sql_text/text()')                                "sql_text",
               EXTRACT (xmltype(a.report_summary), '//first_refresh_time/text()')              "first_refresh_time",
               EXTRACT (xmltype(a.report_summary), '//last_refresh_time/text()')               "last_refresh_time",
               EXTRACT (xmltype(a.report_summary), '//refresh_count/text()')                   "refresh_count",
               EXTRACT (xmltype(a.report_summary), '//inst_id/text()')                                         "inst_id",
               EXTRACT (xmltype(a.report_summary), '//session_id/text()')                              "session_id",
               EXTRACT (xmltype(a.report_summary), '//session_serial/text()')                  "session_serial",
               EXTRACT (xmltype(a.report_summary), '//user_id/text()')                                         "user_id",
               EXTRACT (xmltype(a.report_summary), '//user/text()')                                    "user",
               EXTRACT (xmltype(a.report_summary), '//con_id/text()')                                  "con_id",
               EXTRACT (xmltype(a.report_summary), '//con_name/text()')                                "con_name",
               EXTRACT (xmltype(a.report_summary), '//module/text()')                                  "module",
               EXTRACT (xmltype(a.report_summary), '//service/text()')                                         "service",
               EXTRACT (xmltype(a.report_summary), '//program/text()')                                         "program",
               EXTRACT (xmltype(a.report_summary), '//plan_hash/text()')                               "plan_hash",
               EXTRACT (xmltype(a.report_summary), '//is_cross_instance/text()')               "is_cross_instance",
               EXTRACT (xmltype(a.report_summary), '//stat[1]/text()')                                 "duration",
               EXTRACT (xmltype(a.report_summary), '//stat[2]/text()')                                 "elapsed_time",
               EXTRACT (xmltype(a.report_summary), '//stat[3]/text()')                                 "cpu_time",
               EXTRACT (xmltype(a.report_summary), '//stat[4]/text()')                                 "user_io_wait_time",
               EXTRACT (xmltype(a.report_summary), '//stat[5]/text()')                                 "application_wait_time",
               EXTRACT (xmltype(a.report_summary), '//stat[6]/text()')                                 "concurrency_wait_time",
               EXTRACT (xmltype(a.report_summary), '//stat[7]/text()')                                 "cluster_wait_time",
               EXTRACT (xmltype(a.report_summary), '//stat[8]/text()')                                 "plsql_exec_time",
               EXTRACT (xmltype(a.report_summary), '//stat[9]/text()')                                 "other_wait_time",
               EXTRACT (xmltype(a.report_summary), '//stat[10]/text()')                                        "buffer_gets",
               EXTRACT (xmltype(a.report_summary), '//stat[11]/text()')                                        "read_reqs",
               EXTRACT (xmltype(a.report_summary), '//stat[12]/text()')                                        "read_bytes"
    from       DBA_HIST_REPORTS a
    

    Don't know why, but it pays just 1 or 0. Even in your case his statement just 0 or 1 for all X 2 columns table.

    I guess I do something wrong in declaring XPATH for X 2 table but not able to find what it is.

    It makes account 0 or 1 because path expressions are bad.

    "For example: ' @name ="duration"

    This is a Boolean expression, not a step of XPath and so gets evaluated as such, which gives 0/1 for false/true values.

    What you need, it is something like this:

    SELECT x1.*
    FROM dba_hist_reports t
       , xmltable('/report_repository_summary/sql'
           PASSING xmlparse(document t.report_summary)
           COLUMNS
             sql_id              varchar2(15) path '@sql_id'
           , sql_exec_start      varchar2(30) path '@sql_exec_start'
           , sql_exec_id         number       path '@sql_exec_id'
           , status              varchar2(10) path 'status'
           , stats_duration      number       path 'stats/stat[@name="duration"]'
           , stats_elapsed_time  number       path 'stats/stat[@name="elapsed_time"]'
           , stats_cpu_time      number       path 'stats/stat[@name="cpu_time"]'
         ) x1
    where sql_id = 'c1tb2666n5rfx'
    and sql_exec_id = 16777668
    
  • Automatic configuration - stop application tier services on all nodes?

    Hi all

    Our application R12 application tier is on several nodes. My question is when we run on application layer Metn autoconfig, made you must stop the services from the application layer on all nodes of the application level? or just stop the services on the node on the automatic configuration service.

    Thank you and best regards,

    Yes, stop the application on all nodes (level apps) services before you run the automatic configuration. Then run auto configuration on each node one by one.

    Concerning

    Arizuddin

  • How to put a common page for all users after loging on?

    Hi all
    "My dashboard" is now the default page after logon.
    I want to put a home page by default for all users. users can see the homepage after loging on.

    How to change the default dashboard "My dashboard" to the "Home page" for all users?

    Thank you
    Dan

    Hello

    Steps to follow:

    Tried to put the default dashboard for all users.
    1. creates a session init block
    "2 source of data used in select ' / shared/SH Test / _portal / Test1" double
    3. This value assigned to the variable of session CHEMINPORTAIL
    4. in presentation services > Administration > my account > default dashboard must be set to "default". Then only the dashboard specified in block init will appear otherwise my account will override the init block.
    5. save the changes to the RPD.
    5 disconnect and reconnect to see if it works well. It works perfectly fine.

    For more details, please see the document of CSG replication. But this is for all users.

    If the customer wishes to have a user/group basis homepage.
    1. they should have 2 separate tables.
    i. Group_path_tab with 2 columns. Group_id, portal_path
    Wise group path portal for all groups
    II. user map table group
    Group_id, groupname, user_id

    The user should be part of a group.

    2. then in the writing init bulk sql must be something like this

    Select A.portal_path in the Group_path_tab A, User_group_map B
    where = B.user_id: USER
    and B.Group_id = A.Group_id

    SO, based on the USER session variable, it will try to identify the group, and then the portal_path.
    Finally, set this value to the session CHEMINPORTAIL variable.

    Ref:
    http://total-bi.com/2011/01/OBIEE-11g-change-default-dashboard/
    Thank you!

  • How to read the value attribute and put inside?

    What happens if we want to read the attribute value? And want to put the data of runtime on the value of the attribute as

    < psoID ID = "user id" / >

    How to get the value of the ID as the user id. And how to put the run value on it?

    I can think about is that

    /psoID/@ID/value GOLD psoID/@ID/*[local-name () = 'value']

    And how to put the value inside ID ="? »

    Thank you

    Because we are dealing with a structure of type anyType you must use the functions of node (local name) in combination with predicates ([]) to read or write values (node) of the element:

    To read the value for example use the copy rule:




    This wil read:

    /processResponse/result/psoID/@ID

    on the message:





    You will see the value 'B '.

    To write, you use:




    Kind regards

    Melvin

  • I refreshed Firefox, now all my Add-ons disappeared and worst parameters associated with them are gone too. Where I could find to put the 'old'?

    At the suggestion of Firefox, I refreshed, now all my Add-ons disappeared and worst parameters associated with them are gone too. Where I could find to put the 'old'?

    When updating Firefox, it creates a folder on the desktop called "old Firefox data." According to Firefox, it's when my old settings were saved. The question to the community, it is where I can move some of these old settings (and what are those FireFPT) to restore my old settings. Time Machine using nothing else that place an old version of FireFox in my app folder.

    I have several clients and staff that need to be restored as soon as POSSIBLE.

    Thanks for any help you can offer.

    Scott

    The best recommendation I can do for your plugins is to visit:

    https://www.Mozilla.org/en-us/pluginCheck/

  • Remove the read-only attribute from all files in a folder

    How to remove the read-only attribute from all files in a folder. I tried to use the properties and used the attrib command, but all I see is when I right click on the folder, selecting Properties, it shows once again

    I followed the forums, but I'm really confused. Can someone help me with this. Thanks in advance

    I would like to start by finding which file is read-only again. This is probably a file as well as a miniature file desktop.ini.  An easy way to find it is to go to the details view, turn on the column heading "Attributes" and search for all files with the attribute value "R":

    In this example, the key of SB file is read-only:

  • When I put the window XP update to Windows 7 (Ultimate) will be my Convert programs for Windows 7? Or will I have to reinstall all the of them

    All title in Question says...

    When I put the window XP update to Windows 7 (Ultimate) will be my Convert programs for Windows 7? Or will I have to reinstall all the of them?

    You will need to reinstall all your programs compatible with Windows 7.  Please see the bulletin: upgrade from Windows XP to Windows 7

  • MS has put the "validation failed" popups on my laptop that wouldn't go away even if I followed all the steps possible to validate my software as a real. How can I go there my LT?

    MS has put the "validation failed" popups on my laptop that wouldn't go away even if I followed all the steps possible to validate my software as a real. How can I go there my LT?

    http://support.Microsoft.com/kb/921914

  • How can I put the Windows XP firewall in a port configuration 'allow all' and only block some ports?

    Without going into the details of why I need to do this, I'm putting the firewall of Windows XP in one allow all the configuration of ports and only refuse some ports I have in a list.

    I train this script via the command-line batch with the netsh firewall add portopening command.  From what I've read, if enabled the firewall denies all traffic and only allows ports with exceptions, so through batch scripts, I opened all the 65 000 + ports TCP and UDP, essentially with the firewall turned on but in a configuration of "allow all the»  I don't deny the 100 or so ports to my list that I want blocked after they are all open.

    This strategy seems to work, but the problem I waited and I now see is that svchost.exe takes 50% of my CPU time, have to deal with constantly these firewall rules.

    "From what I've seen on Windows XP, there is no way to have the firewall ON, and in a configuration of" allow all the "" because the XP firewall may not have defined port ranges, they must be defined one by one.  It looks like Windows Vista or 7 would be much easier because the firewall has got a re vamp of advanced features.

    Does anyone have a suggestion on how to realize this "allow all", deny some' strategy?  I know it's a strange use of the Windows Firewall, so let's please jump in front of a 'why would you do this incredibly stupid thing?"messages.

    Also, if it was the wrong forum (or website) to post on for this kind of question, I'd appreciate a recommendation of a more appropriate forum.

    Hello

    See the steps in the following article.

    How to manually open ports in Internet Connection Firewall in Windows XP?

    http://support.Microsoft.com/kb/308127

  • HP f2480 stopped putting ink on paper, otherwise all the other indications of the print job.

    HP Deskjet F2480 works very well for more than a year.  without any changes to the computer or printer, he simply stopped putting ink on paper, but all other printing features seems to work very well.  Put in the new print cartridge, without change.  Replaced by the old printer exactly the same that I had used before, with the same cartridge new and even tried a second cartridge, same problem.  Delected all the printer setup, then reinstalled, without change.  Makes cleaning of the computer, defragmentation, malware check, everything and of course restarted several times.  Yet once, deleted all the configuration of the printer and completely reinstalled from scratch.  Return the most recent printer with new print cartridges try several different, still nothing.  Cannot print an alignment page, just came out in white, except for a small red triangle.  Tried to test pages, nothing.  It sends the print job in the queue and returns to the printer, the printer feeds the paper and attepts to print, but nothing's going on the page.  Envoy of printing from a laptop computer in a network and the same problem.  double checked all cables.  I am at a loss what to try next.  It doesn't seem to be the material of the printer cartridges of ink, no drivers or software, no cable.

    I am betting that the contacts on the cartridge are not completely in contact with the cartridges or cartridges must be sent through the cleaning process. Following the link are two documents that should help you. The first document contains the steps to clean the contacts on the cartridge and the printer. The second contains the steps for the cartridge to be cleaned mechanically and fix the printing problem. If none of this solves the problem and you have already tried a different cartridge, you need to replace the printer.

    "Print the cartridge failed", "Cartridge problem" or "Incompatible cartridge" Message is displayed on the computer:
    http://goo.GL/kNnwP

    Troubleshooting print quality problems:
    http://goo.GL/6GCRE

  • I have UN-plugged my speakers and replaced by headphones. Noise if the headphoens is fine. I now want to put the spekares back in, but there is no sound at all

    original title: SOUND

    I have UN-plugged my speakers and replaced by headphones. Noise if the headphoens is fine. I now want to put the spekares back in, but there is no sound at all. Can anyone help?

    So they are pregnant Dell with standard 3.5 mm USB powered plug (* and even the green port plug in as shown in the picture)?

    Therefore, the USB plugged into the port in the back of the computer for power to the speakers?  Try a different USB port - just to see if the chosen one does not provide the necessary power.

    Make sure that the speakers are turned on and the volume is turned all the top (to the right).

    Make sure that the sound output is not cut on your computer (plug in the headphones to check what you mean by them.

    Plug the 3.5 mm of the speaker to the green port on the computer (see photo above.)

    If you don't hear sound... Unplug the plug 3.5 mm and touch something metal - static electricity?  The speakers become power at all?

  • BlackBerry Z10 well defined, I can't get the phone to ring and vibrate as the default value for all calls. I can put individual contacts, but I want to ring and vibrate for all.

    Although the value, I can not phone ring and vibrate as the default value for all calls. I can put individual to vibrate and ring contacts and it works but I want as the default for all incoming calls. Any help would be appreciated, thanks

    Sorry, I found the answer in the manual

    "Change your ringtone, sounds or alerts.

    GoTo settings\notifications to the bottom of the screen select application\phone

    You can activate vibrate out there, put the ringer default etc.

Maybe you are looking for