net.sf.jasperreports.engine.data

## Class XalanXmlDataSource

- java.lang.Object
- - net.sf.jasperreports.engine.data.JRAbstractTextDataSource
  - - net.sf.jasperreports.engine.data.AbstractXmlDataSource
    - - net.sf.jasperreports.engine.data.XalanXmlDataSource

- All Implemented Interfaces:
    JRDataSource, JRRewindableDataSource

      public class XalanXmlDataSource
      extends AbstractXmlDataSource

  Version:
    $Id: XalanXmlDataSource.java 5878 2013-01-07 20:23:13Z teodord $
  Author:
    Narcis Marcu (narcism@users.sourceforge.net)

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XalanXmlDataSource(org.w3c.dom.Document document)` Creates the data source by parsing the xml document from the given file.
    `XalanXmlDataSource(org.w3c.dom.Document document, java.lang.String selectExpression)` Creates the data source by parsing the xml document from the given file.
    `XalanXmlDataSource(java.io.File file)` Creates the data source by parsing the xml document from the given file.
    `XalanXmlDataSource(java.io.File file, java.lang.String selectExpression)` Creates the data source by parsing the xml document from the given file.
    `XalanXmlDataSource(java.io.InputStream in)` Creates the data source by parsing the xml document from the given input stream.
    `XalanXmlDataSource(java.io.InputStream in, java.lang.String selectExpression)` Creates the data source by parsing the xml document from the given input stream.
    `XalanXmlDataSource(java.lang.String uri)` Creates the data source by parsing the xml document from the given system identifier (URI).
    `XalanXmlDataSource(java.lang.String uri, java.lang.String selectExpression)` Creates the data source by parsing the xml document from the given system identifier (URI).

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `AbstractXmlDataSource` | `dataSource(java.lang.String selectExpr)` Creates a sub data source using as root document the document used by "this" data source.
    `org.w3c.dom.Node` | `getCurrentNode()`
    `java.lang.Object` | `getSelectObject(org.w3c.dom.Node currentNode, java.lang.String expression)`
    `void` | `moveFirst()` Moves back to the first element in the data source.
    `boolean` | `next()` Tries to position the cursor on the next element in the data source.
    `void` | `setDetectXmlNamespaces(boolean detectXmlNamespaces)`
    `void` | `setDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory)`
    `void` | `setXmlNamespaceMap(java.util.Map<java.lang.String,java.lang.String> xmlNamespaceMap)`
    `AbstractXmlDataSource` | `subDataSource(java.lang.String selectExpr)` Creates a sub data source using the current node (record) as the root of the document.
    `org.w3c.dom.Document` | `subDocument()` Creates a document using the current node as root.

    - ### Methods inherited from class net.sf.jasperreports.engine.data.AbstractXmlDataSource

      `dataSource, getFieldValue, getText, subDataSource`

    - ### Methods inherited from class net.sf.jasperreports.engine.data.JRAbstractTextDataSource

      `convertNumber, convertStringValue, getConvertBean, getDatePattern, getFormattedDate, getFormattedNumber, getLocale, getNumberPattern, getTimeZone, setDatePattern, setLocale, setLocale, setNumberPattern, setTextAttributes, setTimeZone, setTimeZone`

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

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

- - ### Constructor Detail

    - #### XalanXmlDataSource

          public XalanXmlDataSource(org.w3c.dom.Document document)
                             throws JRException

      Creates the data source by parsing the xml document from the given file. The data source will contain exactly one record consisting of the document node itself.
      Parameters:
        `document` - the document
      Throws:
        `JRException` - if the data source cannot be created

    - #### XalanXmlDataSource

          public XalanXmlDataSource(org.w3c.dom.Document document,
                            java.lang.String selectExpression)
                             throws JRException

      Creates the data source by parsing the xml document from the given file. An additional XPath expression specifies the select criteria that produces the nodes (records) for the data source.
      Parameters:
        `document` - the document
        `selectExpression` - the XPath select expression
      Throws:
        `JRException` - if the data source cannot be created

    - #### XalanXmlDataSource

          public XalanXmlDataSource(java.io.InputStream in)
                             throws JRException

      Creates the data source by parsing the xml document from the given input stream.
      Parameters:
        `in` - the input stream
      Throws:
        `JRException`
      See Also:
        `JRXmlDataSource.JRXmlDataSource(Document)`

    - #### XalanXmlDataSource

          public XalanXmlDataSource(java.io.InputStream in,
                            java.lang.String selectExpression)
                             throws JRException

      Creates the data source by parsing the xml document from the given input stream.
      Throws:
        `JRException`
      See Also:
        `JRXmlDataSource.JRXmlDataSource(InputStream)`, `JRXmlDataSource.JRXmlDataSource(Document, String)`

    - #### XalanXmlDataSource

          public XalanXmlDataSource(java.lang.String uri)
                             throws JRException

      Creates the data source by parsing the xml document from the given system identifier (URI).

      If the system identifier is a URL, it must be full resolved.

      Parameters:
        `uri` - the system identifier
      Throws:
        `JRException`
      See Also:
        `JRXmlDataSource.JRXmlDataSource(Document)`

    - #### XalanXmlDataSource

          public XalanXmlDataSource(java.lang.String uri,
                            java.lang.String selectExpression)
                             throws JRException

      Creates the data source by parsing the xml document from the given system identifier (URI).
      Throws:
        `JRException`
      See Also:
        `JRXmlDataSource.JRXmlDataSource(String)`, `JRXmlDataSource.JRXmlDataSource(Document, String)`

    - #### XalanXmlDataSource

          public XalanXmlDataSource(java.io.File file)
                             throws JRException

      Creates the data source by parsing the xml document from the given file.
      Parameters:
        `file` - the file
      Throws:
        `JRException`
      See Also:
        `JRXmlDataSource.JRXmlDataSource(Document)`

    - #### XalanXmlDataSource

          public XalanXmlDataSource(java.io.File file,
                            java.lang.String selectExpression)
                             throws JRException

      Creates the data source by parsing the xml document from the given file.
      Throws:
        `JRException`
      See Also:
        `JRXmlDataSource.JRXmlDataSource(File)`, `JRXmlDataSource.JRXmlDataSource(Document, String)`

  - ### Method Detail

    - #### moveFirst

          public void moveFirst()
                         throws JRException

      Description copied from interface: `JRRewindableDataSource`
      Moves back to the first element in the data source.
      Throws:
        `JRException`

    - #### next

          public boolean next()
                       throws JRException

      Description copied from interface: `JRDataSource`
      Tries to position the cursor on the next element in the data source.
      Returns:
        true if there is a next record, false otherwise
      Throws:
        `JRException` - if any error occurs while trying to move to the next element

    - #### subDocument

          public org.w3c.dom.Document subDocument()
                                           throws JRException

      Description copied from class: `AbstractXmlDataSource`
      Creates a document using the current node as root.
      Specified by:
        `subDocument` in class `AbstractXmlDataSource`
      Returns:
        a document having the current node as root
      Throws:
        `JRException`

    - #### setXmlNamespaceMap

          public void setXmlNamespaceMap(java.util.Map<java.lang.String,java.lang.String> xmlNamespaceMap)
                                  throws JRException

      Throws:
        `JRException`

    - #### setDetectXmlNamespaces

          public void setDetectXmlNamespaces(boolean detectXmlNamespaces)

    - #### setDocumentBuilderFactory

          public void setDocumentBuilderFactory(javax.xml.parsers.DocumentBuilderFactory documentBuilderFactory)

    - #### getCurrentNode

          public org.w3c.dom.Node getCurrentNode()

      Specified by:
        `getCurrentNode` in class `AbstractXmlDataSource`

    - #### getSelectObject

          public java.lang.Object getSelectObject(org.w3c.dom.Node currentNode,
                                         java.lang.String expression)
                                           throws JRException

      Specified by:
        `getSelectObject` in class `AbstractXmlDataSource`
      Throws:
        `JRException`

    - #### subDataSource

          public AbstractXmlDataSource subDataSource(java.lang.String selectExpr)
                                              throws JRException

      Description copied from class: `AbstractXmlDataSource`
      Creates a sub data source using the current node (record) as the root of the document. An additional XPath expression specifies the select criteria applied to this new document and that produces the nodes (records) for the data source.
      Specified by:
        `subDataSource` in class `AbstractXmlDataSource`
      Parameters:
        `selectExpr` - the XPath select expression
      Returns:
        the xml sub data source
      Throws:
        `JRException` - if the sub data source couldn't be created
      See Also:
        `JRXmlDataSource.JRXmlDataSource(Document, String)`

    - #### dataSource

          public AbstractXmlDataSource dataSource(java.lang.String selectExpr)
                                           throws JRException

      Description copied from class: `AbstractXmlDataSource`
      Creates a sub data source using as root document the document used by "this" data source. An additional XPath expression specifies the select criteria applied to this document and that produces the nodes (records) for the data source.
      Specified by:
        `dataSource` in class `AbstractXmlDataSource`
      Parameters:
        `selectExpr` - the XPath select expression
      Returns:
        the xml sub data source
      Throws:
        `JRException` - if the sub data source couldn't be created
      See Also:
        `JRXmlDataSource.JRXmlDataSource(Document, String)`

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com