我不喜欢灌水的人。。。。。。
给大家点有关jox方面的。。。。^_^刚学习的哦。。请多包含哦
jox是一套用户xml document.和java beans之间进行数据传递的java类库。
一个简单直接的jox实例:
jox是非常的简单易用。假设你现在已经有了下面的java bean。
package com.wutka.jox.test;
import com.wutka.jox.*;
import java.util.*;
public class testbean implements java.io.serializable
{
protected int foo;
protected string bar;
protected java.util.date baz;
protected vector thingies;
protected testsubbean subbean;
public testbean()
{
bar = "";
baz = new date();
thingies = new vector();
}
public int getfoo() { return foo; }
public void setfoo(int afoo) { foo = afoo; }
public string getbar() { return bar; }
public void setbar(string abar) { bar = abar; }
public java.util.date getbaz() { return baz; }
public void setbaz(java.util.date abaz) { baz = abaz; }
public testsubbean getsub() { return subbean; }
public void setsub(testsubbean asub) { subbean = asub; }
public string[] getthingies()
{
string[] retthingies = new string[thingies.size()];
if (thingies.size() > 0) thingies.copyinto(retthingies);
return retthingies;
}
public void setthingies(string[] newthingies)
{
thingies = new vector(newthingies.length);
for (int i=0; i < newthingies.length; i++)
{
thingies.addelement(newthingies[i]);
}
}
public string getthingies(int i)
{
return (string) thingies.elementat(i);
}
public void setthingies(int i, string thingy)
{
thingies.setelementat(thingy, i);
}
public string tostring()
{
stringbuffer ret = new stringbuffer(
"foo="+foo+";bar="+bar+";baz="+baz.tostring()+
";thingies=");
for (int i=0; i < thingies.size(); i++)
{
if (i > 0) ret.append(",");
ret.append((string) thingies.elementat(i));
}
ret.append(";sub=");
ret.append(subbean.tostring());
return ret.tostring();
}
}
并且你已创建了下面的 xml 文件:
<?xml version="1.0"?>
<marktest>
<thingies>moe</thingies>
<thingies>larry</thingies>
<thingies>curly</thingies>
<thingies>shemp</thingies>
<thingies>curly joe</thingies>
<foo>5</foo>
<baz>6/25/00 12:46 am</baz>
<bar>this is the bar value</bar>
<sub>
<age>35</age>
<name>mark</name>
</sub>
</marktest>
<?xml version="1.0" encoding="iso-8859-1"?>
<!element marktest (thingies*, foo?, bar?, baz? s-u-b?)>
<!element thingies #pcdata>
<!element foo #pcdata>
<!element bar #pcdata>
<!element baz #pcdata>
<!element s-u-b (age)>
<!element age #pcdata>
<!attlist s-u-b name cdata "">
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器