473,408 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Problems with getting text from node (xalan)

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)
Jul 20 '05 #1
1 1598
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
LN****@hotmail.com (Jeff) wrote in message news:<ce**************************@posting.google. com>...
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)

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andy Fish | last post by:
Hi I am using Xalan-J 2.4.1 and I am trying to get the EXSLT node-set function working. xalan:nodeset() works fine but when I try exslt:node-set I get this error: (Location of error...
2
by: Patrik Carlsson | last post by:
I have a problem using Xerces with a template for a generic page-header getting a sub-tree as argument. The same stylesheet is working flawlessly in IE and Mozilla, though it would be nice to have...
3
by: Alan Krueger | last post by:
Greetings, I've been able to cache Transformer objects in a Tomcat-based servlet application to avoid unnecessary Transformer rebuilding, except for certain ones on certain machines. I'm...
1
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a Java object to XML via SAX and let the FOP...
12
by: Anna | last post by:
Hi all, I posted the same question this afternoon but my message isn't showing up, so I thought I'd give it another try.... in case you should see it later I apologize for posting the same...
2
by: fremenusul | last post by:
I orginally asked this question on friday, and made some progress, but now I am getting an error. What is the type of xmlProductName (check the runtime type in the debugger)? The debug output...
3
by: Avalon1178 | last post by:
Hi, I recently downloaded the xalan-c source code in http://mirrors.ccs.neu.edu/Apache/dist/xml/xalan-c I followed the instructions from the apache site on how to build it (I already have...
3
by: Ali Sahin | last post by:
Hi there, I'd like to transform a XML-File to PDF. The XML-File ist build like followed: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml-stylesheet type="text/xsl"...
0
by: DAnne | last post by:
Hi, I'm very new to xslt and this is my first time posting to a Forum so please forgive me if I transgress any protocols. I have to do a tally report. This report is divided up into sections....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.