Jump to content
JasperReports Library 7.0 is now available ×

Complex XML as XMLDataSource for crosstab creation in iReport Designer


Recommended Posts

Hello Everyone,

I googled alot to find the solution of my problem I am going to discuss here but unfortunately there is not enough examples/documents on net or may be my time is not good. Any ways here is the problem statement:

I want to use a crosstab in ireport designer and there is an xml which will act as xmldatasource.

XML Structure is:

<hydraulicCylinders>
<hydraulicCylinder id="[[DX300LC-3]]_HC-Boom" type="HydraulicCylinder" code="[[DX300LC-3]]_HC-Boom" pk="8796093120513">
<name>Boom</name>
<stub>false</stub>
<measure qualifier="bore" value="140.0" unit="mm" raw="140.0 mm">5"</measure>
<measure qualifier="lengthClosed" value="2010.0" unit="mm" raw="2010.0 mm">6' 7"</measure>
<measure qualifier="rodDiameter" value="1450.0" unit="mm" raw="1450.0 mm">4' 9"</measure>
<measure qualifier="stroke" value="95.0" unit="mm" raw="95.0 mm">3"</measure>
<mediaAnnotations/>
<cushionHeadEnd>false</cushionHeadEnd>
<cushionRodEnd>true</cushionRodEnd>
<lengthClosed>2010.0</lengthClosed>
<quantity>2</quantity>
<rodDiameter>1450.0</rodDiameter>
<stroke>95.0</stroke>
</hydraulicCylinder>
<hydraulicCylinder id="[[DX300LC-3]]_HC-Arm" type="HydraulicCylinder" code="[[DX300LC-3]]_HC-Arm" pk="8796093153281">
<name>Arm</name>
<stub>false</stub>
<measure qualifier="bore" value="150.0" unit="mm" raw="150.0 mm">5"</measure>
<measure qualifier="lengthClosed" value="2270.0" unit="mm" raw="2270.0 mm">7' 5"</measure>
<measure qualifier="rodDiameter" value="1670.0" unit="mm" raw="1670.0 mm">5' 5"</measure>
<measure qualifier="stroke" value="105.0" unit="mm" raw="105.0 mm">4"</measure>
<mediaAnnotations/>
<cushionHeadEnd>true</cushionHeadEnd>
<cushionRodEnd>true</cushionRodEnd>
<lengthClosed>2270.0</lengthClosed>
<quantity>1</quantity>
<rodDiameter>1670.0</rodDiameter>
<stroke>105.0</stroke>
</hydraulicCylinder>
</hydraulicCylinders>
 
There can be any no of <hydraulicCylinder> tags within </hydraulicCylinders>.Thus the column headers will be dynamic. Hydraulic cyclinder are identifies uniquely by their name as Boom, Arm so on.
 
Now I want to create a report which will display data as below:
Here the values of bore, length closed, rod diameter and stroke should be read from <measure> and head end cushion from <cushionHeadEnd> and rod end cushion from <cushionRodEnd> respectively, quantity from <quantity> tag.

 

 

Boom

Arm

abc

xyz

Quantity

2

 

 

 

Make

 

 

 

 

Bore

123mm

 

 

 

Stroke

 

 

 

 

Rod Diameter

 

 

 

 

Length Closed

 

 

 

 

Head End Cushion

 

 

 

 

Rod End Cushion

 

 

 

 

 

I tried alot to achieve this but all my efforts gone in vain. I will really be thankful if someone can either guide me with steps on how i can achieve this or if possible can share the code.

Thanks in advance for all you support.

Best Wishes,

Pradeep Sharma

Link to comment
Share on other sites

  • 1 month later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...