cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "roy huang" <lingererhu...@hotmail.com>
Subject Is a bug or just a rule?
Date Thu, 25 Mar 2004 08:51:44 GMT
I ever posted a help about Database action error.I found the result now.
I use a xml file to store several configuration include database-action's descriptor.I wrote
a transformer to get different configuration xml from this big xml file(I don't think it is
a good way now :)).the xml file likes:
<root>
    <config1>
        ....
    </config1>
    <config2>
        ...
    </config2>
<root>
I want the separate xml configuration looks like:
<config1>
  ...
</config1>
So in my transformer,I wrote code like:
 public void startElement(
  String uri,
  String name,
  String raw,
  Attributes attributes)
  throws  SAXException {
    if (!name.equals("root") //if it's root,Ignore it.
    super.startElement(uri, name, raw, attributes);
    ....
  }

and the same in  endElement.

If I use in common way like:
   <map:match pattern="define_data.xml">
    <map:generate src="config.xml" />   
    <map:transform type="my-trasnformer">
     <map:parameter name="type" value="data" />
    </map:transform>
    <map:serialize type="xml" />
   </map:match>
It looks fine.
But if I use as 
   <map:match pattern="*-add">
    <map:act type="mod-db-add">
     <map:parameter name="descriptor" value="cocoon:/define_data.xml" />
     <map:parameter name="table-set" value="default" />
    </map:act>
   </map:match>
It will fail to get the xml configuration,like:
Original Exception: org.apache.avalon.framework.configuration.ConfigurationException: Error
trying to load configurations for resource: cocoon://gtt/apps/app1/forms/test/define_data.xml
at org.apache.cocoon.acting.AbstractComplementaryConfigurableAction.getConfiguration(AbstractComplementaryConfigurableAction.java:102)
at org.apache.cocoon.acting.modular.DatabaseAction.act(DatabaseAction.java:614)

I add println in the transformer and found after the root element is ignore,none element will
be processed in this condition.This wouldn't happen in the upper way.
I change my code not to Ignore the root element it's all fine.
What border me is why the pipeline act differently in these two method?The transformer ever
worked fine in both method,so I believe some code was changed.
Is a bug or just I can't ignore the root element while the xml be using as a config?
Mime
View raw message