DOM4j修改xml问题,在线等
XML文件如下所示(只截出部分数据):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.1//EN" "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_1.dtd">
<mbean>
<attribute access="read-write" getMethod="getTLSConfigName" setMethod="setTLSConfigName">
<description>Used internally. Do NOT modify.</description>
<name>TLSConfigName</name>
<type>javax.management.ObjectName</type>
</attribute>
&defaultAttributes;
<!-- Operations -->
&defaultOperations;
<operation impact="INFO">
<description>Get DICOM Handler</description>
<name>dcmHandler</name>
<return-type>com.ats.apacs.server.DcmHandler</return-type>
</operation>
</mbean>
在使用dom4j修改xml文件信息之后,保存的xml文件丢失了"&defaultAttributes;,&defaultOperations;",
修改之后的xml文件如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mbean PUBLIC "-//JBoss//DTD JBOSS XMBEAN 1.1//EN" "http://www.jboss.org/j2ee/dtd/jboss_xmbean_1_1.dtd">
<mbean>
<attribute access="read-write" getMethod="getTLSConfigName" setMethod="setTLSConfigName">
<description>Used internally. Do NOT modify.</description>
<name>TLSConfigName</name>
<type>javax.management.ObjectName</type>
</attribute>
<!-- Operations -->
<operation impact="INFO">
<description>Get DICOM Handler</description>
<name>dcmHandler</name>
<return-type>com.ats.apacs.server.DcmHandler</return-type>
</operation>
</mbean>
求教在使用dom4j在对xml文件进行修改时候,如何保留原有的实体???
------解决方案--------------------&defaultAttributes; 加& 是标准的xml格式吗
------解决方案--------------------
没见过你说的这种格式。。“ &defaultOperations;”
你确定么