xml 传图片问题(急,在线等)
我数据库图片放的是blob字段,取出来后,要让进xml 通过webservice传到客户端,客户端在解析。服务端和客户端怎么写!
是这样取出来的
while(rs.next())
{
Blob pic = rs.getBlob("LICENSE_PIC");
}
以什么形式存在xml中,并且在解析出来!
字节转字符 字符转字节
字符和字节之间的转换
怎么做呢?Blob pic = rs.getBlob("LICENSE_PIC");
String str = "";
if(pic != null)
{
try {
InputStream in = pic.getBinaryStream();
System.out.println(in);
byte[] bt = new byte[1024];
int len=in.read(bt,0,1024);
str=new String(bt,0,len);
in.close();
} catch (Exception e) {
e.printStackTrace();
}
row.addAttribute("LICENSE_PIC",str);
}
但是xml报错
Exception in thread "main" org.dom4j.DocumentException: Error on line 2 of document : Character reference "�" is an invalid XML character. Nested exception: Character reference "�" is an invalid XML character.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.dom4j.DocumentHelper.parseText(DocumentHelper.java:278)
at com.webservice.LicenseCompanyService.main(License
相关问答:
txt 和XML 格式相应
不借助DataSet
导入读取TXT文件
然后直接写入XML(同一文件,不同数据,递增原数据没有被覆盖情况下增加数据.)
教个要点或最好是有个代码提示的
过路好汉 帮个忙撒^^
不会,帮楼主 ......
我想要一個通用的xml轉DataTable,xml文件來自不同的文檔,
例如:excel文檔另存為xml文檔怎么把這個xml文檔轉換成DataSet、DataTable ......
有这样一段由.net生成的xml(由dataset转化而来):
<NewDataSet> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata=& ......
今天遇到一个问题,把xml中的值装到.txt格式的文件中。
我目前想到两种比较笨的方法:1.可以通过xmlspy编辑工具实现
2.通过把xml转成Javabean,然后转到excel中,再从新保存重命名为. ......
如题,有没有这样的php代码。我现在想将excel的内容插入mysql数据库,希望可以将excel转成xml,然后解析xml插入数据库中。如果有这样的代码,甚至是有名的代码,一定要告诉我啊。
先读 excel => 然后生成 xml = ......