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_EXPRESSION
Fields 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 void
int
dataSource
(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) void
Moves back to the first element in the data source.void
moveToRecord
(int index) boolean
next()
Tries to position the cursor on the next element in the data source.int
void
setDetectXmlNamespaces
(boolean detectXmlNamespaces) void
setDocumentBuilderFactory
(DocumentBuilderFactory documentBuilderFactory) void
setXmlNamespaceMap
(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, subDataSource
Methods 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:AbstractXmlDataSource
Access the document that this data source is based on.- Overrides:
getDocument
in classAbstractXmlDataSource<XalanXmlDataSource>
- Returns:
- the document used by this data source
-
moveFirst
Description copied from interface:JRRewindableDataSource
Moves back to the first element in the data source.- Throws:
JRException
-
checkMoveFirst
- Throws:
JRException
-
next
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
-
recordCount
- Throws:
JRException
-
currentIndex
public int currentIndex() -
moveToRecord
- Throws:
JRException
-
subDocument
Description copied from class:AbstractXmlDataSource
Creates a document using the current node as root.- Specified by:
subDocument
in 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:
getCurrentNode
in classAbstractXmlDataSource<XalanXmlDataSource>
-
getSelectObject
- Specified by:
getSelectObject
in classAbstractXmlDataSource<XalanXmlDataSource>
- Throws:
JRException
-
subDataSource
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 interfaceHierarchicalDataSource<XalanXmlDataSource>
- Specified by:
subDataSource
in 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: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 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:
-