getTextContent alternative

R

rohit

Hi,
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 ,
RDH
 
R

Rhino

rohit said:
Hi,
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
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??
 
F

Fred Kleinschmidt

rohit said:
Hi,
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 ,
RDH
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)
 
G

Greg R. Broderick

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

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:

1. for DOCUMENT_NODE, DOCUMENT_TYPE_NODE and NOTATION_NODE, it returns
null.

2. for TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE, and
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! :)


Cheers
GRB
 
E

Ed

Fred said:
Fred L. Kleinschmidt
Boeing Associate Technical Fellow
Technical Architect, Software Reuse Project

(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 boeing.com 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
 
R

rohit

Hi Ed,

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

Rohit
 
C

Chris Uppal

rohit said:
Please donot modify my original post! I wanted a solution for my query

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

-- chris
 
R

rohit

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 ??

RDH
 
L

Luc The Perverse

rohit said:
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 ??

We are sorry god.

But please try to learn to quote. (I know it is hard for you)
 
C

Chris Uppal

rohit said:
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.

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

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

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
 
R

rohit

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.
RDH
 
T

Timo Stamm

rohit said:
Hi LTP,

How come you in JAVA group ??? This is not a GAMING group where keep
sending your baseless and useless lessons.

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
 
R

Roedy Green

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.

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.
 
A

Alex Hunsley

rohit said:
Hi Ed,

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

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...
 
A

Alex Hunsley

rohit said:
Hi Chris,

I posted the query to have some possible solutions/discussions and not
for your SILLY and IRRELEVANT talks.

You don't own threads on usenet. It doesn't work that way.
And be sure not to drag the useful
discussions to topics of your own interests.

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.
B/w why are your information in this reply when you donot have any
possible solutions. ?? Just to waste time of others ??

Are you under the impression that usenet revolves around you and your
needs?
 
A

Alex Hunsley

rohit said:
Hi LTP,

How come you in JAVA group ???

Because he knows about Java and he helps people via usenet.
How many people have you been helping in this group lately?
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...

You're showing yourself up with this little tantrum. Better stop
digging, my friend....
 
A

Alex Hunsley

rohit said:
I Accept my mistake.
Rohit

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top