I m doing with SAX parsing for all my projects and it works nicely. But today I faced a 开发者_如何学JAVAproblem 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?
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.
精彩评论