Jump to content
We've recently updated our Privacy Statement, available here ×

JRXMLDataSource determining current node name


2004 IR Help

Recommended Posts

By: Michal Kostrzewa - mkostrzewa

JRXMLDataSource determining current node name

2005-06-16 05:42

Hi all,

Is there a way to determine the current node name? Let's assume the report contains of rows <-> XML nodes of different type and we want to customize look of the row based on this type. Note that fields with XPath like "name(.)" doesn't not work here, because XPath has to return node set, not string.

If there is no such method - what about the patch below?

(patch to JRXmlDataSource from jasper 0.6.7)

 

best regards,

Michal Kostrzewa

 

--- /home/mkostrze/tmp/jasperreports-0.6.7/src/net/sf/jasperreports/engine/data/JRXmlDataSource.java 2005-05-03 11:37:40.000000000 +0200

+++ /home/mkostrze/install/jasperreports-0.6.7/src/net/sf/jasperreports/engine/data/JRXmlDataSource.java 2005-06-16 14:29:28.695379312 +0200

@@ -338,13 +338,17 @@

}

 

if (node != null) {

- String text = getText(node);

-

- if(text != null) {

- if(String.class == valueClass)

- value = text;

- else

- value = ConvertUtils.convert(text.trim(), valueClass);

+ if (Node.class == valueClass)

+ value = node;

+ else{

+ String text = getText(node);

+

+ if(text != null) {

+ if(String.class == valueClass)

+ value = text;

+ else

+ value = ConvertUtils.convert(text.trim(), valueClass);

+ }

}

}

}

 

 

 

 

 

By: Michal Kostrzewa - mkostrzewa

RE: JRXMLDataSource determining current node name

2005-06-16 05:43

OK, the patch is not quite readable from here, I'll add it to patch section on sourceforge

Michal Kostrzewa

Link to comment
Share on other sites

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