sven.waibel Posted May 11, 2007 Share Posted May 11, 2007 Hi,i got following xml: Code:<a> <b name="1" /> <b name="2" /> <b name="3" /></a> In my document it should be this way:Code:[code]Name: 1 2 3My problem is, i got always 1 resp. selected one (XPATH: a/b/@name or a/b[2]/@name). Is there a kind of for-each or something similar? Thanks a lotSven Post edited by: sven.waibel, at: 2007/05/11 08:54Post edited by: sven.waibel, at: 2007/05/11 09:23 Link to comment Share on other sites More sharing options...
Case1182 Posted May 11, 2007 Share Posted May 11, 2007 What are u trying to do here? What kind of function or output are u looking for? Link to comment Share on other sites More sharing options...
sven.waibel Posted May 11, 2007 Author Share Posted May 11, 2007 I want to list all "names", that's all.I think i have to take sub reports, but at the moment i have no glue. Link to comment Share on other sites More sharing options...
Case1182 Posted May 11, 2007 Share Posted May 11, 2007 if u are using jasper this is the xml <field name="Ur field goes here" class="java.lang.String"/> <textFieldExpression class="java.lang.String"><![CDATA[$F{Ur field goes here}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="##0.00" isBlankWhenNull="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="74" y="5" width="74" height="20" key="textField"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font/> </textElement> but u do have to setop the rest of the document and this would go in the details band.Post edited by: Case1182, at: 2007/05/11 14:35 Link to comment Share on other sites More sharing options...
sven.waibel Posted May 14, 2007 Author Share Posted May 14, 2007 "Ur field goes here" that's the important part, the rest i have already.What is the right expression to get 1,2,3? a/b/@name => 1 just 12 and 3 are missingPost edited by: sven.waibel, at: 2007/05/14 08:19 Link to comment Share on other sites More sharing options...
Case1182 Posted May 14, 2007 Share Posted May 14, 2007 if u have already created ur connection to the database and table in the database, "Ur field goes here" is the column name in the table, but be sure it matches exactly, it is case sensitive. Link to comment Share on other sites More sharing options...
sven.waibel Posted May 14, 2007 Author Share Posted May 14, 2007 My database is a xml file, so have to use XPATH! Link to comment Share on other sites More sharing options...
sven.waibel Posted May 15, 2007 Author Share Posted May 15, 2007 I solved it.You have to create a subreport and have to set the source path expression to the needed element.In my case: /a/b in the report:field description: @name that's itPost edited by: sven.waibel, at: 2007/05/15 08:54 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now