Package net.sf.jasperreports.xalan.data
Class XalanXmlDataSource
java.lang.Object
net.sf.jasperreports.engine.data.JRAbstractTextDataSource
net.sf.jasperreports.engine.data.AbstractXmlDataSource<XalanXmlDataSource>
net.sf.jasperreports.xalan.data.XalanXmlDataSource
- All Implemented Interfaces:
HierarchicalDataSource<XalanXmlDataSource>,RandomAccessDataSource,JRDataSource,JRRewindableDataSource
- Author:
- Narcis Marcu (narcism@users.sourceforge.net)
-
Field Summary
Fields inherited from class net.sf.jasperreports.engine.data.AbstractXmlDataSource
PROPERTY_FIELD_EXPRESSIONFields inherited from class net.sf.jasperreports.engine.data.JRAbstractTextDataSource
EXCEPTION_MESSAGE_KEY_CANNOT_CONVERT_FIELD_TYPE, EXCEPTION_MESSAGE_KEY_CANNOT_MODIFY_PROPERTIES_AFTER_START, EXCEPTION_MESSAGE_KEY_NODE_NOT_AVAILABLE, EXCEPTION_MESSAGE_KEY_NULL_DOCUMENT, EXCEPTION_MESSAGE_KEY_NULL_SELECT_EXPRESSION, EXCEPTION_MESSAGE_KEY_UNKNOWN_COLUMN_NAME, EXCEPTION_MESSAGE_KEY_UNKNOWN_NUMBER_TYPE -
Constructor Summary
ConstructorsConstructorDescriptionXalanXmlDataSource(File file) Creates the data source by parsing the xml document from the given file.XalanXmlDataSource(File file, String selectExpression) Creates the data source by parsing the xml document from the given file.Creates the data source by parsing the xml document from the given input stream.XalanXmlDataSource(InputStream in, String selectExpression) Creates the data source by parsing the xml document from the given input stream.XalanXmlDataSource(String uri) Creates the data source by parsing the xml document from the given system identifier (URI).XalanXmlDataSource(String uri, String selectExpression) Creates the data source by parsing the xml document from the given system identifier (URI).XalanXmlDataSource(Document document) Creates the data source by parsing the xml document from the given file.XalanXmlDataSource(Document document, String selectExpression) Creates the data source by parsing the xml document from the given file. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidintdataSource(String selectExpr) Creates a sub data source using as root document the document used by "this" data source.Access the document that this data source is based on.getSelectObject(Node currentNode, String expression) voidMoves back to the first element in the data source.voidmoveToRecord(int index) booleannext()Tries to position the cursor on the next element in the data source.intvoidsetDetectXmlNamespaces(boolean detectXmlNamespaces) voidsetDocumentBuilderFactory(DocumentBuilderFactory documentBuilderFactory) voidsetXmlNamespaceMap(Map<String, String> xmlNamespaceMap) subDataSource(String selectExpr) Creates a sub data source using the current node (record) as the root of the document.Creates a document using the current node as root.Methods inherited from class net.sf.jasperreports.engine.data.AbstractXmlDataSource
dataSource, getFieldExpression, getFieldValue, getText, subDataSourceMethods inherited from class net.sf.jasperreports.engine.data.JRAbstractTextDataSource
convertNumber, convertStringValue, getConvertBean, getDatePattern, getLocale, getNumberPattern, getTextAttributes, getTimeZone, setDatePattern, setLocale, setLocale, setNumberPattern, setTextAttributes, setTextAttributes, setTimeZone, setTimeZone
-
Constructor Details
-
XalanXmlDataSource
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
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 documentselectExpression- the XPath select expression- Throws:
JRException- if the data source cannot be created
-
XalanXmlDataSource
Creates the data source by parsing the xml document from the given input stream.- Parameters:
in- the input stream- Throws:
JRException- See Also:
-
XalanXmlDataSource
Creates the data source by parsing the xml document from the given input stream.- Throws:
JRException- See Also:
-
XalanXmlDataSource
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:
-
XalanXmlDataSource
Creates the data source by parsing the xml document from the given system identifier (URI).- Throws:
JRException- See Also:
-
XalanXmlDataSource
Creates the data source by parsing the xml document from the given file.- Parameters:
file- the file- Throws:
JRException- See Also:
-
XalanXmlDataSource
Creates the data source by parsing the xml document from the given file.- Throws:
JRException- See Also:
-
-
Method Details
-
getDocument
Description copied from class:AbstractXmlDataSourceAccess the document that this data source is based on.- Overrides:
getDocumentin classAbstractXmlDataSource<XalanXmlDataSource>- Returns:
- the document used by this data source
-
moveFirst
Description copied from interface:JRRewindableDataSourceMoves back to the first element in the data source.- Throws:
JRException
-
checkMoveFirst
- Throws:
JRException
-
next
Description copied from interface:JRDataSourceTries 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
-
recordCount
- Throws:
JRException
-
currentIndex
public int currentIndex() -
moveToRecord
- Throws:
JRException
-
subDocument
Description copied from class:AbstractXmlDataSourceCreates a document using the current node as root.- Specified by:
subDocumentin classAbstractXmlDataSource<XalanXmlDataSource>- Returns:
- a document having the current node as root
- Throws:
JRException
-
setXmlNamespaceMap
- Throws:
JRException
-
setDetectXmlNamespaces
public void setDetectXmlNamespaces(boolean detectXmlNamespaces) -
setDocumentBuilderFactory
-
getCurrentNode
- Specified by:
getCurrentNodein classAbstractXmlDataSource<XalanXmlDataSource>
-
getSelectObject
- Specified by:
getSelectObjectin classAbstractXmlDataSource<XalanXmlDataSource>- Throws:
JRException
-
subDataSource
Description copied from class:AbstractXmlDataSourceCreates 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:
subDataSourcein interfaceHierarchicalDataSource<XalanXmlDataSource>- Specified by:
subDataSourcein classAbstractXmlDataSource<XalanXmlDataSource>- 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:
-
dataSource
Description copied from class:AbstractXmlDataSourceCreates 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:
dataSourcein classAbstractXmlDataSource<XalanXmlDataSource>- 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:
-