关干利用dom操作xml的问题:
我在JBuild4.0,(tomcat5.0)已将C:\Tomcat 5.0\common\endorsed\xml-apis.jar导入,然后编写document1.java
package com.deitel.advjhtp1.servlets;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.transform.dom.*;
import javax.xml.parsers.*;
public class document1 {
public document1() {
Document doc;
Document doc1=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
DOMSource doms=new DOMSoruce(doc);
}
}
编译时出现如下错误:
[Document doc;这句话出现的错误:]
"document1.java": Error #: 300 : class Document not found in class com.deitel.advjhtp1.servlets.document1 at line 15, column 3
[这句话: Document doc1=DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();出现的以下两个错误]
"document1.java": Error #: 300 : class Document not found in class com.deitel.advjhtp1.servlets.document1 at line 16, column 3
"document1.java": Error #: 360 : unreported exception: javax.xml.parsers.ParserConfigurationException; must be caught or declared to be thrown at line 16, column 72
[ DOMSource doms=new DOMSoruce(doc);这句话出现的以下错误:]
"document1.java": Error #: 300 : class DOMSoruce not found in class com.deitel.advjhtp1.servlets.document1 at line 17, column 22
请高手指教!!!
回复 更多评论