我尝试在此代码中使用TFHlle
解析html将对象添加到我的可变数组中,但它在我的数组中为对象返回null,但是在for循环中,我记录了'[element objectForKey:@]的结果“title”]'并返回我想要的结果。
如何将元素[objectForKey:@"title"]
的结果添加到我的数组中?
TFHpple *htmlParseResult = [TFHpple hppleWithHTMLData:self.responseData];
NSString *coursesXpathQueryString = @"//h2[@class='main']/a";
NSArray *coursesNodes = [htmlParseResult searchWithXPathQuery:coursesXpathQueryString];
NSMutableArray *fitCourse = [[NSMutableArray alloc] initWithCapacity:0];
for (TFHppleElement *element in coursesNodes) {
[fitCourse addObject:[element objectForKey:@"title"]];
}
答案 0 :(得分:0)
我认为
var valuedCustomer = new ValuedCustomerSpecification();
//1. You can use this statement to check if a customer is valued or not in your domain
Customer customer = ....
if(valuedCustomer.IsSatisfiedBy(customer))
//2. You can use it to get just valued customers from repository,
var valuedCustomers = repository.Get(valuedCustomer);
//3. You can combine it with other specifications to create composite specifications. Following syntax can vary with implementation
var seniorValuedCustomer = valuedCustomer.And(seniorCustomer)
应该改为:
NSArray *coursesNodes = [htmlParseResult searchWithXPathQuery:coursesXpathQueryString];
我不确定这是否有效,但你可以试试。