Hi Warrell,

 

You're right that this might be overkill, but I am talking about
multiple xml files of which some contain more than 10.000 lines of xml.
So we're talking about deeply nested xml trees here.  And you can
imagine that sometimes the xpath expressions become verbose. Also it's
not always very easy to retrieve the correct information at the correct
time of processing.   This is probably due to the way the xml is
organized.  But I don't think it's an option for the customer on short
notice to restructure the xml so it's a lot easier to process.

 

I did make a quick prototype and used XStream to create my java
objects... The idea was then to only output the needed data using
jxtemplate generator so it would take minimal xslt work to achieve the
result for the different publications

 

But the xml schema was not up-to-date  and there were too much
"AnyElement" 's in the schema so I will abandon this road.

 

Thx for sharing your ideas.

 

Robby

 

From: warrell harries [mailto:[email protected]] 
Sent: donderdag 5 februari 2009 17:21
To: [email protected]
Subject: Re: mapping xml 2 java using cocoon (block)

 

Hi Robby,

 

Cocoon is about keeping your application model in XML and then
transforming this document model using Java components. It looks like
you want to use it the other way around. That is to say, you would get
further with Cocoon if you intend to transform Product XML elements to
XHTML. Reading your requirement it seems to me that you don't need your
Java Product object as you just need to use the File Generator to read
your Product XML and then you use this to transform to XHTML. If you
need to add to the Product XML you might need to employ some other
Transformer or Pipeline but try and forget about your Product Java
object as it seems to be superfluous.

 

Hope this helps,

 

Warrell

2009/1/29 Robby Pelssers <[email protected]>

Hi all,

 

I have a project where I want to read xml from the filesystem and
unmarshall to Java.

 

Suppose I have a request 

http://localhost:8888/myproject/product/xyz-123    

where xyz-123 is the product-id.  

 

Based on this information cocoon I know where to read the product-xml
from the filesystem.  I would like to map the xml now to my Product
Object.  However, the product-xml contains a reference to for instance a
file containing company information.

 

So I would like this information to be loaded as well.  Anyone done
something similar already?  Is using Castor an easy option to accomplish
this or are there easier ways.

 

Thx in advance.

Robby Pelssers

 

 

 

 

 

 

 

 

Reply via email to