XML is text file , you can only insert into vector graphics described with XML as a node of your xml file . you can't insert into photograph based bin file.
其实把图片保存在xml文档中的关键不在于dom4j图片要保存在xml文档中,需要把图片转化为base64编码,且生成的xml文件必然会很大转化方法: try { // Convert a byte array to base64 string byte[] buf = 需要的图片转化为byte[];用字节流读之类的方法 String s = new sun.misc.BASE64Encoder().encode(buf);
// Convert base64 string to a byte array buf = new sun.misc.BASE64Decoder().decodeBuffer(s); } catch (IOException e) { }
try {
// Convert a byte array to base64 string
byte[] buf = 需要的图片转化为byte[];用字节流读之类的方法
String s = new sun.misc.BASE64Encoder().encode(buf);
// Convert base64 string to a byte array
buf = new sun.misc.BASE64Decoder().decodeBuffer(s);
} catch (IOException e) {
}