0

I m doing with SAX parsing for all my projects and it works nicely. But today I faced a problem while accessing the same SAX. Following is the part of the xml where am getting problem.

<customCssStyle label="css1" order="1" text=".test { background-color: yellow; } .link { background-color: red; }"/>

While parsing with SAX I can get the values of "label" and "order". but in case of "text" I am facing problem. This value comes in 2 strings. I think it's due to white space.

Am i right? Can SAX not recognize the white space? Should I use Pull parsing?

Graham Borland
  • 60,055
  • 21
  • 138
  • 179
Subrat
  • 3,928
  • 6
  • 39
  • 48

1 Answers1

0

The characters() method may be called several times for each element. It's up to you to maintain all the characters read so far, in a StringBuilder for example, and append the new characters each time until endElement() is reached.

See this question and its accepted answer for full details.

Community
  • 1
  • 1
Graham Borland
  • 60,055
  • 21
  • 138
  • 179
  • I think you cant get my question. Sorry for bad english. Actualy I can do the parssing and got the values also but in case of "text" i got 2 strings like .test { background-color: yellow; } and .link { background-color: red; } . But It should be one string – Subrat Sep 07 '11 at 11:56