net.sf.jasperreports.engine.data
Class JaxenXmlDataSource

java.lang.Object
  extended by net.sf.jasperreports.engine.data.JRAbstractTextDataSource
      extended by net.sf.jasperreports.engine.data.AbstractXmlDataSource
          extended by net.sf.jasperreports.engine.data.JaxenXmlDataSource
All Implemented Interfaces:
JRDataSource, JRRewindableDataSource

public class JaxenXmlDataSource
extends AbstractXmlDataSource

Version:
$Id: JaxenXmlDataSource.java 5180 2012-03-29 13:23:12Z teodord $
Author:
Narcis Marcu (narcism@users.sourceforge.net)

Constructor Summary
JaxenXmlDataSource(org.w3c.dom.Document document)
          Creates the data source by parsing the xml document from the given file.
JaxenXmlDataSource(org.w3c.dom.Document document, java.lang.String selectExpression)
          Creates the data source by parsing the xml document from the given file.
JaxenXmlDataSource(java.io.File file)
          Creates the data source by parsing the xml document from the given file.
JaxenXmlDataSource(java.io.File file, java.lang.String selectExpression)
          Creates the data source by parsing the xml document from the given file.
JaxenXmlDataSource(java.io.InputStream in)
          Creates the data source by parsing the xml document from the given input stream.
JaxenXmlDataSource(java.io.InputStream in, java.lang.String selectExpression)
          Creates the data source by parsing the xml document from the given input stream.
JaxenXmlDataSource(java.lang.String uri)
          Creates the data source by parsing the xml document from the given system identifier (URI).
JaxenXmlDataSource(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
 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

JaxenXmlDataSource

public JaxenXmlDataSource(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

JaxenXmlDataSource

public JaxenXmlDataSource(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

JaxenXmlDataSource

public JaxenXmlDataSource(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)

JaxenXmlDataSource

public JaxenXmlDataSource(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)

JaxenXmlDataSource

public JaxenXmlDataSource(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)

JaxenXmlDataSource

public JaxenXmlDataSource(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)

JaxenXmlDataSource

public JaxenXmlDataSource(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)

JaxenXmlDataSource

public JaxenXmlDataSource(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