java.io.IOException: The markup in the document preceding the root element must be well-formed.
at bibliothek.util.xml.XIO.read(XIO.java:233) ~[dockingFramesCore.jar:na]
at bibliothek.util.xml.XIO.read(XIO.java:114) ~[dockingFramesCore.jar:na]
at com.mt.core.DockingContentView.mergePerspective(DockingContentView.java:390) ~[CFETS_Common/:na]
at com.mt.core.ContentViewMainFrame.mergePerspective(ContentViewMainFrame.java:83) [CFETS_Common/:na]
at com.mt.core.MainFrame.mergePerspective_PL(MainFrame.java:883) [CFETS_Common/:na]
at com.mt.core.MainFrame.restoreInitPerspective(MainFrame.java:771) [CFETS_Common/:na]
at com.mt.core.PSItem.initPS(PSItem.java:174) [CFETS_Common/:na]
at com.mt.core.PSItem.access$000(PSItem.java:22) [CFETS_Common/:na]
at com.mt.core.PSItem$1.actionPerformed(PSItem.java:100) [CFETS_Common/:na]
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995) [na:1.6.0_26]
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318) [na:1.6.0_26]
...............................................................................
@Override
public void forkPerspective(String name) {
forkPerspective(name, LocalStore.getLoginUserPath());
}
@Override
public void forkPerspective(String name, String path) {
try {
logger.info("??????:{}...", name);
CControlPerspective ccp = control.getPerspectives();
if (ccp != null) {
CPerspective cp = ccp.getPerspective(name);
if (cp != null) {
File pFile = new File(path);
if(!pFile.exists()){
pFile.mkdirs();
}
XElement xElement = new XElement(name);
ccp.writeXML(xElement, cp);
XIO.write(xElement, new FileOutputStream(new File(path + "/" + name + ".ps")), "UTF-8");
logger.info("??????:{}??", name);
} else {
logger.error("CPerspective==null");
}
} else {
logger.error("CControlPerspective==null");
}
} catch (Throwable t) {
logger.error("??????????", t);
}
}
@Override
public void mergePerspective(String name) {
try {
logger.info("??????:{}...", name);
CControlPerspective ccp = control.getPerspectives();
if (ccp != null) {
FileInputStream in = null;
if (mainFrame.isPDefPerspective(name + MainFrame.PerspectiveLabelName)) {
in = new FileInputStream(new File(MainFrame.PDefPerspectivePath + "/" + name + ".ps"));
} else {
in = new FileInputStream(new File(LocalStore.getLoginUserPath() + "/" + name + ".ps"));
}
XElement xElement = XIO.read(in, "UTF-8");
CPerspective cp = ccp.readXML(xElement);
ccp.setPerspective(xElement.getName(), cp);
this.control.load(xElement.getName());
logger.info("??????:{}??", name);
} else {
logger.error("CControlPerspective==null");
}
} catch (Throwable t) {
logger.error("??????????", t);
}
}
only forkPerspective function export XML ,mergePerspective function import XML.
but Sometimes read XML appear Exception, XML has been destroyed.