Re: How to get the value of an element
Sebastian Pipping <[email protected]>
| Newsgroups | gmane.text.xml.expat.general |
|---|---|
| Message-ID | <[email protected]> |
Bin Chen wrote: > Thanks, but that's not I want, I translate below code to C and run, then > find many useless char is also captured. I don't need any other useless > char other than the value of f2, is there any better way to do this? > > The CharacterDataHandler seems a handler for every char that not > processed by "element handler", is it right? So something like '\t' and > '\n' are also be handled, and it's totally context free. > > I want the content of f2, it is context sensitive, there are no API for > this? ----------------------------------------------------------- No. Expat is a "low level" parser so you trade in more work for more speed and flexibility. You will have to track tag starts and endings yourself (or use a DOM parser instead). Expat has to report all the whitespace since it by default is significant. Before throwing the whitespace away make sure the language/schema you parse tells you to. Are you implementing your own or a known format? Sebastian