Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

getTextContent alternative

Thread view: 
rohit - 07 Apr 2006 19:01 GMT
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
Rhino - 07 Apr 2006 21:36 GMT
> Hi,
> I have a java application using JDK 1.5 and now need to run the same
[quoted text clipped - 10 lines]
> 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??

--
Rhino
Fred Kleinschmidt - 07 Apr 2006 21:47 GMT
> Hi,
> I have a java application using JDK 1.5 and now need to run the same
[quoted text clipped - 13 lines]
> 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)

Signature

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

Ed - 08 Apr 2006 21:19 GMT
> 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

--
www.EdmundKirwan.com - Home of The Fractal Class Composition
rohit - 09 Apr 2006 07:18 GMT
Hi Ed,

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

Rohit
Chris Uppal - 09 Apr 2006 07:55 GMT
> 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
rohit - 09 Apr 2006 11:55 GMT
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
Luc The Perverse - 09 Apr 2006 13:49 GMT
> Hi Chris,
>
[quoted text clipped - 4 lines]
> 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)

--
LTP

:)
Chris Uppal - 09 Apr 2006 13:57 GMT
> 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
rohit - 09 Apr 2006 15:39 GMT
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,

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

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
Timo Stamm - 09 Apr 2006 17:34 GMT
rohit schrieb:
> 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
Alex Hunsley - 09 Apr 2006 19:25 GMT
> 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....

> Anyways,  i found solution to my problem through some research. Thanks
> Rhino and Fred for your sending your useful suggestions.
> RDH
rohit - 10 Apr 2006 04:14 GMT
I Accept my mistake.
Rohit
Alex Hunsley - 10 Apr 2006 10:06 GMT
> 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.
rohit - 11 Apr 2006 07:35 GMT
IF anybody can throw some light on following issue:
Hi,

Operating System : Mac OS X 10.3.9
Java version: 1.4.2

I have an application that uses getTextContent(), setTextContent()
which are not present in JDK 1.4.2 so
I am in process of adding/using JAXP 1.3.2 on JDK 1.4.2.

Below are the steps I tried for the same but still couldnot resolve the

issue :

1. Downloaded JAXP 1.3.2 from
https://jaxp.dev.java.net/files/documents/913/28792/JAXP_RI_20060217....

and unpacked the same using java -cp . JAXP_RI_20060217

(There is another step written in the URL to compile using jDK.1.4.2
with source/target = 1.4, i couldnot get that point so omiited for the
time being)

2. Placed the files dom.jar, jaxp-api.jar, sax.jar, xalan.jar,
xerecsImpl.jar at following path:

/Systems/Library/Frameworks/JavaVM.framework/Version/1.4.2/Home/lib/endrose­d.

3. And recompiled the project. Using JBuilder 2005 for building the
application.

But still the application couldnot get the functions, getTextContent
and setTextContent

As per my understanding the application is not able to connect to these

jar.

Do we need to explicitly specify the path of these jars ??

I hope similiar issue might have been faced earlier too ??

What can be the possible solution?

Regards,
RDH
Oliver Wong - 15 Apr 2006 18:45 GMT
> Operating System : Mac OS X 10.3.9
[...]
> 2. Placed the files dom.jar, jaxp-api.jar, sax.jar, xalan.jar,
> xerecsImpl.jar at following path:
[quoted text clipped - 11 lines]
>
> Do we need to explicitly specify the path of these jars ??

   If the problem is that the application can't find the JAR, try adding
those JARs to your build path. Hopefully JBuilder 2005 has an option for
configuring the buildpath.

   But the problem might be that no classes in those JARs actually define
the getTextContent() and setTextContent() methods. Did you check the
documentation for those JARs to check if they do define those methods?

   - Oliver
rohit - 18 Apr 2006 15:07 GMT
Yes, these API are exposed. I have found other alternative but donot
know how correct is it

node.getFirstChild().getNodeValue()

Will the above serve same as getTextContent() ?
Rohit
Oliver Wong - 18 Apr 2006 17:55 GMT
> Yes, these API are exposed. I have found other alternative but donot
> know how correct is it
>
> node.getFirstChild().getNodeValue()
>
> Will the above serve same as getTextContent() ?

   I don't know. Read the documentation and see if they do the same thing.

   I'm guessing maybe you're doing something to do with XML, but I can't
tell for sure from the context I have available to me.

   If this is XML-stuff (i.e. you're working with the w3c.dom package), I
think the two methods don't do the same thing. If node is an attribute, then
getFirstChild() will return null, thus leading to a NullPointerException,
for example.

   - Oliver
the_schmitz@hotmail.com - 25 Apr 2006 02:49 GMT
I'm running into the same problem.  I've tried putting the JARs in my
Classpath and the endorsed directory, and still no luck.  Were you able
to find a solution to the problem, besides upgrading to version 1.5 of
the JDK?

Thanks
Roedy Green - 09 Apr 2006 18:39 GMT
>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.  
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Alex Hunsley - 09 Apr 2006 19:22 GMT
> 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?
Roedy Green - 09 Apr 2006 18:36 GMT
>Please donot modify my original post! I wanted a solution for my query
>and not for your Boeing;s matter.
>
>Rohit

You are under suffering from some strong delusions about what the
newsgroups are for.  You are digging yourself a deep hole. See
http://mindprod.com/jgloss/newsgroups.html

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

rohit - 09 Apr 2006 18:39 GMT
Thanks All for the information
Rohit
Alex Hunsley - 09 Apr 2006 19:19 GMT
> 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...
Greg R. Broderick - 07 Apr 2006 23:21 GMT
> 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.