473,467 Members | 1,575 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

unable to preserve whitespace

I am unable to preserve white space.

Here is my code:
public class xml {
public static void main(String[] args) {
try{
String jaxpPropertyName = "javax.xml.parsers.SAXParserFactory";
if (System.getProperty(jaxpPropertyName) == null) {
String apacheXercesPropertyValue =
"org.apache.xerces.jaxp.SAXParserFactoryImpl";
System.setProperty(jaxpPropertyName,
apacheXercesPropertyValue);
}
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser parser = factory.newSAXParser();
Reader reader=new StringReader("<?xml version='1.0'
encoding='UTF-8'?><References><Reference><Name>RITA
MOYER</Name><Address><Street>5001 OAKVIEW DRIVE </Street><City>Los
Angeles</City><State>OH</State><ZIP>44089</ZIP></Address><EMail></EMail><Phone>4409678038</Phone><Relationship>MOTHER</Relationship></Reference><Reference><Name>TINA
MASLINSKI</Name><Address><Street>4902 MAPLE VIEW
DRIVE</Street><City>Los
Angeles</City><State>OH</State><ZIP>44089</ZIP></Address><EMail></EMail><Phone>4409675992</Phone><Relationship>FRIEND</Relationship></Reference></References>");
InputSource is=new InputSource(reader);
factory.setNamespaceAware(true);
parser.parse(is, new PrintHandler());
} catch(Exception e) {
e.printStackTrace();
}
}
}

I want the parser to show for Name "Rita Moyer". It now shows "Rita"

Thanks for your help

May 18 '06 #1
1 1467
I strongly suspect PrintHandler (which you didn't show us) has the
standard SAX-beginner's problem of forgetting that text may be spread
over successive calls to characters(). See any good SAX tutorial for a
discussion of how to deal with that.

--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry
May 19 '06 #2

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

Similar topics

5
by: Terje Sæternes | last post by:
It seems that this script wont run, any idea what I have don wrong+ Code----- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Untitled Document</title>...
0
by: serge | last post by:
I have an XML file with an XSD file. When i am reading the XML file and putting its content into a DataSet I notice that the field that has a single space character is being converted to a field...
11
by: Brian W | last post by:
Yet another editor problem To reproduce do the following 1) Open a Webform and switch to HTML edit mode 2) Enter the Following (include spaces) This is some text before <asp:hyperlink...
4
by: Chris Bower | last post by:
Reposted from aspnet.buildingcontrols: Ok, I've got a bunch of derived controls that all have a property Rights of type Rights (Rights is an Enumerator). I wrote a custom TypeConverter so that I...
5
by: Paul | last post by:
Off the cuff, does anyone know if arraylist is more efficeint at adding items to an array than redim preserve? Paul <begin loop> Dim c As Integer = SomeArray.GetUpperBound(0) + 1 ReDim...
6
by: Mark | last post by:
In a specification I'm designing, I'd like to specify that the order of Names (IDs) in an attribute value of datatype IDREFS is significant. My question is if most real-world XML parsers...
2
by: daftspaniel | last post by:
Hi Folks, I am trying to scan the lines in the string text: lines = text.split('\n') seemed to do the job but has the side effect of stripping the whitespace. As I am reading Python source in...
1
by: www.douglassdavis.com | last post by:
it seems every time i pass some text through an applet parameter, say: .... <PARAM name="mytext" value=' This is a test '> ....
0
by: forgedascendant | last post by:
Good day everyone, I am new to this site so please forgive me if this post isn't completly correct. For the past 2 weeks I have been beating my head against the wall trying to figure out what is...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.