cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josema Alonso" <>
Subject Re: XMLForm Xindice Howto added to Wiki [please, att. Ivelin]
Date Sat, 25 Jan 2003 02:04:06 GMT

I'm trying to code your suggestions but I have problems and some doubts.

> 1) You can remove ArtistBean altogether

> 2) Store the empty id structure in a static file or local constant

> 3) Override the getForm() method in the action
Wouldn't it be enough to override the getFormModel() method?
Something like this:
  protected Object getFormModel() {
 //to load the XML model
 Container DOMModel = null;
 Source modelSrc = null;
   //this parameter holds the name of the xml file with the empty XML
    String modelFileName = getParameters().getParameter("xmlform-model",
    if(modelFileName==null) return null;
    try {
     modelSrc = getSourceResolver().resolveURI(modelFileName);
  DOMModel = new XMLDocumentContainer(new
        return DOMModel;
      catch ( Exception e) {
        throw new CascadingRuntimeException( " Failed instantiating form
model ", e );
      finally {

> 4) Use the JXPath DOMContainer to load the xml file(constant)
I have used XMLDocumentContainer. I see there's a DocumentContainer but only
present in JXPath 1.1 alpha and the jar file is still not included in
Cocoon, so I used the soon to be deprecated mentioned.
Btw, how could I extract a DOMNode from the root or an XML String so I could
store the whole structure afterwards? I see in 1.1alpha I could do something
like 'DocumentContainer.MODEL_DOM' but I guess in 1.0 I should get a
JXPathContext and search for the root node so I can get the String I need.
Am I right?

> 5) Use the DOMContainer object as the Form model
Ok. But where should I store it? In a separate file like the ArtistBean I
got before?
Or maybe would be enough to declare it and initialize it in the getForm() or
getFormModel() method?

> 6) When you need to reference a node in the model, instead of using the
> API, you can directly use XPath,
> like this: getForm().getValue("/@id")
At this stage I can only see the form and when trying to access the model I
get the following exception: 'Cannot setValue of an object that is not some
other object's property/child'

Sorry about all the questions but this is totally new for me and it is not


Please check that your question  has not already been answered in the
FAQ before posting.     <>

To unsubscribe, e-mail:     <>
For additional commands, e-mail:   <>

View raw message