I am writing a GUI application that calls the command line utility /usr/bin/xmllint. I am going to grab the output from the command and display it, however I am having issues getting it to even execute properly. Here is my code chunk:
Here is the console output:
However when I copy and paste the EXACT same command in terminal it works perfectly:
Can anyone diagnose what may be wrong with my code that is causing it to fail on me?
Code:
-(IBAction)validateButtonClicked:(id)sender
{
NSString* xsdValue = [xsdPathBar stringValue];
NSString* xmlValue = [xmlPathBar stringValue];
if( [xsdValue isEqualToString:@""] || [xmlValue isEqualToString:@""] )
{
[outBox setStringValue:@"You must select both an XML file and XSD file"];
} else {
NSString* xmllintArgs = [NSString stringWithFormat:@"--noout --schema %@ %@", xsdValue, xmlValue];
NSLog(@"%@", xmllintArgs);
NSTask *xmllint;
xmllint = [[NSTask alloc] init];
[xmllint setLaunchPath:@"/usr/bin/xmllint"];
[xmllint setArguments:[NSArray arrayWithObjects:(NSString*)xmllintArgs, NULL]];
[xmllint launch];
[xmllint release];
xmllint = nil;
[outBox setStringValue:@"OK!"];
}
}
Here is the console output:
Unknown option --noout --schema /real/path/to/file/BooksSchema.xsd /real/path/to/file/Books.xml
Usage : /usr/bin/xmllint [options] XMLfiles ...
Parse the XML files and output the result of the parsing
--version : display the version of the XML library used
--debug : dump a debug tree of the in-memory document
--shell : run a navigating shell
--debugent : debug the entities defined in the document
--copy : used to test the internal copy implementation
.... etc ....
However when I copy and paste the EXACT same command in terminal it works perfectly:
Steves-MacBook-Pro:~ morri534$ /usr/bin/xmllint --noout --schema /real/path/to/file/BooksSchema.xsd /real/path/to/file/Books.xml
/real/path/to/file/Books.xml validates
Steves-MacBook-Pro:~ morri534$
Can anyone diagnose what may be wrong with my code that is causing it to fail on me?