weblogic8.1下xmlbean中CDATA问题小探
最近同事在weblogic8.1下使用xmlbean,中间出现个问题,有个节点存储的内容也是个xml,输出的时候要求用CDATA括起来。
总结下,在weblogic的xmlbean中和apache的xmlbean有几种情况
1)weblogic的xmlbean和apache的xmlbean-1.x:
根据内容的大小和特殊字符的个数有个算法来决定是用CDATA扩起来还是转义
具体的判断在com.bea.xbean.store.Saver$TextSaver和org.apache.xmlbeans.impl.store.Saver$TextSaver里面
if ((this._lastEmitCch > 32) && (count > 5) && (count * 100 / this._lastEmitCch > 1)){//用<![CDATA[}else{//转义}if (forceCData || (_lastEmitCch > _cdataLengthThreshold && count > _cdataEntityCountThreshold) ){//用<![CDATA[}else{//转义}106:getfield#94; //Field _lastEmitCch:I 109:bipush32 111:if_icmple332 114:iload4 116:iconst_5 117:if_icmple332 120:iload4 122:bipush100 124:imul 125:aload_0 126:getfield#94; //Field _lastEmitCch:I 129:idiv 130:iconst_1 131:if_icmple332 134:aload_0 135:getfield#99; //Field _buf:[C 138:iload_1 139:caload