How can I recursively parse an xml using XQuery document?

I have an open and I have to using XQuery in Response.xml can transform someone give me an idea how to analyze recursive Xml using XQuery documents. Any help will be appreciated. Thanks in advance

Open

" < = xmlns:ns0 ns0:GlobalRoutePlanServiceGOPResponse ' http://www.example.org/input ">

< GlobalRoutePlanServiceResponse >

< response >

Buid_1 < Buid > < / Buid >

SalesOrderId_1 < SalesOrderId > < / SalesOrderId >

EODD_1 < EODD > < / EODD >

LODD_1 < LODD > < / LODD >

< legs >

< leg >

< level > 1 < / level >

< Resources > ShipMode_1 < / resources >

< FSBD > FSBD_1 < / FSBD >

FABD_1 < FABD > < / FABD >

< leg >

< leg >

< niv.2 > < / level >

< Resources > ShipMode_2 < / resources >

< FSBD > FSBD_1 < / FSBD >

FABD_1 < FABD > < / FABD >

< leg >

< leg >

< level > 3.1 < / level >

< resources > ShipMode_3.1 & amp; < / resources >

< FSBD > FSBD_1 < / FSBD >

FABD_1 < FABD > < / FABD >

< leg >

< leg >

< level > 4.1 < / level >

< Resources > ShipMode_4.1 < / resources >

< FSBD > FSBD_1 < / FSBD >

FABD_1 < FABD > < / FABD >

< leg > < / foot >

< / foot >

< / foot >

< / foot >

< leg >

< level > 3.2 < / level >

< Resources > ShipMode_3.2 < / resources >

< FSBD > FSBD_1 < / FSBD >

FABD_1 < FABD > < / FABD >

< leg >

< leg >

< level > 4.2 < / level >

< Resources > ShipMode_4.2 < / resources >

< FSBD > FSBD_1 < / FSBD >

FABD_1 < FABD > < / FABD >

< leg > < / foot >

< / foot >

< / foot >

< / foot >

< / foot >

< / foot >

< / foot >

< / foot >

< / legs >

< / answer >

< / GlobalRoutePlanServiceResponse >

< / ns0:GlobalRoutePlanServiceGOPResponse >

Response.Xml

" < = xmlns:ns0 ns0:InputParameters ' http://xmlns.Oracle.com/pcbpel/adapter/DB/SP/GOP_DB_FSL_Msg_Persist_SVC "> "

< ns0:P_LEG >

< ns0:P_LEG_ITEM >

< ns0:LEGS_LEVEL > 1 < / ns0:LEGS_LEVEL >

< ns0:SHIPMODE > ShipMode_1 < / ns0:SHIPMODE >

< / ns0:P_LEG_ITEM >

< ns0:P_LEG_ITEM >

< ns0:LEGS_LEVEL > 2 < / ns0:LEGS_LEVEL >

< ns0:SHIPMODE > ShipMode_2 < / ns0:SHIPMODE >

< / ns0:P_LEG_ITEM >

< ns0:P_LEG_ITEM >

< ns0:LEGS_LEVEL > 3.1 < / ns0:LEGS_LEVEL >

< ns0:SHIPMODE > ShipMode_3.1 < / ns0:SHIPMODE >

< / ns0:P_LEG_ITEM >

< ns0:P_LEG_ITEM >

< ns0:LEGS_LEVEL > 4.1 < / ns0:LEGS_LEVEL >

< ns0:SHIPMODE > ShipMode_4.1 < / ns0:SHIPMODE >

< / ns0:P_LEG_ITEM >

< ns0:P_LEG_ITEM >

< ns0:LEGS_LEVEL > 3.2 < / ns0:LEGS_LEVEL >

< ns0:SHIPMODE > ShipMode_3.2 < / ns0:SHIPMODE >

< / ns0:P_LEG_ITEM >

< ns0:P_LEG_ITEM >

< ns0:LEGS_LEVEL > 4.2 < / ns0:LEGS_LEVEL >

< ns0:SHIPMODE > ShipMode_4.2 < / ns0:SHIPMODE >

< / ns0:P_LEG_ITEM >

< / ns0:P_LEG >

< / ns0:InputParameters >

You can use recursive expressions function XQuery to browse down the tree (even if it's more than a job for XSLT), but in this case, it is probably easier to use a descendant axis:

declare namespace ns0 = "http://xmlns.oracle.com/pcbpel/adapter/db/sp/GOP_DB_FSL_Msg_Persist_SVC";

declare namespace ns1 = "http://www.example.org/INPUT";

{

for $i in $request / ns1:GlobalRoutePlanServiceGOPResponse / GlobalRoutePlanServiceResponse/response/legs / / leg

where exists($i/Level)

return

{$i} / level/text)

{$i} / ShipMode/text)

}

Output:

http://xmlns.Oracle.com/pcbpel/adapter/DB/SP/GOP_DB_FSL_Msg_Persist_SVC">

1

ShipMode_1

2

ShipMode_2

3.1

ShipMode_3.1 &

4.1

ShipMode_4.1

3.2

ShipMode_3.2

4.2

ShipMode_4.2

