objC Api iOS sdks. API- libxml C.
- you are loading xml (e.g. xmlReadMemory)
- then for XSD you should use xmlSchemaValidateDoc
or you can use the following wrapper class [disclaimer: I'm author]:
DDXMLValidator (part of my helpers @ https://github.com/Daij-Djan/DDUtils/ )
NSError *error = nil;
NSURL *schemaURL = [[NSBundle mainBundle] URLForResource:@"XMLSchema" withExtension:@"xsd"];
if(![[SNXMLValidator sharedInstace] validateXMLData:xmlData withSchema:SNXMLValidatorSchemaTypeXSD schemaFile:schemaURL error:&error]) {
DebugLog(@"Failed to validate data: %@", error);
}
the class can do DTD, XSD, RelaxNG (it just wraps libxml2)
source
share