How can I extract value based on the specific tag?

Hello,
I have a sample xml file:
<?xml version="1.0" encoding="UTF-8"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://local.google.com/local_feed.xsd">
<language>en</language>
<datum>WGS84</datum>
<listing>
<id>242238</id>
<name>Baskin-Robbins</name>
<date month="5" day="13" year="2010" />
<content>
<text type="menu">
<link>http://www.allmenus.com/ca/san-fernando-valley/242238-baskin-robbins/menu/</link>
<title>Baskin-Robbins</title>
<author>Allmenus.com</author>
<body>View this menu online at Allmenus.com</body>
</text>
<attributes>
<link>http://www.allmenus.com/ca/san-fernando-valley/242238-baskin-robbins/menu/</link>
<title>Baskin-Robbins</title>
<attr name="Average Entree">$41.95</attr>
<attr name="Cuisine">Ice Cream</attr>
<attr name="Cuisine">American</attr>
<attr name="Payment accepted">Cash</attr>
<attr name="Feature">Cheap Eats</attr>
<attr name="Feature">Kid Friendly</attr>
<attr name="Feature">Fast Food</attr>
<date month="5" day="13" year="2010" />
</attributes>
</content>
</listing>
<listing>
<id>243810</id>
<name>Villa Maria Pizzeria &amp; Restaurant</name>
<date month="5" day="13" year="2010" />
<content>
<text type="menu">
<link>http://www.allmenus.com/ny/nassau-county/243810-villa-maria-pizzeria--restaurant/menu/</link>
<title>Villa Maria Pizzeria &amp; Restaurant</title>
<author>Allmenus.com</author>
<body>View this menu online at Allmenus.com</body>
</text>
<attributes>
<link>http://www.allmenus.com/ny/nassau-county/243810-villa-maria-pizzeria--restaurant/menu/</link>
<title>Villa Maria Pizzeria &amp; Restaurant</title>
<attr name="Hours">Sun 12pm-9pm; Mon 11am-10pm; Tue 11am-10pm; Wed 11am-10pm; Thu 11am-10pm; Fri 11am-10pm; Sat 11am-10pm</attr>
<attr name="Last Delivery">Sun 9pm; Mon 10pm; Tue 10pm; Wed 10pm; Thu 10pm; Fri 10pm; Sat 10pm</attr>
<attr name="Order Online">http://orders.allmenus.com/restaurant.asp?restid=5999&amp;campusid=835</attr>
<attr name="Average Entree">$7.95</attr>
<attr name="Minimum for Delivery">$25.00</attr>
<attr name="Cuisine">Pizza</attr>
<attr name="Cuisine">Sandwiches</attr>
<attr name="Cuisine">Calzones</attr>
<attr name="Payment accepted">Cash</attr>
<attr name="Payment accepted">Visa</attr>
<attr name="Payment accepted">Mastercard</attr>
<attr name="Payment accepted">Discover</attr>
<attr name="Payment accepted">Amex</attr>
<attr name="Nearby School">Hofstra University</attr>
<attr name="Nearby School">SUNY-Farmingdale</attr>
<attr name="Feature">Free Delivery</attr>
<attr name="Feature">Open 7 Days</attr>
<attr name="Online Order">Yes</attr>
<date month="5" day="13" year="2010" />
</attributes>
</content>
</listing>
</listings>
As you can see, some row has <attr name="Order Online"> and some don't. I want to extract value of this attribute. It can be null for rows that don't have this attribute. How can I do it with extractvalue function? THANKS A LOT!

I figured it out that I should do the following:
select extractvalue(value(x),'/listing/content/attributes/attr[@name="Order Online"]')
from load_xml_file t, table(xmlsequence(extract(t.xml,'/listings/listing'))) x
Thanks!

