SAX parser and white spaces

H

Helge Ruistuen

Hello,

I'm using SAX parser to read a string of numbers defined as XML list type.
Occasionally the 'characters' method is called twice, which means I need a
buffer to read the entire string. My problem is that whenever "the split"
(or second reading) occurs at a white space, I need to manually add a white
space (avoid two number becoming one), while for the case that the parser
start a second reading within a number, adding a white space results in an
extra (unwanted) number, ie. one number is aplit into two numbers.

Is the parser supposed to behave like this? Any suggestion for a solution to
this problem is welcomed.

Thanks and regards,
Helge
 
M

Malcolm Dew-Jones

Helge Ruistuen ([email protected]) wrote:
: Hello,

: I'm using SAX parser to read a string of numbers defined as XML list type.
: Occasionally the 'characters' method is called twice, which means I need a
: buffer to read the entire string. My problem is that whenever "the split"
: (or second reading) occurs at a white space, I need to manually add a white
: space (avoid two number becoming one), while for the case that the parser
: start a second reading within a number, adding a white space results in an
: extra (unwanted) number, ie. one number is aplit into two numbers.

: Is the parser supposed to behave like this? Any suggestion for a solution to
: this problem is welcomed.

: Thanks and regards,
: Helge


Perhaps you need to use

ignorableWhitespace(char[] ch, int start, int length)


I have a feeling that some implementations of SAX also have an option to
control how whitespace is handled.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top