Jump to content

Problem in Quering the XML


nitin403

Recommended Posts

Hi to All.

I trying to use XML as my datasource using iReport.

 

This is my source

Code:
<?xml version="1.0" encoding="UTF-8"?>
<MyReport>

<EvalData>
<Quarter>
<no>Q306</no>
<EvalValue>3</EvalValue>
<CommonValue>Text1</CommonValue>
</Quarter>

<Quarter>
<no>Q406</no>
<EvalValue>1</EvalValue>
<CommonValue>Text1</CommonValue>
</Quarter>

<Quarter>
<no>Q107</no>
<EvalValue>4</EvalValue>
<CommonValue>Text</CommonValue>
</Quarter>
</EvalData>

<QHighLight>

<HeaderQH hdrText="Created IC Calculates and rolled out to field">
<subHeader>We are posting personalized IC Calculators every month</subHeader>
</HeaderQH>


<HeaderQH hdrTest="Created SA(Sales Analysis) Reports and rolled out to field managers">
<subHeader>We are posting SA Reports every month</subHeader>
</HeaderQH>


<HeaderQH hdrTest="Created Personalized web homepages with all current and revelant IC documents">
<subHeader>Created personalized Viewer homepages where the reps get links</subHeader>
</HeaderQH>


<HeaderQH hrdtest="Reduced the proceeeing time for monthly processing">
<subHeader>Completing the non-payout month processing in just one week</subHeader>
</HeaderQH>


</QHighLight>

<OutlookNQ>

<Header1>2Deliver Budget Management and Plan Effectiveness Reports </Header1>
<Header1>1Create new IC Calculator Summary report and deliver the same in non</Header1>

</OutlookNQ>

<SynygyCI>
<Employee>
<Name>Schering-Plough</Name>
<Title>Healthcare Products</Title>
<Phone_Number>610-494-3300x2129</Phone_Number>
<Email_Add>proj129@synygy.com</Email_Add>
</Employee>

<Employee>
<Name>Divid Grossberg</Name>
<Title>Managing Consultant</Title>
<Phone_Number>610-494-3300x(7045)</Phone_Number>
<Email_Add>grossberg@synygy.com</Email_Add>
</Employee>
<Employee>
<Name>Peter Lamb</Name>
<Title>Managing Direntor</Title>
<Phone_Number>610-494-3300x(7656)</Phone_Number>
<Email_Add>lamb@synygy.com</Email_Add>
</Employee>
</SynygyCI>

<ccur>
<quarter no="1">
<Credit>210 </Credit>
<TC>180</TC>
</quarter>
<quarter no="2">
<Credit>190 </Credit>
<TC>160</TC>
</quarter>
<quarter no="3">
<Credit>175 </Credit>
<TC>155</TC>
</quarter>
</ccur>

</MyReport>

 

My JRXML files is

Code:
[code]<?xml version="1.0" encoding="UTF-8" ?>
<!-- Created with iReport - A designer for JasperReports -->
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport
name="QuarterHL"
columnCount="1"
printOrder="Vertical"
orientation="Portrait"
pageWidth="595"
pageHeight="842"
columnWidth="535"
columnSpacing="0"
leftMargin="30"
rightMargin="30"
topMargin="20"
bottomMargin="20"
whenNoDataType="NoPages"
isTitleNewPage="false"
isSummaryNewPage="false">
<property name="ireport.scriptlethandling" value="2" />
<property name="ireport.encoding" value="UTF-8" />
<import value="java.util.*" />
<import value="net.sf.jasperreports.engine.*" />
<import value="net.sf.jasperreports.engine.data.*" />

<queryString language="xPath"><![CDATA[/MyReport/QHighLight/HeaderQH]]></queryString>

<field name="hdrText" class="java.lang.String">
<fieldDescription><![CDATA[@hdrText]]></fieldDescription>
</field>
<field name="subHeader" class="java.lang.String">
<fieldDescription><![CDATA[subHeader]]></fieldDescription>
</field>

<background>
<band height="0" isSplitAllowed="true" >
</band>
</background>
<title>
<band height="50" isSplitAllowed="true" >
</band>
</title>
<pageHeader>
<band height="50" isSplitAllowed="true" >
</band>
</pageHeader>
<columnHeader>
<band height="30" isSplitAllowed="true" >
</band>
</columnHeader>
<detail>
<band height="100" isSplitAllowed="true" >
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="37"
y="10"
width="312"
height="26"
key="textField-1"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{hdrText}]]></textFieldExpression>
</textField>
<textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
x="37"
y="46"
width="311"
height="34"
key="textField-2"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{subHeader}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="30" isSplitAllowed="true" >
</band>
</columnFooter>
<pageFooter>
<band height="50" isSplitAllowed="true" >
</band>
</pageFooter>
<lastPageFooter>
<band height="50" isSplitAllowed="true" >
</band>
</lastPageFooter>
<summary>
<band height="50" isSplitAllowed="true" >
</band>
</summary>
</jasperReport>

 

Whenever I run this files it shows only the first value and the rest is show null.

I tried multiple combination's but none helped.

 

Can anybody help me.

And tell me where I am making the mistake.

Thanks for your help in advance.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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...