getTextContent alternative

Discussion in 'Java' started by rohit, Apr 7, 2006.

  1. rohit

    rohit Guest

    I have a java application using JDK 1.5 and now need to run the same
    application on JDK 1.4. I have used a function "getTextContent()" that
    is available in JDK 1.5 and above

    org.w3c.dom.Node nChildlist;
    nChildlist.getTextContent() // works fine on JDK 1.5 but gives
    following error in JDK 1.4

    cannot find symbol method getTextContent()

    Has anybody encountered similar situation ?
    What is the possible workaround for the same ?
    Any solution for the same is welcome

    Thanks ,
    rohit, Apr 7, 2006
    1. Advertisements

  2. rohit

    Rhino Guest

    I know _nothing_ about the API you are using but, by looking at the API for
    Java 1.4.1, I saw a method in the same class - org.w3c.dom.Node - called
    getNodeValue(). Maybe that would work??
    Rhino, Apr 7, 2006
    1. Advertisements

  3. Well, if it is "available in JDK 1.5 and above", what made you think it
    would work
    in an earlier version, when it was not available? That's like saying
    "Airbags work in my 2005 Honda, but didn't work on my 1957 Chevy - why not?"

    Your solution is:
    1) upgrade to 1.5 (i.e., buy a new car that has airbags)
    2) Write your own method that does this (i.e., install your own airbags)
    Fred Kleinschmidt, Apr 7, 2006
  4. See the table that is in the class JavaDoc for org.xml.dom.Node -- it
    enumerates the various sorts of nodes, and what getNodeValue() returns
    for each one.

    Now, consider the table that is in the method JavaDoc for the
    getTextContent() method of org.xml.dom.Node. It explains exactly what
    the method does, for each possible type of node. The method does one
    of three things:


    PROCESSING_INSTRUCTION_NODE, it returns the same thing that is returned
    by Node.getNodeValue().

    3. for everything else, it does an in-order traversal of the child
    nodes of the node, getting the node's contents (or quite possibly
    recursively calling getTextContent() on the child node) and
    concatenating them with the contents of the other children nodes.

    This shouldn't be too terribly difficult to code. Have fun! :)

    Greg R. Broderick, Apr 7, 2006
  5. rohit

    Ed Guest

    (Asonishingly OT.)

    Hi, Fred.

    That, "Software Reuse Project," sounds interesting; I googled but
    didn't find anything Boeing-specific in the first few pages; and the
    search on for that phrase yields no results.

    I preume that, as you have the reference in your signature, you're not
    bound to silence: can you elaborate on the project? Methods, processes,
    guidelines, conclusions, etc.?

    I know nothing about such matters, but I'd have thought that commercial
    airline software is on a par with military software projects, which,
    when last I checked, were overwhelmingly ADA, because of its rigourous
    (if marvellously expensive) provability.

    Do Boeing use OO in commercial aircraft software design? And
    particularly, given this group, what do Boeing use Java for?

    Ed, Apr 8, 2006
  6. rohit

    rohit Guest

    Hi Ed,

    Please donot modify my original post! I wanted a solution for my query
    and not for your Boeing;s matter.

    rohit, Apr 9, 2006
  7. rohit

    Chris Uppal Guest

    Where do you get the impression that anyone except you gives as damn what you
    want ?

    -- chris
    Chris Uppal, Apr 9, 2006
  8. rohit

    rohit Guest

    Hi Chris,

    I posted the query to have some possible solutions/discussions and not
    for your SILLY and IRRELEVANT talks. And be sure not to drag the useful
    discussions to topics of your own interests.

    B/w why are your information in this reply when you donot have any
    possible solutions. ?? Just to waste time of others ??

    rohit, Apr 9, 2006
  9. We are sorry god.

    But please try to learn to quote. (I know it is hard for you)
    Luc The Perverse, Apr 9, 2006
  10. rohit

    Chris Uppal Guest

    But why not ? It's my NG just as much as yours. Maybe more since I'm directly
    paying for my NNTP service provider.

    No, no. You have misunderstood me. I doubt if anyone else is paying any
    attention to this at all (or if they are, it's because they find it moderately
    entertaining). The purpose is to waste /your/ time...


    More seriously. The is a Usenet newsgroup (you do realise that you are using
    Usenet, don't you ? Nothing at all to do with Google). It's a discussion
    forum, rather than (as you seem to imagine) a help-desk. It's a "place" where
    people gather to discuss matters of mutual interest. You may have started a
    thread on one topic, but if anyone else finds anything in that thread
    (obviously relevant or not) that they want to pursue, then that is (within the
    bounds of civility) their right. You /started/ the conversation, you don't
    /own/ it.

    Maybe you didn't realise that that's how Usenet works. You will (this is not
    intended as any kind of insult) find Usenet much more friendly (and helpful) if
    you learn the few simple rules about how it works.

    -- chris
    Chris Uppal, Apr 9, 2006
  11. rohit

    rohit Guest

    Hi LTP,

    How come you in JAVA group ??? This is not a GAMING group where keep
    sending your baseless and useless lessons. So better not to change the
    technical discussions to topics of your interest...

    Hi Chris,

    Yes, i have found this group (and other too) very informative.

    Also, you have full right to put your words across.

    Anyways, i found solution to my problem through some research. Thanks
    Rhino and Fred for your sending your useful suggestions.
    rohit, Apr 9, 2006
  12. rohit

    Timo Stamm Guest

    Yes, unfortunately the lesson was useless. You have not learnt anything.

    You have posted several messages here that only contained links to
    websites full of advertisements with questionable value.

    You have never helped anyone out.

    You don't pay attention to the nettiquette (quotings).

    *You* have startet to post messages that don't belong here ("Please
    donot modify my original post!").

    You are completely out of your mind demanding that Ed, Luc or Chris
    should not discuss anything else but your problem.

    If you continue like that, it is very likely that nobody will even
    bother to read your postings.

    Timo Stamm, Apr 9, 2006
  13. rohit

    Roedy Green Guest

    You are under suffering from some strong delusions about what the
    newsgroups are for. You are digging yourself a deep hole. See
    Roedy Green, Apr 9, 2006
  14. rohit

    Roedy Green Guest

    It is called topic drift. You don't own a thread just because you
    started it.

    Your imperiousness is offensive to people from many nations, and it
    having the exact opposite effect to that you desire.
    Roedy Green, Apr 9, 2006
  15. rohit

    rohit Guest

    Thanks All for the information
    rohit, Apr 9, 2006
  16. rohit

    Alex Hunsley Guest

    He's not modifying your original post. It's not possible. Your original
    post is still there, unchanged.
    I think you need to to find out more about how usenet/nesgroups works,
    and about the etiquette and practices...
    Alex Hunsley, Apr 9, 2006
  17. rohit

    Alex Hunsley Guest

    You don't own threads on usenet. It doesn't work that way.
    Do you think that your potential helpers are that fickle and stupid that
    they will not address your question, if they able to, because someone
    metnioned something else in the thread?
    Threads can split off and evolve on usenet. Deal with it.
    Are you under the impression that usenet revolves around you and your
    Alex Hunsley, Apr 9, 2006
  18. rohit

    Alex Hunsley Guest

    Because he knows about Java and he helps people via usenet.
    How many people have you been helping in this group lately?
    You're showing yourself up with this little tantrum. Better stop
    digging, my friend....
    Alex Hunsley, Apr 9, 2006
  19. rohit

    rohit Guest

    I Accept my mistake.
    rohit, Apr 10, 2006
  20. rohit

    Alex Hunsley Guest

    Thanks Rohit. That's a lot more gracious than some other people!
    Stick around, see how things work round here/on usenet, and you'll find
    it a very useful place.
    Alex Hunsley, Apr 10, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.