1: …… 2: // 외부로 부터 입력을 받음 3: String name = props.getProperty("name" ); 4: Hashtable env = new Hashtable(); 5: env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); 6: env.put(Context.PROVIDER_URL, "ldap://localhost:389/o=rootDir"); 7: javax.naming.directory.DirContext ctx = new InitialDirContext(env); 8: javax.xml.xquery.XQDataSource xqds = 9: (javax.xml.xquery.XQDataSource) ctx.lookup("xqj/personnel"); 10: javax.xml.xquery.XQConnection conn = xqds.getConnection(); 11: 12: String es = "doc('users.xml')/userlist/user[uname='" + name + "']"; 13: // 입력값이 Xquery의 인자로 사용 14: XQPreparedExpression expr = conn.prepareExpression(es); 15: XQResultSequence result = expr.executeQuery(); 16: while (result.next()) { 17: String str = result.getAtomicValue(); 18: if (str.indexOf('>') < 0) { 19: System.out.println(str); 20: } 21: ……