de.vc.report.sources.xml

## Class XMLDataSource

- java.lang.Object
- - de.vc.report.DataSource
  - - de.vc.report.sources.xml.XMLDataSource

-     public class XMLDataSource
      extends DataSource

  Data source from XML.
  Please look at our examples to learn more about xml as datasource. There is also a DTD "report-data-set.dtd".

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLDataSource(java.io.InputStream source)` Creates a new data source from xml.
    `XMLDataSource(java.lang.String xmlFile)` Creates a new data source from xml.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `deliver(ReportData data)` Use this callback method within deliverData() to build a report with given data.
    `protected void` | `deliverData()`
    `protected org.apache.commons.logging.Log` | `getLogger()` Gets the logger as set in de.vc.report.env.Environment.
    `boolean` | `isIgnoreForeignNodes()` Returns true if foreign XML nodes are ignored, otherwise an error is logged.
    `void` | `setIgnoreForeignNodes(boolean ignoreForeignNodes)` Sets wether foreigner XML nodes are ignored when parsing XML.

    - ### Methods inherited from class de.vc.report.DataSource

      `getDataCount`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XMLDataSource

          public XMLDataSource(java.io.InputStream source)

      Creates a new data source from xml.
      Parameters:
        `source` - XML stream.

    - #### XMLDataSource

          public XMLDataSource(java.lang.String xmlFile)
                        throws java.io.IOException

      Creates a new data source from xml.
      Parameters:
        `xmlFile` - XML file.
      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### deliver

          protected void deliver(ReportData data)
                          throws ReportException

      Use this callback method within deliverData() to build a report with given data.
      Overrides:
        `deliver` in class `DataSource`
      Parameters:
        `data` - ReportData.
      Throws:
        `ReportException`

    - #### deliverData

          protected void deliverData()
                              throws ReportException

      Specified by:
        `deliverData` in class `DataSource`
      Throws:
        `ReportException`

    - #### getLogger

          protected org.apache.commons.logging.Log getLogger()

      Gets the logger as set in de.vc.report.env.Environment.
      Overrides:
        `getLogger` in class `DataSource`
      Returns:
        Logger.

    - #### isIgnoreForeignNodes

          public boolean isIgnoreForeignNodes()

      Returns true if foreign XML nodes are ignored, otherwise an error is logged.
      Returns:
        true if foreign XML nodes are ignored (default is false).

    - #### setIgnoreForeignNodes

          public void setIgnoreForeignNodes(boolean ignoreForeignNodes)

      Sets wether foreigner XML nodes are ignored when parsing XML. If this feature is enabled you migt not use the <report-data-set> tag as the root of the data set. Furthermore the report XML nodes can be contained/wrapped by foreign XML nodes. An example for ignoring foreigned tags is class `ReportMixedXMLSource.java` in our example directory.
      Parameters:
        `ignoreForeignNodes` - true if foreign XML nodes are ignored.

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.