Problems with getting text from node (xalan)

J

Jeff

I have a node that I'd call a text node, but the parser disagrees. At
any rate, I'd like to get the text out of it. (It is some text with
infrequent markup.

I'm using Xalan and Java. getNodeValue() returns null, and
isTextNode(n) returns false. Here is the only code I've been able to
use to get the text out:

ByteArrayOutputStream baotc = new ByteArrayOutputStream();
StreamResult out = new StreamResult(new OutputStreamWriter(baotc));
serializer.transform(new DOMSource(n), out);
String tt = baotc.toString();

It actually gives the text but has a jarbled(to me) footer and header.
I'm doing something wrong of course.

Thanks for your help.
LNMEgo

(btw, I did post this on the forums at sun, but didn't get a response.
so, yes I did cross post, but that forum is pretty unresponsive.
thanks)
 
J

Jeff

I realized that it was due to another line of code that I have since
fixed. Thanks to anyone who had tried to think of a solution.
-LNMEgo
 

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,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top