Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.4.0)

E10653-05

oracle.jbo.server.xml
Class XmlRowSetRenderer

java.lang.Object
  extended by oracle.jbo.server.xml.XmlRowSetRenderer

public class XmlRowSetRenderer
extends java.lang.Object

The XmlRowSetRenderer class renders a canonical XML representation for the rows of an oracle.jbo.RowSet. Since oracle.jbo.ViewObject implements RowSet, XmlRowSetRenderer can be used on any RowSet or View Object.

XmlRowSetRenderer renders a canonical XML representation by iterating through the attribute defs for the initial "root" RowSet you specify when you instantiate it (or set via setRowSet()). It produces equivalent XML tags for each scalar attribute. When XmlRowSetRenderer detects that an attribute is a "nested RowSet", it recurses to print the nested XML for the nested RowSet. The result is an XML "tree" of elements, reflecting the deep data print of all the rows in the root RowSet, along with any nested (View Linked) detail information.

Optionally, the setStyleSheet method lets you transform the results of XmlRowSetRenderer according to an XSLT stylesheet.

You instantiate XmlRowSetRenderer by declaring:

 XmlRowSetRenderer xrr = new XmlRowSetRenderer(rowset);
 

To retrieve the resulting XML Document (optionally transformed by the stylesheet you've set) as an in-memory XML Document, call getXMLDocument()

To print the resulting XML Document (optionally transformed by the stylesheet you've set) to a PrintWriter, call print()

By using custom properties, you can customize your XML output without having to edit your Java classes.

If you have a View Object attribute value that contains characters requiring quotes, such as less-than (<) or ampersand (&), XmlRowSetRenderer lets you treat it as an XML CDATA section. Within a CDATA section, you can omit quotes from characters that would otherwise require it. To treat an attribute value as a CDATA section, add a custom property to your View Object Attribute named CDATA with a value equal to "Y".


Constructor Summary
XmlRowSetRenderer()
           
XmlRowSetRenderer(RowSet root)
           
 
Method Summary
 Document getXMLDocument()
          Retrieve in-memory XML Document for data in root rowset plus its detail rowsets.
 void print(java.io.PrintWriter out)
          Print the XML results to a PrintWriter
 void setMaxRows(int val)
          Set the maximum number of master Rows to render
 void setRowSet(RowSet root)
          Set the RowSet to be used for XML rendering.
 void setRowSetTag(java.lang.String tag)
          Override the default XML Element name to be used for the entire RowSet.
 void setRowTag(java.lang.String tag)
          Override the default XML Element name to be used for each Row in each rowset.
 void setStylesheet(XSLStylesheet transform)
          Set the XSLStylesheet to use for (optional) transformation
 void setStylesheet(XSLStylesheet transform, java.net.URL baseURL)
          Set the XSLStylesheet to use for (optional) transformation
 void setStylesheetParam(java.lang.String name, java.lang.String value)
          Set the XSL Stylesheet parameter to value to literal string.
 void setStylesheetParamXPath(java.lang.String name, java.lang.String value)
          Set the XSL Stylesheet parameter to value of an XPath expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRowSetRenderer

public XmlRowSetRenderer()

XmlRowSetRenderer

public XmlRowSetRenderer(RowSet root)
Method Detail

setRowSetTag

public void setRowSetTag(java.lang.String tag)
Override the default XML Element name to be used for the entire RowSet. Default is "RowSet".

Parameters:
tag - XML Element name for rowset

setRowTag

public void setRowTag(java.lang.String tag)
Override the default XML Element name to be used for each Row in each rowset. Default is to use the name of the ViewObject.

Parameters:
tag - XML Element name for each Row.

setRowSet

public void setRowSet(RowSet root)
Set the RowSet to be used for XML rendering.

Parameters:
root - Root RowSet

getXMLDocument

public Document getXMLDocument()
Retrieve in-memory XML Document for data in root rowset plus its detail rowsets.


setStylesheetParam

public void setStylesheetParam(java.lang.String name,
                               java.lang.String value)
Set the XSL Stylesheet parameter to value to literal string.

Parameters:
name - Parameter name.
value - Parameter value.

setStylesheetParamXPath

public void setStylesheetParamXPath(java.lang.String name,
                                    java.lang.String value)
Set the XSL Stylesheet parameter to value of an XPath expression.

Parameters:
name - Parameter name.
value - XPath Expression to evaluate as parameter value.

setStylesheet

public void setStylesheet(XSLStylesheet transform)
Set the XSLStylesheet to use for (optional) transformation


setStylesheet

public void setStylesheet(XSLStylesheet transform,
                          java.net.URL baseURL)
Set the XSLStylesheet to use for (optional) transformation


setMaxRows

public void setMaxRows(int val)
Set the maximum number of master Rows to render


print

public void print(java.io.PrintWriter out)
           throws java.lang.Exception
Print the XML results to a PrintWriter

Throws:
java.lang.Exception

Oracle Fusion Middleware Java API Reference for Oracle ADF Model
11g Release 1 (11.1.1.4.0)

E10653-05

Copyright © 1997, 2011, Oracle. All rights reserved.