public void Build()throws SAXException,IOException,ParserConfigurationException{
//创建解析器
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
//创建SchemaFactory
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
XMLConstants.W3C_XML_SCHEMA_NS_URI这句报错,内容如下:
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem: 
XMLConstants.W3C_XML_SCHEMA_NS_URI cannot be resolved
这是怎么回事

解决方案 »

  1.   

    不懂http://www.google.com/#hl=en&q=XMLConstants.W3C_XML_SCHEMA_NS_URI+cannot+be+resolve&btnG=Google+Search&aq=f&oq=XMLConstants.W3C_XML_SCHEMA_NS_URI+cannot+be+resolve&fp=5W2ZPH9dD9s
      

  2.   

    The problem is that your DocumentBuilderFactory needs to have namespace support enabled. Try,   builderFactory.setNamespaceAware(true);For historical reasons, and backward compatibility, this is not enabled by default. Also note that the document should not have any whitespace (text) between <import> and </import>, i.e. it should read,  <import></import>Closing this CR as "Not a Defect".
    Posted Date : 2007-01-23 23:37:18.0