Choice between xquery and parsing methods

I want to read from an xml source file. I have been working with parse techniques (JAXP )and Marshal/Unmarshal techniques(JAXB).
Recently i came to know that we can query an xml document using xquery and
xpath methods.
Is the second method advantageous than the first one in terms of time and memory constraints ?

Yes, xquery and xpath are always easy to work than parsing on your own.
It provides already written methods for u, which u need not to write on your own to fetch the data.
Hope this will help u.
......yogesh

Similar Messages

  • Name space conflict between static and instance method

    Hello,
    there seems to be a very unfortunate name space conflict between static and instance method name. Consider:
    static String description() that should return a description of a class.
    String description() that should return a description of an instance.
    That seems to confuse the compiler. How come? Static and instance methods don't have anything to get confused about.
    Thanks for any insights :-)

    Umm...jeez.
    It's not a bug, it's the way it's supposed to be.
    Since a static method can be called the same way an instance method
    A instance = new A();
    A.staticMethod();
    instance.staticMethod();it's not allowed.
    Also in the class, you can call
    public void myMethod() {
          instanceMethodInClass();        // You don't need this, it's superfluous
          staticMethodInClass();          // You don't need the class name.
    }If you didn't understand, then just accept the fact that it is so. Some day you'll understand it.

  • What's the difference between equals() and compareTo() method

    I'm confused between the two method from String class ,,, what's the main difference between equals() and compareTo() method?

    API docs give quite clear information IMHO
    public boolean equals(Object anObject)
    Compares this string to the specified object. The result is true if and only if the argument is not null and is
    a String object that represents the same sequence of characters as this object.
    public int compareTo(String anotherString)
    Compares two strings lexicographically. ....
    The result is a negative integer if this String object lexicographically precedes the argument string. The
    result is a positive integer if this String object lexicographically follows the argument string. The result is
    zero if the strings are equal; compareTo returns 0 exactly when the equals(Object) method would return
    true. Mike

  • Making choice between socket and RMI

    I never use RMI, but i am familiar to socket programming. i want to write an online game, I know that use RMI will easy than use socket, could anyone tell me what factors will affect the choice between using socket and RMI if don't consider which one i am familiar ?
    thanks
    jacky

    I would consider the amount of traffic your online game is going to be generating. Obviously, if the traffic is the bottleneck, you will want to optimize it as much as possible.
    I can see that if you are familiar with sockets and socket programming, where this is very appealing because after all, you can't get much faster than raw sockets. Also, the Java APIs around sockets are much easier than the equivalent BSD Socket C/C++ libraries.
    Still, RMI has much more to offer.
    o It is relatively easy to set up a connection
    o exceptions will be thrown when problems occur
    o serializing classes is so easy it's laughable
    o If performance becomes an issue, you can (as the previous poster suggests) create your own custom socket factory which optimizes the used bandwidth. Options here include compression if you have the CPU cycles to spare.
    o There are mechanisms in place for working RMI over firewalls
    Many of the things that RMI offers, you might find yourself re-writing in your own socket-based API. Personally, I would choose RMI.

  • SimpeDateFormat and parse method

    hi Friends,
    i am using the sdf.parse(string) method,if the user enters a 2-digit year,the parser throws no exception but my database do
    as it understands only a 4 digit year,how to cope up with this...how to tell the parser to reconize only 4-digit year.

    hi Friends,
    i am using the sdf.parse(string) method,if the user
    enters a 2-digit year,the parser throws no exception
    but my database do
    as it understands only a 4 digit year,how to cope up
    with this...how to tell the parser to reconize only
    4-digit year.Your database shouldn't know or care how many digits the year has. Use PreparedStatement's ? parameters and its setDate, setTime, or setTimestamp method to pass the date to the DB. DON'T try to pass it a string.
    If you must pass it a string, then you can use DateFormat's format() method to spit out a four-digit year.
    But don't do that. Use PreparedStatement.

  • OS should allow choice between "deep" and "light" sleep (battery life)

    It's clear that Apple needs to fix the OS for the ipod touch so that the user can choose between one of two sleep modes. A "deep" sleep mode would be similar to sleep in pre- OS 4.1: WIFI would be automatically turned off to preserve battery. A "light" sleep mode would be similar to the sleep mode in the current OS 4.1 and would not shut WIFI off (but thereby quickly draining the battery).

    you might want to let Apple know via _*iPod Touch Feedback*_.
    JGG

  • Choice between T540p and T440p

    Hello all,
    I am new in this forum, so I am very excited to start.
    I am planning to buy either the T440p or T540p and I need to consult with you guys in order to make a good choice
    My needs are for a lightweight business laptop which features very good display/keyboard, has a very good battery performence and has a good three years international guarenty. Also, the price matters to me very much.
    Unfortunately, the the T440p is not offered with such warenty - only 1 year, and no IPS displat. However, other specs are what I need. The T540p has the 3 year warenty but is much havier and its batery will not last as the T440p.
    When I looked at the Lenovo site the picture becomes more complecated. The T440p is much more expensive compared to the T540p - more than $1,000 compared to $649, with more or less the same specs.
    So what should I do? I would pay the extra money for the T440p if it had the same warenty, but it is not available in Lenovo website. Just imagining carrying a 5.5lbs piece of mettal compared to the 4.7lbs' T440p (which is not a feather by itself) gives me an instant backpain...
    Thanks again,
    Uzi

    I'm not sure if either the T440p or the T540p is really considered lightweight. Maybe the T440s? Or X240s?
    W520: i7-2720QM, Q2000M at 1080/688/1376, 21GB RAM, 500GB + 750GB HDD, FHD screen
    X61T: L7500, 3GB RAM, 500GB HDD, XGA screen, Ultrabase
    Y3P: 5Y70, 8GB RAM, 256GB SSD, QHD+ screen

  • Choice Between IDOC and ABAP Proxy

    Hello All,
    We are building a Bi Directional Interface for Business partners between a third Party ERP, XI and SAP CRM.
    We are looking for some advise on the best way to go forward between the two options below:
    a) Do an ABAP Proxy Call on Fn Module CRMXIF_PARTNER_SAVE  from XI
    b) Create and IDOC in CRM
       ( Message Type CRMXIF_PARTNER_SAVE_M )
    Not being an XI consultant, my understanding is as follows
    Option A  : Gives me the flexibility to format my response in the manner we like. But this is a synchronous call. Also this is a generated RFC. So changes in the XIF layer of CRM could be an issue.
    Option B : Response can be achieved only through the ALE Audit Functionality, which has a predefined message structure. For Eg: If I wanted to send the response in the same format as the incoming message with an added segment for the error, this is not possible. Ofcourse, I get all the functionalities of monitoring and Handling IDOCs in this option.
    Any thoughts on the advantages and disadvantages of each option would be greatly appreciated.
    Thanks
    Anoop

    Anoop,
    I probably should have mentioned in the BLOG, that IDOC is good if its a standard IDOC, so that you don't have under go the pain doing the modifications for the custom one.
    In your case, PROXY might make more sense as you are saying that you have to do some custom processing as well. So, you can call the BAPI / Function for the standard processing and then do the custom processing in your Proxy code. And more over, if you have want to have a Synch interface, then you cannot use IDOC.
    So, the options in this case boil down to PROXY / RFC.
    PROXY will definitely have the advantage as its going to bypass the adapter engine and directly interact with the Integration server. And moreover, even if you already have a RFC, you can always call that inside your PROXY. However, the only flip side here compared to IDOC, is that you will have to create all your IR objects manually.
    Hope this helps you in making your decision.
    regards,
    Ravi
    Note : Please mark the helpful answers.

  • Choice between 8520 and 9300

    Hi, I'm in a bit of a dilemma, I would like to buy a BB but dont know which model to take, either the 9300 or the 8520. I have read through the differences between the 2 handsets and more or less the 9300 is better on paper.
    The provider is offering me the BB 9300 for 190 pounds (I'm just converting this into pounds) MORE than the 8520.
    My question is that,  is the 9300 a 190 pounds more better than the 8520?
    Thank you

    Hi and welcome
    Good thinking to check first. Thanks for converting into £ but this is multi-national so no need. Now as you have done I will explain about here in the UK.
    I'm guessing you are in the US and it seems to me you guys pay a fortune for devices and still have to buy carrier time.
    In the UK, at present, if you sign up for an 18 month carrier contract which will cost around £10 per month inc 500Mb data you get the 8520 FREE, nada, zip. And you get 12 months carrier warranty on the device as well. Maybe there are similar deals around you?
    The 8520 does not have GPS functionality and this makes it cumbersome for applications that rely on location settings such as FB Places and many others.
    The 8520 is unlikely to receive the latest software  - OS 6 due to limitations of the memory/processor. OS 6 is available for the 9300 and will probably come pre-loaded. There's nothing wrong with OS 5 but it cannot be upgraded on the 8520.
    Whichever you choose, make sure you have a data plan; without data you seriously limit the functionality of any BB and don't worry about extra data costs unless you have no Wi-Fi at home and want to be downloading music/video constantly. Last month, I used 2.6Mb of my 500Mb allowance.
    Good luck and hope to see you on here regularly.
    Blackberry Best Advice - Back-up weekly
    If I have helped you please check the "Kudos" star on the right >>>>

  • Choice between BI and CRM/SRM-Technofunctional.

    Hi all,
    Please tell me marketwise and onsitewise which one is better between Netweaver-BI
    and
    CRM/SRM functional-ABAP  (i.e. technofunctional with higher modules)as i am an ABAPer .
    Thanks.

    llll

  • Design choice between ArrayList and LinkedList

    Can someone clarify me which is better suited (efficient) for use?
    It appears to me that both can be used very much interchangeably at least from functionality point of view. :(

    Using the following code (and I'm sure someone will come nitpicking about it) I get the (expected, at least by me from prior experience) result that iteration over a LinkedList is about twice as fast as iteration over an ArrayList, but lookup operations on an ArrayList are substantially faster:
    package jtw.test;
    import java.util.*;
    public class SpeedTest {
        public static void main(String... args) throws Exception {
            List<Integer> linked = new LinkedList<Integer>();
            List<Integer> arr = new ArrayList<Integer>();
            for (int i = 0; i < 1e3; i++) {
                linked.add(i);
                arr.add(i);
            long r = 0;
            Date startLinked = new Date();
            for (int i = 0; i < 1e3; i++) {
                for (Integer q: linked) {
                     r += q;
            Date stopLinked = new Date();
            System.out.println("Total: " + r);
            r = 0;
            Date startArr = new Date();
            for (int i = 0; i < 1e3; i++) {
                for (Integer q: arr) {
                     r += q;
            Date stopArr = new Date();
            System.out.println("Total: " + r);
            System.out.println("LinkedList iteration: " + startLinked + " to " + stopLinked + " took " + (stopLinked.getTime() - startLinked.getTime()));
            System.out.println(" ArrayList iteration: " + startArr + " to " + stopArr + " took " + (stopArr.getTime() - startArr.getTime()));
             r = 0;
            startLinked = new Date();
            for (int i = 0; i < 1e3; i++) {
                for (int j = 999; j >= 0; j--) {
                     r += linked.get(j);
            stopLinked = new Date();
            System.out.println("Total: " + r);
            r = 0;
            startArr = new Date();
            for (int i = 0; i < 1e3; i++) {
                for (int j = 999; j >= 0; j--) {
                     r += arr.get(j);
            stopArr = new Date();
            System.out.println("Total: " + r);
            System.out.println("LinkedList lookup: " + startLinked + " to " + stopLinked + " took " + (stopLinked.getTime() - startLinked.getTime()));
            System.out.println(" ArrayList lookup: " + startArr + " to " + stopArr + " took " + (stopArr.getTime() - startArr.getTime()));
    }Gets the result:
    D:\jdk1.6.0_05\bin\java -Didea.launcher.port=7540 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA 8.0.1\bin" -Dfile.encoding=windows-1252 -classpath "D:\jdk1.6.0_05\jre\lib\charsets.jar;D:\jdk1.6.0_05\jre\lib\deploy.jar;D:\jdk1.6.0_05\jre\lib\javaws.jar;D:\jdk1.6.0_05\jre\lib\jce.jar;D:\jdk1.6.0_05\jre\lib\jsse.jar;D:\jdk1.6.0_05\jre\lib\management-agent.jar;D:\jdk1.6.0_05\jre\lib\plugin.jar;D:\jdk1.6.0_05\jre\lib\resources.jar;D:\jdk1.6.0_05\jre\lib\rt.jar;D:\jdk1.6.0_05\jre\lib\ext\dnsns.jar;D:\jdk1.6.0_05\jre\lib\ext\localedata.jar;D:\jdk1.6.0_05\jre\lib\ext\sunjce_provider.jar;D:\jdk1.6.0_05\jre\lib\ext\sunmscapi.jar;D:\jdk1.6.0_05\jre\lib\ext\sunpkcs11.jar;F:\dev\Euler\out\production\Euler;C:\Program Files\JetBrains\IntelliJ IDEA 8.0.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain jtw.test.SpeedTest
    Total: 499500000
    Total: 499500000
    LinkedList iteration: Wed Jan 21 07:32:41 CET 2009 to Wed Jan 21 07:32:41 CET 2009 took 30
    ArrayList iteration: Wed Jan 21 07:32:41 CET 2009 to Wed Jan 21 07:32:41 CET 2009 took 53
    Total: 499500000
    Total: 499500000
    LinkedList lookup: Wed Jan 21 07:32:41 CET 2009 to Wed Jan 21 07:32:42 CET 2009 took 424
    ArrayList lookup: Wed Jan 21 07:32:42 CET 2009 to Wed Jan 21 07:32:42 CET 2009 took 22
    Process finished with exit code 0Given the internal representation of the datatypes, this is to be expected.

  • Differnce between getCurrentRow()  and firrst() method

    Hi
    what is the differnce in vo.getCurrentRow() and vo.first().
    I have executed one view which returns only one row.When i use vo.getCurrentRow() I get null but vo.first() gives the row.
    What the reason can be???
    Naveen

    what is the differnce in vo.getCurrentRow() and vo.first().
    As the name suggests getCurrentRow, gives the row at which Vo pointer is at that moment of time, while getFirstRow, will always give u the first row.I have executed one view which returns only one row.When i use vo.getCurrentRow() I get null but vo.first() gives the row.
    When u execute the VO query , your VO pointer is just above the first row, so points to no row, this is very similar, to resultset in jdbc, while when u do vo.first(), pointer gives the first row.I hope this is clear.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Choice between VISA and GPIB drivers

    I have a waveform generator with a GPIB port. I would like to build my own VIs. Can someone suggest which driver (VISA or GPIB or IVI) would be preferable and what are the differences in terms of ease among these drivers?

    Hello Craig,
    I have an Agilent 33220A frequency generator for which I have already found drivers from the Instrument Driver Network. I am a beginner in LABVIEW and am in the process of improving my skills in communicating with instruments. So far, I have been communicating with other instruments using VISA and a serial port.
    While going through LABVIEW HELP, I realized that VISA, GPIB and IVI drivers can be used for communicating with a GPIB instrument port. This being the case, I would like to know which of the above-mentioned drivers is preferable?
    Thanks
    Ram

  • Choice between syncronous and asyncrous BDC

    HI Experts,
    can you kindly guide when one shall go for asynchronous BDC and when for syncronous BDC?
    Thanks.

    Hi Sanjay,
    There are several answers to this question already in the forum - just do a search!

  • Choice between JSP and Servlet

    I am new to JSP and Servlet. I know JSP container will convert JSP to servlet
    eventually. But in application development's standpoint, anything can be
    done in servlet can also be done in JSP? Some people told me we can
    use the combination of both in one application.
    My question is in what situation we use JSP alone, servlet alone, or
    combination of both??
    Please advise. Thanks!!

    Use a combination of both.
    Your Web application should have a single servlet that all HTTP requests are POSTed to. All the servlet does is act like a traffic cop: it figures out what the request is, delegates to other objects that do the work, and forward the result to the next JSP, whatever that is. It's called a front controller servlet.
    The JSPs should just be pure dynamic presentation. Everything displayed in the pages should have been generated by the servlet and its helper classes. No database queries, etc. Your JSPs will be a lot better off if you learn JSTL and eliminate all scriptlet code.
    Check out frameworks like Struts.

Maybe you are looking for

  • Using an external hard drive to connect the camera to the Mac Book Pro

    I am about three weeks away from a 9 to 4 pin firewire cable. In the meantime, I am logging and capturing from my Canon AX HI through my external hard drive. I am not super amazed at the quality of the image, it's noisy. I am using HDV tapes, and I d

  • How to uninstall Safari 4.0.3

    I've been getting a lot of problems with the newly updated Safari... hanging pages (on facebook, onion and etc... all you get is a turning wheel, no crash windows, have to force quite and start again, the second time always works). And it also genera

  • MacBook Pro Trackpad Secondary Click not working properly - switching apps

    I have a MacBook Pro 15" (new Core 2 Duo) with 10.4.8. On my main account, when I try and use the trackpad's two-finger-click to perform the secondary click functionality, I have a problem where instead of showing the secondary menu (same as control-

  • Videos  iMac G5 10.4.11

    The video and sound are not in sync on my G5 10.4.11. What can I do?

  • Q: How do I Mask/Layer a color photo with a black and white photo?

    This is what I want to do. I've done it before but cannot remember for the life of me how to do it again. I want to put a color photo under (its own) black and white photo and then erase or remove or something (I can't remember the tool to do it) but