你如何嵌入XML二进制数据? [英] How do you embed binary data in XML?

查看:233
本文介绍了你如何嵌入XML二进制数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Java编写的两种应用是通过网络互相使用XML消息进行通信。我使用的是SAX解析器在接收端来获取数据背出的消息。其中一个要求是在XML消息中嵌入二进制数据,但SAX不喜欢这一点。有谁知道如何做到这一点?

I have two applications written in Java that communicate with each other using XML messages over the network. I'm using a SAX parser at the receiving end to get the data back out of the messages. One of the requirements is to embed binary data in an XML message, but SAX doesn't like this. Does anyone know how to do this?

更新:我得到这个与<工作href=\"http://commons.apache.org/$c$cc/apidocs/org/apache/commons/$c$cc/binary/Base64.html\">Base64从 Apache的百科全书codeC库类,如果任何人试图类似的东西。

UPDATE: I got this working with the Base64 class from the apache commons codec library, in case anyone else is trying something similar.

推荐答案

您可以连接code使用Base64,放入一个Base64元素中的二进制数据;下面的文章是关​​于这一主题的pretty不错。

You could encode the binary data using base64 and put it into a Base64 element; the below article is a pretty good one on the subject.

XML文档处理二进制数据

这篇关于你如何嵌入XML二进制数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