[jdom-interest] JDOM as a Database API?

Gerardo Horvilleur mago at mail.internet.com.mx
Mon Sep 4 23:39:07 PDT 2000


Jason Hunter wrote:
> 
> There's ResultSetBuilder in jdom-contrib that's similar to this.  One
> could imagine writing a corresponding Outputter.

What I have in mind is something like this:

    // Create employees database
    Element employeesRoot = new Element("employees");
    Document employess = new Document(employeesRoot);

    // Create new employee
    Element employee = new Element("employee");
    employee.addAttribute("fistname", "John");
    employee.addAttribute("lastname", "Smith");
    employee.addAttribute("age", "31");
    // Note: all of the above could be sub-elements instead of attributes

    // Add employee to employees database
    employees.addContent(employee);

You wouldn't need to use any Builder or Outputter. As soon as an element is added
to a document it is automatically stored into the database.
-- 

Gerardo Horvilleur
mago at mail.internet.com.mx



More information about the jdom-interest mailing list