Article View: cn.bbs.comp.xml
Article #260xml��������������(ת)
From: <Test/>
Date: Sun, 08 Nov 2009 15:53
Date: Sun, 08 Nov 2009 15:53
78 lines
3438 bytes
3438 bytes
��xml�У����е���ݶ������ı�����ʽ����ʾ�����Ƕ�������ݲ���ֱ�����ı���ʽ����ʾ����xml������ô�����������ݵ��أ��������̽��һ�¡�
Ϊ�˼�ͨ���ԣ�xml����Ƴ������ı��ĸ�ʽ����ʾ��ݡ���xml�У����е���ݶ������ı��ĸ�ʽ���洢�����������Ҳ�����⡣��xml�У����������ҲҪ��������ı��ĸ�ʽ�����͵�Ŀ�ķ���Ŀ�ķ����յ�����ı�����������Ժ�������ͬ�Ľ����������Ӧ�Ķ�������ݣ���Ȼ���ԭ���ĸ�ʽ����Ƶȸ�����Ϣһ��Ҫ���������Ϣһ���͡�һ���������ݱ����BASE64��ʽ������ŵ����������ڱ���ͽ��룬ȱ���DZȴ��Ķ����ƶ�ռ��33%�Ĵ洢�ռ䡣
�����Ǿ���ij���ʵ�֣�
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.io.*" %>
<%
String ret=new String();
try{
InputStream in=new FileInputStream("c:\\aaa.doc");
byte[] bytes=new byte[in.available()];
in.read(bytes);
ret=new sun.misc.BASE64Encoder().encode(bytes); //����ı��뷽��
in.close();
}
catch(FileNotFoundException e) {
e.printStackTrace();
}
catch(java.io.IOException ex) {
ex.printStackTrace();
}
%>
ret�������Ľ������Ժ�Ϳ����ñ���xml��ʽ�����ˡ����͵�Ŀ�ķ��Ժ�Ҫ����ݽ�����Ӧ�Ľ��룬���ܵõ�ԭ���Ķ������ļ�������Ĵ������£�
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.io.*" %>
<%
byte[] bytes = new sun.misc.BASE64Decoder().decodeBuffer(ret);
java.io.ByteArrayInputStream inStream=new java.io.ByteArrayInputStream(bytes);
byte[] buffer =new byte[1444];
FileOutputStream fs=new FileOutputStream( "d:\\aaa.doc");
int bytesum=0;
int byteread=0;
while ((byteread=inStream.read(buffer))!=-1) {
bytesum+=byteread;
fs.write(buffer,0,byteread);
}
%>
BASE64���Դ��?̫�����ݣ����Ҫ�ƶ���������ݣ���Ҫ���ǿռ�/ʱ��Ч��ʱ��Ҫ��������������
--
[1;36mHappy XMLing
[m[1;34m�� ��Դ:��ˮľ���� newsmth.net��[FROM: 114.249.223.*][m
Technical Details
Message-ID:
<4iiIdH$FqV@newsmth.net>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!goblin2!goblin.stu.neva.ru!news.neu.edu.cn!www.shinco.com!news.newsmth.net!NEWSMTHShow Full Headers
Complete Article Headers
X-Google-Thread: f7ebf7e2af,b300bae9592a60c9,start X-Google-Attributes: gidf7ebf7e2af,public,usenet X-Google-NewGroupId: yes X-Google-Language: Chinese,GB Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!goblin2!goblin.stu.neva.ru!news.neu.edu.cn!www.shinco.com!news.newsmth.net!NEWSMTH From: thinkhy@newsmth.net-SPAM.no (<Test/>) Newsgroups: cn.bbs.comp.xml Subject: xml��������������(ת) Date: 08 Nov 2009 15:53:18 GMT Organization: ˮľ���� Message-ID: <4iiIdH$FqV@newsmth.net> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Filename: XML/U/M.1257695585.l0