Jump to content
JasperReports Library 7.0 is now available ×

Parsing XML


JeffM

Recommended Posts

I have a report that for the most part is pretty simple. However I have run into a circumstance I have never dealt with before. 4 of the fields in my report come from a single database entry which contains formated XML. This field is used as a dictionary style catch all similar to a metadata style structure.

 

<ServiceMetadataHeader>

<f1/>

<f2/>

<f3/>

<f4/>

<f4/>

<f5>Data Sample 1</f5>

<f6/>

<f7>Data Sample 2</f7>

<f8>Data Sample 3</f8>

<f9>Data Sample 4</f9>

<f10/>

</ServiceMetadataHeader>

 

 

I need to create a report without deploying a new build due to internal reasons and thus would like to handel it within the compiled jasper report. Anyone have an experience on this one?

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Did you try to achieve it using scriptlet?

 

1)Add scriptlet with static methods extracting your stuff from xml

 

static String exractF5(String xml);

2)implement extraction using some XML parser

 

3)add variable f5 = Scriptlet.exractF5(serviceMetadataHeader);

 

Actually I didn't test it to work, just an idea

;)

Link to comment
Share on other sites

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