BlogJava-梦醒乌托邦http://www.blogjava.net/chentao/zh-cnFri, 20 Jun 2025 01:16:51 GMTFri, 20 Jun 2025 01:16:51 GMT60用Schema校验XML格式在AIX上Websphere上出错http://www.blogjava.net/chentao/archive/2008/09/20/chentao.html陈涛陈涛Sat, 20 Sep 2008 09:18:00 GMThttp://www.blogjava.net/chentao/archive/2008/09/20/chentao.htmlhttp://www.blogjava.net/chentao/comments/230159.htmlhttp://www.blogjava.net/chentao/archive/2008/09/20/chentao.html#Feedback0http://www.blogjava.net/chentao/comments/commentRss/230159.htmlhttp://www.blogjava.net/chentao/services/trackbacks/230159.htmlJava做XML解析入库,用Schema校验XML格式,在Windows环境下的Websphere6部署进行校验和解析都没问题,但在AIX上Websphere6上解析就出错,本人联系方式,MSN:chentao_1983_7@hotmail.com  QQ:278555390,请高手指点一下,谢谢。

在共享库中已经加入jdom-1.0.jar、dom4j-1.6.1.jar和xerces.jar,校验XML格式报错信息如下:
第2行 第8列:General Schema Error: Can't get back Schema document's root element
:/usr/IBM/WebSphere/AppServer/profiles/App2Pro2/installedApps/operapp1Cell01/oper_amlmis_ear.ear/oper_amlmis.war
xml/validateYear.xsd.
第2行 第8列:Element type 'banks' must be declared.
第3行 第8列:Element type 'bank' must be declared.
第4行 第9列:Element type 'head' must be declared.
............//中间出错信息省略
第71行 第18列:Element type 'sjxmmcjzynr' must be declared.
第72行 第16列:Element type 'sjfxdzywt' must be declared.
第73行 第13列:Element type 'wtzgqk' must be declared.

--------------------------------
用Schema校验XML格式的程序如下:(附件中有Schema和XML文件)
SAXReader reader = new SAXReader();
Document document = null;
//数据校验
String schema = Config.getInstance().getRealPath() + "/xml/validateYear.xsd";
reader.setValidation(true);
reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",schema);
XMLErrorHandler errorHandler = new XMLErrorHandler();
reader.setErrorHandler(errorHandler);



陈涛 2008-09-20 17:18 发表评论
]]>