Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

Customizing Content with XML: Dynamic News Application, 14 of 16

## 3 Combine News Items to Build a Document

The final step in personalizing content is converting XML documents into HTML pages according to end-user preferences.

The following code comes from `xmlnews.generation.SemiDynamicGenerate.dynamicProcessing`.

It retrieves the CLOBs corresponding to categories chosen by the user, converts each CLOB to an XML document, then combines them into one XML document. The process of converting the XML document to an HTML page is described in the next section.

    public XMLDocument semiDynamicProcessingXML(Connection p_conn, UserPreference p_
    prefs)
            throws Exception
     {
         String l_htmlString = null ;
         XMLDocument l_combinedXMLDocument = null ;
         XMLDocument[] l_XMLArray = new XMLDocument[p_prefs.m_categories.size()];
         int l_arrayIndex = 0 ;

         PreparedStatement l_selectStmt = p_conn.prepareStatement(
                      " SELECT PREGEN_XML FROM CATEGORIES_CLOB WHERE CATEGORY_ID =
    ?");
         // Process each preference.
         for ( ; l_arrayIndex < p_prefs.m_categories.size(); ++l_arrayIndex ){
           l_selectStmt.setString(1, p_prefs.m_categories.elementAt(l_
    arrayIndex).toString());
           OracleResultSet l_selectRst = (OracleResultSet)l_
    selectStmt.executeQuery();
           if (l_selectRst.next()) {
              CLOB l_clob = l_selectRst.getCLOB(1);
              l_XMLArray[l_arrayIndex] = convertFileToXML(l_clob.getAsciiStream());
           } else
              l_XMLArray[l_arrayIndex] = null ;
         }
         l_selectStmt.close();

         XMLDocHandler l_xmlHandler = new XMLDocHandler();
         l_combinedXMLDocument = l_xmlHandler.combineXMLDocunemts(l_XMLArray );
         return l_combinedXMLDocument ;
       }

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index