Similar Messages

  • How can I extract page with showing the e-sign signatures?

    How can I extract page with showing the e-sign signatures? When I extract pages, the e-sign signatures are all disappear.  Or can I save the documents without verify the signatures?  When I open the documents, it need verify the signatures and then open it now.

    Hi Ada,
    The thing you have to realize is when using Acrobat or Reader to create a digital signature you are signing the whole document (all of the bytes in the document). You are not signing just the page where the signature appearance resides.
    Another thing to realize is the signature appearance (what you see on the page in the signature field) is not the signature itself. The signature proper is a block of hex encoded bytes written into the PDF file and not something you see (unless you open the file in a text editor). What you see on the page is just a graphical representation of the actual signature, but it's not the actual signature.
    When you extract a page (even if it had the signature appearance on it) it is just a sub-set of the signed bytes, and if the signature were to be extracted as well it would be invalid because the bytes in the extracted file would not match the bytes in the signature. Because the signature in the extracted document would always be invalid we just remove it.
    Steve

  • How can I pass value based on member names in a script in 11.1.1.3

    I want to pass a value to only those members of CostCenter dimension which has "5" in their name.
    Eg.
    C12345100
    C34565210
    C34217890
    So in the above case the value should exist only in the above 2 cost centers.
    Can someone guide me in the right direction to accomplish this ?
    Thanks in advance

    Just now I got more clearance on the requirement.
    I want to create blocks only on the selected Cost Centers & Business Unit combination.
    I have the following members in both these dimensions
    Cost Centers
    C12345980
    C12345981
    C12345982
    Business Unit
    BU5980
    BU5981
    BU5555
    Now I want to pass a value to one of the dense dimension members from Measure dimension (member name = CrtBlk) to only those CCs & BUs where the last 4 digit matches.
    So in this case it will be for only the first 2 cost centers.
    Thanks in advance.

  • How can we delete value fields from the Table T237A?

    Dear All,
    We need to delete some value fields in CO-PA. We got a message that these value fileds are being used in the Table T237A.
    This table is related to key figure scheme.
    We have deleted in t.c. sm31 in the table/view  V_RS_T237A elements which were assigned to value fields to be deleted.
    But we still have a message value fields are being used. And after some searches we found out they are still being used in the table T237A.
    COuld you please, help us?
    Thank you in advance!
    Best regards,
    Kamila.

    Change the Table Control attributes such that user can only select a single record(row).
    <u>Tip to delete a selected record</u>
    1) write a module 'Mark' in the PAI as below
    PROCESS AFTER INPUT.
    MODULE cancel AT EXIT-COMMAND.
    LOOP WITH CONTROL table_view.
    MODULE read_table_control.
    FIELD flag MODULE mark ON INPUT.
    ENDLOOP.
    MODULE user_command_0100.
    2) Module Mark is below.
    MODULE mark INPUT.
    CHECK flag = 'X'.
    x = table_view-top_line + sy-stepl - 1.
    Delete itab INDEX x.
    ENDMODULE. " mark INPUT
    Table_view is the TableControl Name.
    'flag' is of type char(1) available in the Internal table which was assigned to the select option in the table control.
    <u>award if uesful</u>
    Regards,
    Sudheer

  • How can I rename files based on their ID3 tags?

    For example I would like to rename the files in a particular folder to have the format <track number> - <track name>.mp3
    I'd rather not used third party software to do this.

    For example I would like to rename the files in a particular folder to have the format <track number> - <track name>.mp3
    I'd rather not used third party software to do this.

  • How can I extract pictures from a backup

    I update an iPhone 4 to iOS 7 and it's 16gb The iPhone that was completely out dated running iOS 4 so I updated it and backed it up but now iOS 7 takes up more of the storage and now I can't restore the backup but it's only the pictures this guy wants for his iPhone so how can I extract them?

    Restore the device using the backup.  Backups are only designed for use in restoring a device.
    If used as designed, pictures would have regularly been copied off the device to the computer for safe keeping.

  • How can I extract Java source from Oracle?

    I have an object of type "JAVA SOURCE" in my database. I do not have the source
    code available.
    How can I extract this source from the database so I can read it? I am not a Java programmer, so a sql or pl/sql solution would be greatly appreciated.
    Thanks in advance!

    This query lists any Java object that the current database user has (JAVA SOURCE, JAVA CLASS or JAVA RESOURCE). Use this to determine which Java sources exist.
    SELECT * FROM USER_OBJECTS
    WHERE OBJECT_TYPE LIKE 'JAVA%'This query lists the source of one Java object.
    SELECT * FROM USER_SOURCE
    WHERE TYPE = 'JAVA SOURCE'
    AND NAME = 'com/acme/HelloWorld'Substitue the name of the java class you're interested in for 'com/acme/HelloWorld'.
    I know that the question is four years old, but I had the same question and arrived here via Google, so I figured posting an answer might help others in a similar situation.

  • How can I extract the results of my squence?

    Hello, I'm a beginer of test Stand.
    I've created a main squence with LabView & TestStand, and works well, when it finish TestStand automatically creates my report. I need to extract these results of my sequence in order to create a custom document automatically, creating an action with LabView that works with these results, without any action of an operator.
    How can I extract these results? Thanks you very much.

    Hello,
    you've got several options here, although it seems you might want to go with the first option:
    1) After running your sequence, you'll find all the results needed for creating a report on the variable Locals.ResultList, which is an array of objects (of the Result type). You can pass this array to external code for it to use the information (i.e. create a report)
    2) You can override the report generation callback on your process model (Test Report callback)and create your own LabVIEW-based report generation sequence/routine
    3) You can modify the report generation sequences on the process model to suit your needs (always make backup copies and place your modifications on the /Components/User folder !)
    I would also recommend you to assist National Instruments Training Courses, as these things can be seen in detail and provide you a better understanding of all the options TestStand has.
    Regards,
    Jorge M.Mensaje editado por Jorge M.

  • How can I extract a km-iView out the portal to redefine it?

    Hello folks,
    I want to redefine the com.sap.km.cm.navigation-iView to serve generic access to the users home drive by using the <User.UserID>-variable. Therefore I have to extract/download the iView out of the Portal. I wasn't able to find KM-Content in Systemadministration->Support->Portal Runtime->Browse Deployment. What do I have to do?
    How can I extract a km-iView out the portal to redefine it?
    Regards
    Steffen

    Just as an example:
    package com.btexx.proxy;
    import com.sapportals.portal.prt.component.*;
    import com.sapportals.portal.prt.pom.IEvent;
    import com.sapportals.wcm.repository.ResourceException;
    import com.sapportals.wcm.repository.ResourceFactory;
    import com.sapportals.wcm.service.IServiceTypesConst;
    import com.sapportals.wcm.service.urlgenerator.IURLGenerator;
    public class Example extends AbstractPortalComponent
         protected void doOnNodeReady(IPortalComponentRequest request, IEvent event){
              String uname = request.getUser().getLogonUid();
              String path = "/userhome/"+uname;
              String rndLayoutSet = "ConsumerExplorer";
              String explorerServletPath = "/irj/servlet/prt/portal/prtroot/com.sap.km.cm.navigation";
                   try {
                        IURLGenerator ug = (IURLGenerator) ResourceFactory.getInstance().getServiceFactory().getService(IServiceTypesConst.URLGENERATOR_SERVICE);
                        explorerServletPath = ug.getExplorerServletPath();
                   } catch (ResourceException e) {
              request.redirect(explorerServletPath+path+"?rndLayoutSet="+rndLayoutSet);
        public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
    + portalapp.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <application>
      <application-config>
        <property name="SharingReference" value="usermanagement, knowledgemanagement"/>
      </application-config>
         <components>
              <component name="Example">
         <component-config>
              <property name="ClassName" value="com.btexx.proxy.Example"/>
              </component-config>
                   <component-profile>
                        <property name="com.sap.portal.reserved.iview.Redirect" value= "true"/>
                   </component-profile>
              </component>
         </components>
    <services/>
    </application>
    all the best,
    dimitry

  • How can i extract using while the time from the string ?

    First time how can i extract the time as string ?
    And second how can i extract the time as DateTime.Now ?
    public static void ExtractDateTime()
    htmltoextract = new Uri("http://test.com");
    client = new WebClient();
    f = client.DownloadString(htmltoextract);
    client.Dispose();
    int index = 0;
    while (index != -1)
    int t = f.IndexOf(firstTag);
    int g = f.IndexOf(lastTag);
    a = f.Substring(t + firstTag.Length, g - t - 8);
    The string look like this: thisisateststring201309202145andthenextimeinthestringis201309202130andthelastofthisexampletimeinthisstringis201309202115
    What i need to do is first time to extract the time as string to a List<string> like this:
    index 0 201309202145
    index 1 201309202130
    index 2 201309202115
    The second time to extract the times as this time format: YYYYMMDDhhmm and also to add the times to a List.
    First time and second time i mean first example and second example. To use my code but first time to extract it as strings second example as the format of YYYYMMDDhhmm
    And i need to use the while and indexof and substring in this cases.

    Is the region always going to be "eu" or are you going to have more than one region.  Since you are reading a string DateTime from different timezone than the computer you are reading the data you have to convert to a different timezone. 
    It looks like you have at least 'is' and 'eu' for regions.  I don't know what offsets you need so try something like this.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Text.RegularExpressions;
    using System.Globalization;
    using System.IO;
    namespace ConsoleApplication1
    class Program
    static void Main(string[] args)
    string input = File.ReadAllText(@"c:\temp\test.txt");
    string pattern1 = @"imageUrls = \[[^\]]*\]";
    Regex ex1 = new Regex(pattern1, RegexOptions.Singleline);
    string pattern2 = @"region=(?'region'[^&]*)&time=(?'time'\d{12})";
    Match match1 = ex1.Match(input);
    Regex ex2 = new Regex(pattern2, RegexOptions.Singleline);
    MatchCollection matches2 = ex2.Matches(match1.Value);
    IFormatProvider provider = CultureInfo.InvariantCulture;
    List<DateTime> dateTime = new List<DateTime>();
    foreach (Match match2 in matches2)
    string region = match2.Groups["region"].Value;
    DateTime dt = DateTime.ParseExact(match2.Groups["time"].Value, "yyyyMMddHHmm", provider);
    switch (region)
    case "eu" :
    dt.AddHours(1);
    break;
    case "is":
    dt.AddHours(-1);
    break;
    dateTime.Add(dt);

  • How can I extract only the audio as an aiff file?

    Using a Sony DSC-N2 Cybershot Camera I recorded video that was saved as “MOV01606.MPG”. The video plays back with sound in Quicktime Pro and iTunes but how can I extract only the audio as an aiff file?

    Use MPEG Streamclip (free) to convert your .mpg files to QuickTime formats.
    QuickTime can't extract audio from muxed file formats.

  • My Iphone was sync with Itunes on a computer then this computer broke down and i purchased another one. I was able to extract all the data from the old one. now how can i sync my phone with the new tunes without loosing any data?

    My Iphone was sync with Itunes on a computer then this computer broke down and i purchased another one. I was able to extract all the data from the old one. now how can i sync my phone with the new tunes without loosing any data?

    Yes, windows to Mac too.
    iTunes: How to move [or copy] your music [library] to a new computer [or another drive] - http://support.apple.com/kb/HT4527
    Quick answer if you use iTunes' default preferences settings:  Copy the entire iTunes folder (and in doing so all its subfolders and files) intact to the other drive.  Open iTunes and immediately hold down the Option (alt) key (shift on Windows), then guide it to the new location of the library.
    Windows users see tip at: https://discussions.apple.com/message/18879381

  • How can I start a loop before the DAQ Assistand outputs a value?

    Hi everybody,
    I created a VI (See attachment) to Measure the speed of a turning wheel. (A optical detector outputs pulses which are proportional to the speed) The DAQ Assistant measures the frequency and the values are written to a log file. To log every 100 ms the value into the table, there is a while loop with should be executet 10 times a second.
    The first question:
    I want to start measurement as soon as I press "RUN". In fact, my VI first begins to run and log data when the wheel turns and the frequency is not "0". But I want to log data too, if the speed is "0". How can I programm that in Labview?
    The second problem:
    Labview writes not continuely the values: Sometimes 7 values a second, sometimes 11 values.... (I can see that because i log the time too). But if the programm runs for some seconds its getting better and better.
    How can I force Labview to run the loop exactly tacted? Is my Computer too slow? Or is my method to log continuely data simply wrong? I am relative new in Labview and would be thankful in getting help.
    Markus
    Attachments:
    Measure Frequency and Log data.vi ‏63 KB

    I would say right off hand from what you describe that the issue is not related to computer speed, but choice of operating system. Windows is not a deterministic operating system - this means you can't count on how long it will take to do anything.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How can I extract the two channels from a stereo track?

    Hi,
    I am writing a class that is able to draw an audio signal. It seems to be working well but I have a question. If I load a mono audio file I am able to draw it on a graph by using the byte[] array and everything is ok until now. That's the code:
    void Draw(byte[] x)
                Graphics g=getGraphics();
                Graphics2D g2=(Graphics2D)g;
                g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,                     RenderingHints.VALUE_ANTIALIAS_ON);
                for(int i=0; i<x.length-6; i++)
                    g2.draw(new Line2D.Float(((i*(getWidth()-6))/x.length)+5, (getHeight()/2)-          ((x*(getWidth()-6))/x.length), (((i+1)*(getWidth()-6))/x.length)+5, (getHeight()/2)-     ((x[i+1]*(getWidth()-6))/x.length)));
    The results is correct only if I have a mono track. Obviously when I get a stereo track the array becomes very large so here the question. How can I extract the two audio channels from a stereo track?
    Thanks in advance.
    Maurizio Di Vitto                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    A mono audio stream is stored [sample, sample, sample, sample], so just a list of samples in an array.
    A stereo sample is interleaved in the same manner, so you get [left-sample, right-sample, left-sample, right-sample]
    So every nth sample is the 1st channel, every nth+1 is the 2nd channel...

  • How can I extract the data from Xstring .

    Hi Gurus ,
    How can I extract the data from a XSTRING  .
    I have to get the data which is filled in the survey form the data is getting saved in form of xstring .
    Someone told me that there is a standard FM for that . but I am not able to find .
    Please reply with the FM in case some one knows about it .
    Thanks in advance .

    The following code works as of 7.0 (in any SAP system):
    FORM XSTRING_TO_STRING USING input TYPE xstring CHANGING output TYPE string.
    TYPES : BEGIN OF ty_struc,
              line TYPE c LENGTH 100,
            END OF ty_struc.
    DATA lt_char TYPE TABLE OF ty_struc.
    DATA length TYPE i.
    length = xstrlen( input ) / cl_abap_char_utilities=>charsize.
    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer                = input
      tables
        binary_tab            = lt_char.
    CONCATENATE LINES OF lt_char INTO output RESPECTING BLANKS.
    output = output(length).
    ENDFORM.
    Edited by: Sandra Rossi on Mar 30, 2010 12:24 AM

Maybe you are looking for

  • How can I file a complaint about customer service and billing

    I Changed from AT&T as they didn't offer service where I now reside and ever since March of 2014 it takes about two to three calls to get my billing corrected. And then they have me on the phone for about two hours about the same issue. They have cor

  • Upload data eCATT in ECC6 vs 4.7

    HI There, I uploaded MM data in ECC6 before by using CATT (record scripts and load in configuration) but yesterday I was using someone's 4.7 IDES and surprisingly stuck. Scenario: In Ecc6 After recording script, creat test configuration and on varian

  • Airport extreme, express,and iTunes

    I have a 1.33ghz iBook, an airport extreme base station and an airport express that I have configured to use to play itunes through my stereo at home. when I jack my ibook directly into the stereo ituns works flawlessly, but when I play itunes wirele

  • Solution Directory Graphic Displays as XML

    We are runing Solution Manager 4.0. If I perform the following actions... - Run transaction SOLUTION_MANAGER. - Select "Goto Solution Directory" (pencil icon) for a solution. - Expand the solution structure by clicking on the solution name. - Select

  • Flash Builder 4 Start Page links open third party app

    Hey guys, Im having a bit of an inconvenience. Clicking on any of the links on the Start Page for FB4 opens another app, and I have no idea what to do in order to fix it. Can anyone help?