文中分別使用xerces和jaxp兩種方式來檢驗XML文檔的合法性,文末附代碼下載,直接拿來主義了。

http://www.onjava.com/pub/a/onjava/2004/09/15/schema-validation.html