SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI)抛出一个异常

时间:2018-07-23 10:40:01

标签: android xml xsd schema ioexception

我试图在我的Android应用中通过XSD验证XML文件。但是

import UIKit

class ContactListViewController: UIViewController {
@IBOutlet private var tableView: UITableView!

var delegateHandler = UniversalDelegateHandler(for: tableView as? Protocol)
var tableController: SimpleTableController!
override func viewDidLoad() {
    super.viewDidLoad()
    self.delegateHandler?.addListener(self)
    tableController = SimpleTableController(tableView: tableView, withDelegateHandler:delegateHandler!)
    tableController.register(binder: ContactViewBinder({[weak self] item in
        let storyboard = UIStoryboard(name: "Main", bundle: nil)
        guard let contactItemViewController = storyboard.instantiateViewController(withIdentifier: "ContactInfoViewController") as? ContactItemViewController else { return }
        contactItemViewController.loadViewIfNeeded()
        contactItemViewController.avatarImage = item.photo
        contactItemViewController.name = item.name

        self?.show(contactItemViewController, sender: nil)
    }))
    tableController.tableViewDelegate = (delegateHandler as! UITableViewDelegate)
}

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)

    tableController.itemModels = [
        ContactItemModel(photo: UIImage(named: "avatar1")!, name: "Marie"),
        ContactItemModel(photo: UIImage(named: "avatar3")!, name: "Benjamin"),
        ContactItemModel(photo: UIImage(named: "avatar1")!, name: "Sofia"),
        ContactItemModel(photo: UIImage(named: "avatar2")!, name: "Barry"),
        ContactItemModel(photo: UIImage(named: "avatar1")!, name: "Elizabeth"),
        ContactItemModel(photo: UIImage(named: "avatar1")!, name: "Chloe"),
        ContactItemModel(photo: UIImage(named: "avatar3")!, name: "Brian"),
        ContactItemModel(photo: UIImage(named: "avatar2")!, name: "Corwin"),
        ContactItemModel(photo: UIImage(named: "avatar3")!, name: "Christopher"),
    ]
}
}

extension ContactListViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    tableView.deselectRow(at: indexPath, animated: true)
}
}

行返回以下错误消息。

  

java.lang.IllegalArgumentException:http://www.w3.org/2001/XMLSchema

这是我的代码

SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); 

有什么方法可以在Android中解决此问题。

0 个答案:

没有答案