당신은 아마 기록에 루프
<queryString language="XPath">
<![CDATA[/records/record]]>
</queryString>
가를 정의하려면 당신의 XPath 쿼리가 될 수 있도록하고자 당신이 당신의 예에서 XPath 쿼리
을 기준으로하여 필드를 정의 할 특별한 설정은 없습니다 포인트 필드는이 fieldDescription
<field name="keywords" class="java.lang.String">
<fieldDescription><![CDATA[metadatas/keywords]]></fieldDescription>
</field>
를 사용 keywords
하기 이름은 임의적이며,이 클래스는 자바 값의 표현이고 fieldDescription 후,이 제 defining your data adapter 의해 달성된다 재스퍼 스튜디오에서 검색어 문자열에
재스퍼 스튜디오
관련 노드에 대해 경로 보고서 노드를 마우스 오른쪽 단추로 클릭하고 "데이터 집합 및 쿼리"를 선택하십시오. 대화 상자에서 데이터 어댑터를 선택하고 XPath는, 다음 필드로 추가 할 필드를 당신의 XPath 쿼리를 작성하고 클릭
전체 jrxml 예를
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="XMLTest" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b487729d-4510-4485-b838-19c491042208">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="XMLTest"/>
<queryString language="XPath">
<![CDATA[/records/record]]>
</queryString>
<field name="title" class="java.lang.String">
<fieldDescription><![CDATA[metadatas/title]]></fieldDescription>
</field>
<field name="description" class="java.lang.String">
<fieldDescription><![CDATA[metadatas/description]]></fieldDescription>
</field>
<field name="keywords" class="java.lang.String">
<fieldDescription><![CDATA[metadatas/keywords]]></fieldDescription>
</field>
<columnHeader>
<band height="20" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<staticText>
<reportElement x="0" y="0" width="170" height="20" uuid="3ce3004b-8324-4f57-ba9f-77cdffc711da"/>
<textElement verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[title]]></text>
</staticText>
<staticText>
<reportElement x="170" y="0" width="170" height="20" uuid="6ee7c571-ecdc-45cc-b11d-600099121301"/>
<textElement verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[description]]></text>
</staticText>
<staticText>
<reportElement x="340" y="0" width="210" height="20" uuid="111fa52f-bc0b-4698-8ba9-a7af03988254"/>
<textElement verticalAlignment="Middle">
<font isBold="true"/>
</textElement>
<text><![CDATA[keywords]]></text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="20" splitType="Stretch">
<property name="com.jaspersoft.studio.unit.height" value="pixel"/>
<textField>
<reportElement x="0" y="0" width="170" height="20" uuid="444010e8-18ce-4594-a1b1-ca3d120b091d"/>
<textElement verticalAlignment="Middle">
<font isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{title}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="170" y="0" width="170" height="20" uuid="9a27a707-c5df-4905-ac21-e42b21c1d77c"/>
<textElement verticalAlignment="Middle">
<font isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{description}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="340" y="0" width="210" height="20" uuid="1621de6d-7200-49aa-a0d4-56f64fec1b91"/>
<textElement verticalAlignment="Middle">
<font isBold="false"/>
</textElement>
<textFieldExpression><![CDATA[$F{keywords}]]></textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>
예 데이터 소스
<records>
<record>
<metadatas>
<title>first title</title>
<description>descriptions</description>
<keywords />
</metadatas>
</record>
<record>
<metadatas>
<title>second title</title>
<description>descriptions 2</description>
<keywords>test, hello</keywords>
</metadatas>
</record>
</records><records>
<record>
<metadatas>
<title>first title</title>
<description>descriptions</description>
<keywords />
</metadatas>
</record>
<record>
<metadatas>
<title>second title</title>
<description>descriptions 2</description>
<keywords>test, hello</keywords>
</metadatas>
</record>
</records>
출력
,351,
당신은 그 자체가 당신이 빈 텍스트 그냥 상대 textField
꽤 좋은 답변에
isBlankWhenNull="true"
을 설정 보여 드리고자 경우, 값이없는 노드null
을 보여줍니다하지만 내 문제는 내가 단지 가지고있다으로 한 번에 하나의 레코드지만 여러 레코드에 대한 레이블을 만들고 싶습니다. 현재 레코드에는 키워드가 없으므로 필드가 나타나지 않습니다. – Nicolas그런 다음 수동으로 추가 하시겠습니까? 필드 추가 또는 직접 jrxml로 –
그게 내가 무엇을 할거야, 난 다른 방법이 있다면 궁금 해서요 – Nicolas