Tags: Oracle Development

Similar Questions

  • How can I get the original xml code to a webservice called...

    I use WL 10.3.

    I created a WebService using WSDL as a starting point. The Web service is running as it should, but now I want to go back to the original XML that was passed in.

    I tried to collect the data to a string using JAXB, but he complains that there is no notation for @XmlRootElement - so, who does not work.

    I also tried to access the original data by injecting the WebServiceContext, but this value is always zero (not sure why that doesn't work)...


    Is someone can you PLEASE tell me how can I get the original XML code?

    You can use managers to this end, for example,

    package server.handlers;
    
    import javax.xml.transform.Source;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.ws.LogicalMessage;
    import javax.xml.ws.handler.LogicalHandler;
    import javax.xml.ws.handler.LogicalMessageContext;
    import javax.xml.ws.handler.MessageContext;
    
    public class ServiceLogicalHandler implements LogicalHandler {
    
        public boolean handleMessage(LogicalMessageContext context) {
            Boolean direction = (Boolean) context.get(LogicalMessageContext.MESSAGE_OUTBOUND_PROPERTY);
            if (direction) {
                System.out.println("LOGICAL - DIRECTION IS OUTBOUND");
            } else {
                System.out.println("LOGICAL - DIRECTION IS INBOUND");
            }
            return true;
        }
    
        public boolean handleFault(LogicalMessageContext context) {
            Boolean direction = (Boolean) context.get(LogicalMessageContext.MESSAGE_OUTBOUND_PROPERTY);
            if (direction) {
                System.out.println("LOGICALFAULT - DIRECTION IS OUTBOUND");
    
                LogicalMessage message = context.getMessage();
                Source payload = message.getPayload();
                try {
                    Transformer transformer = TransformerFactory.newInstance().newTransformer();
                    transformer.transform(payload, new StreamResult(System.out));
                } catch (TransformerException ex) {
                    ex.printStackTrace();
                }
            } else {
                System.out.println("LOGICALFAULT - DIRECTION IS INBOUND");
            }
            return true;
        }
    
        public void close(MessageContext context) {
        }
    }
    

    More information on managers can be found here: http://www.javaworld.com/javaworld/jw-02-2007/jw-02-handler.html

  • How can I disable the newtab most used feature display sites. I want the new tab to open the page displayed in the newtab:url in the topic: function config

    How can I disable the newtab most used feature display sites. I want the new tab to open the page displayed in the newtab:url in the topic: function config

    41 of Firefox is no longer uses the browser.newtab.url setting in about: config because he was constantly attacked by malware. From 41 of Firefox, you need an add-on to change the new tab page.

    Here are a few options (I'm learning more all the time):

    • If you are already using the extension classic restaurateur theme: There is an option somewhere (!) in his dialogues of the parameters to select another page in the new tab.

    Setting up substitute again tab

    After installing this extension, you must use the Options page to set the new desired tab page (instead of use subject: config).

    Open the page modules using either:

    • CTRL + SHIFT + a (Mac: Cmd + shift + a)
    • "3-bar" menu button (or tools) > Add-ons

    In the left column, click Extensions. Then on the side right, find the new tab override and click the Options button. (See first screenshot attached).

    Depending on the size of your screen, you may need to scroll down to enter the address in the form. (See second screenshot attached). For example:

    • (Default) page thumbnails = > subject: newtab
    • Blank tab = > subject: empty
    • Built-in Firefox homepage = > topic: welcome
    • Any other page = > full URL of the page

    Then tab or click this form field and you can test using Ctrl + t.

    Success?

    Once you have set it as you wish, you can close the Add-ons page (or use the back button to return to the list of Extensions of this Options page).

  • I have 30 messages of my Web site users. How can I (1) Replay at ALL using an email. I can't reply to all allows me to respond to each person INDIVIDUALLY.

    I have 30 messages of my Web site users. How can I (1) Replay at ALL using an email. I can't answer all allows me to respond to each person INDIVIDUALLY, and (2) how can I get all the addresses of electronic mail from senders AFTER I FILTER my mails for a list of emails which can only from my site.

    I get tons of mail from my site, and I need an easier way to manage the workflow. each email open and copy the email address for 50 emails would be a lot of work. I just want 'select' all emails, do a right-click and enter all e-mail addresses from senders.

    And, as stated above... Send an email to all by a RESPONSE/option button.

    I found a solution. Updated my Thunderbird, and the app worked. I used v.11.

  • How can I save text that I use regularly in the emails to avoid having to retype it every time?

    How can I save text that I use regularly in the emails to avoid having to retype it every time?

    Try this add-on: https://addons.mozilla.org/en-US/thunderbird/addon/clippings/

    http://chrisramsden.vfast.co.UK/3_How_to_install_Add-ons_in_Thunderbird.html

  • guys, how can I stop backup during I use cellular data

    guys, how can I stop backup during I use cellular data

    iCloud backup requires a wi - fi connection. It does not backup when only cellular data are available. See: get help from backup of your device in iCloud - Apple Support

  • How can I reset my MacBook Pro using El Capitan 10.11.4 to factory settings?

    How can I reset my MacBook Pro using El Capitan 10.11.4 to factory settings?

    Factory settings? As in totally blank? What to do before you sell or give away your Mac - Apple Support

    If you keep the Mac, just look at step 6.

  • How can I allow all sites to use THE SESSION cookies?

    How can I allow all sites to use cookies for THE SESSION?

    Yes, Firefox keeps cookies allowed unless you use to remove the navigation, search and download history on Firefox to delete cookies.
    You can easily check that yourself.

  • How can I register my product without using the online process?

    How can I register my product without using the online process?

    He scored finally got.

  • How can I submit photographs when you use imessages

    Just bought a MacBook Pro of the retina and I try to send pictures and graphics in imessages. How can I submit photographs when you use imessages.

    On Mac in Photos app, select picture, and then click

    (top right)

    Select Messages, then select the recipient, and the text you want included.

  • How can I dob in a company using cracked MS software?

    How can I dob in a company using cracked MS software?

    See you soon!

    If you want people to report or company who use Microsoft Software crack, you might start:

    https://www.Microsoft.com/en-us/howtotell/CFR/report.aspx

    http://www.BSA.org/

  • How can I get the keyboard to use only English punctuation

    Laptop HP 2000-300 CA... How can I prevent the keyboard from using the punctuation french when I try to use the English apostrophe, or question marks is what I get when I try to type an exclamation mark E

    I have a Canadian keyboard that gives me some English and french of the characters. I went to the U.S. English keyboard, rebooted and it seems to work. I saw the site you provided however, and if my current solution does not last long... you can be sure to find me on your Web site. Thank you for taking the time to answer.

  • How can I get two jobs when using two monitors, instead of stretching a desktop on both screens?

    Hello!

    How can I get two jobs when using two monitors, instead of stretching a desktop on both screens? I n ' want to clone my office, and I don't want to stretch it. I want two desktop computers, where I can "send/give" to the other desktop programs.

    I need a third party program? It is very good. If you know one please tell me about it.

    Hi OskarKvist,

    This feature is not supported by Windows XP.

    However, you can use your favorite search engine to download any third-party software that could serve the purpose.

    Note: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    Hope the helps of information.

  • How can I get Snipping tools im using Vista and this control panel and then enable or disable the thing pc isn't here. Help?

    How can I get Snipping tools im using Vista and this control panel and then enable or disable the thing pc isn't here. Help?

    Hello

    You don't say which edition of Vista you are using.

    Vista Home Basic Edition does not have the "snipping tool".

    If you have a different edition of Vista, read the information on how to find it:

    http://www.PCWorld.com/article/137099/activate_vistas_snipping_tool.html

    If you have one version of Vista, other than the Home Basic edition, you already have the Snipping Tool screenshot utility: click on Start, all programs, accessories, Snipping Tool. If you do not see here, it cannot be activated. Go to the Control Panel and open programs and features (you may need to click programs first). In the left pane, click Windows turn features on or off. If necessary, click continue when you are prompted by user account control. Scroll down the list of features, check the box next to Tablet PC optional components, and click OK. Marketing of these features gives you not only the Snipping Tool, but also input panel Tablet PC, Windows Journal and other features related to the stylus.

    "Install or activate the cutting tool in Windows Vista"

    http://www.mydigitallife.info/install-or-enable-Snipping-Tool-in-Windows-Vista/

    See you soon.

  • How can I resize a digital image using software of photo gallery to keep my digital images to be cut during printing on standard paper by a commercial processor? MP

    How can I resize a digital image using software of photo gallery to keep my digital images to be cut during printing on standard paper by a commercial processor? MP

    How can I resize a digital image using software of photo gallery to keep my digital images to be cut during printing on standard paper by a commercial processor? MP

    ====================================
    Sometimes the only resizing is not the answer because the
    the original size is different from the print size.

    You may need to crop photos to the size you want
    print to ensure that no clipping will occur. Cropping
    to a different aspect ratio will lose some parts of the picture but
    at least you have control over it.

    Windows Live Photo Gallery is a cropping tool.

    Volunteer - MS - MVP - Digital Media Experience J - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

Maybe you are looking for

  • Satellite A200 - 13O - lose 3mm of the monitor

    Hello. I have an A200-13O and lately I saw something weird. There is a part of the lcd screen that appears to be unusable, is not only on Windows, but even when starting (when the toshiba logo appears). I'm referring to a black vertical space about 3

  • Re: RLC

    Hi friends, I designed the RLC circuit using labview. Everything works fine, but still I couldn't see any waveform in the graph XY. m kindly helps solve this problem. For your reference, I have attached my RLC vi. Please take a look and let me you if

  • Back button focus with the 6 d

    I can't get the focus of the "back" of my 6 d (AF-ON) button to work.  After you follow the instructions on the Canon Website on how to implement, the right button does nothing.  Auto focus works only with the shutter button.  I have the function set

  • In Windows XP, how can I find my public directory of files/folders

    I have WIN XP and I need a tutorial step by step on how to share a file with another user on the same PC Thank you

  • 4500 HP Envy printer: How to print in black only

    This printer has the ability to print in black only? Can not find the color control.