[Previous slide] [Next slide] Moving to XML

Add further elements recursively as required

            // match the pattern against the convenience view and pull
            // back the rows that match as namespaces
            Contexts events =
                TableDescriptor.getDescriptor( VIEW, null, 
                                               context ).match( pattern );

            Enumeration e = events.elements(  );

            // and pass each of those namespaces in turn to my event element 
            // generator to generate children for my element
            while ( e.hasMoreElements(  ) )
                content.appendChild( eventEltGenerator.generate( doc,
                        (Context) e.nextElement(  ) ) );
      

This is a bit of a cheat. It depends on having a view in the database which collects together all the necessary fields for us:

---- EVENTS_VIEW -----------------------------------------------------

CREATE VIEW events_view AS
     SELECT EVENT.Actor,
            EVENT.Event,
            CATEGORY.Description AS Type,
            LOCATION.Description AS Location,
            EVENT.Eventdate,
            EVENT.Starttime,
            EVENT.Endtime,
            EVENT.Description
       FROM EVENT,
            CATEGORY,
            LOCATION
      WHERE EVENT.Location = LOCATION.Location
        AND EVENT.Category = CATEGORY.Category
   ORDER BY Eventdate,Starttime
;