1.问题: XMLBeans Weblogic8.1冲突
To override the weblogic.jar with your own QName.jar, your need to do the following:
Add the QName JAR file (qname.jar) into the WEB-INF/lib folder in your WAR file
Add a file weblogic.xml into the WEB-INF folder in your WAR file
Below is an example weblogic.xml file:
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN"
"http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd"><weblogic-web-app> <container-descriptor> <prefer-web-
inf-classes>true</prefer-web-inf-classes> </container-descriptor></weblogic-web-app>
注:当WEB-INF目录下的包与系统CLASSPATH所设定的第三方包相同的时候,缺省情况下Weblogic会优先使用CLASSPATH下的那个包。如果想使用
WEB-INF下面的包,需要在weblogic.xml下面配置
<weblogic-web-app>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
2.问题:在生成的xml中加上xsi:schemaLocation attribute
How can I instruct XMLBeans to add the xsi:schemaLocation attribute
to my documents?
Here's how to do it. Assume that you have a document represented by
the doc XmlObject (obtained via TestDocument.Factory.newInstance()
or TestDocument.Factory.parse()) and you need an xsi:schemaLocation
attribute on it, with value from the location String.
加上:
XmlCursor cursor = doc.newCursor();
if (cursor.toFirstChild())
{
cursor.setAttributeText(new QName
("http://www.w3.org/2001/XMLSchema-instance","noNamespaceSchemaLocation"),
location);
}