<%@ page contentType="application/xml" import="java.sql.*" %>
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ; %>
<?xml version="1.0"?>
<publishers>
<%
Connection connection = DriverManager.getConnection(
"jdbc:odbc:data", "YourName", "password");
Statement statement = connection.createStatement() ;
ResultSet resultset = statement.executeQuery("select name, id from Publishers");%>
<%
while(resultset.next()){
%>
<publisher>
<<%=resultset.getMetaData().getColumnName(1)%>>
<%
String s = resultset.getString(1);
int index = s.indexOf("&");
StringBuffer sb = new StringBuffer(s);
if(index > 0){
sb.replace(index, index + 1, "and");
}
out.println(sb);
%>
</<%=resultset.getMetaData().getColumnName(1)%>>
<<%=resultset.getMetaData().getColumnName(2)%>>
<%= resultset.getString(2) %>
</<%=resultset.getMetaData().getColumnName(2)%>>
</publisher>
<%
}
%>
</publishers>