可以的,用base64将图片文件转为二进制编码,然后存进XML

解决方案 »

  1.   

    以前做过的一段对XML中图片的处理,这只是接收到的XML的图片处理,给于参考!跟楼上说的一样的方法!DocumentBuilderFactory dbfOne=DocumentBuilderFactory.newInstance();
    DocumentBuilder dbOne = null;
    InputStream IStream = null;

    try
    {
    dbOne = dbfOne.newDocumentBuilder();
    IStream = (InputStream)this.m_hsrRequest.getInputStream();
    Document doc = dbOne.parse(IStream); Element ordersRoot = doc.getDocumentElement();
    NodeList nlOne1 = ordersRoot.getChildNodes();
    NodeList nlOne2 = nlOne1.item(3).getChildNodes();
    // 获得参数
    NodeList nlOne3 = nlOne1.item(0).getChildNodes();
    String ss =  nlOne3.item(0).getNodeValue();

    String[] a1= CCustomString.Split(ss,'?');
    String[] a2 = CCustomString.Split(a1[1],'&');
    String[] a21 = CCustomString.Split(a2 [1],'=');
    sRegisterID = a21[1];
    String[] a22 = CCustomString.Split(a2 [2],'=');
    sExamNo = a22[1];
    String[] a23 = CCustomString.Split(a2 [3],'=');
    sIdentyCard = a23[1];
    String[] a24 = CCustomString.Split(a2 [4],'=');
    sExamerName = a24[1];

    byte [] result = new byte[nlOne2.item(0).getNodeValue().length()];
    result = new BASE64Decoder().decodeBuffer(nlOne2.item(0).getNodeValue());
      

  2.   

    result的内容是图片的二进制流,前面的分解,要根据你做的XML的结构!