0

I'm trying to extract some fields from a very big XML file using libexpat. I want to stop the parser when all fields I needed are extracted.

The documentation say that:

Although handlers are typically set prior to parsing and left alone, an application may choose to set or change the handler for a parsing event while the parse is in progress. For instance, your application may choose to ignore all text not descended from a para element. One way it could do this is to set the character handler when a para start tag is seen, and unset it for the corresponding end tag.

I assume this is what I need. But they don't provide any examples and I'm very new to this. Could anyone show me some ways to do this?

Update: This is not what I need. They are just telling me to ignore the text, not to stop the parser :(

npsable
  • 13
  • 3
  • You can use XML_StopParser, my bad on reading the old documentation. https://libexpat.github.io/doc/api/latest/#XML_StopParser. – npsable Jul 31 '23 at 10:29

0 Answers0