0
votes

I have used expat and want to convert my code to use libxml2 sax parser. I have 2 questions:

Q1) expat provides api XML_SetUserData(), i want similar api in libxml2.

Q2) Does libxml2 sax parser allow schema validation along with parsing the xml.

Thanks SM

1

1 Answers

0
votes

xmlSAXHandlerinstance.userdata = your_data; should do the needful.

You will get this data in all your callbacks then.

You can also set user data when you instantiate your Parser context. Eg: xmlCreatePushParserCtxt(&xmlSAXHandlerinstance, your_data, NULL, 0, NULL);