You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Vilmantas Baranauskas <vi...@danet.de> on 2003/09/23 16:22:32 UTC

[digester] Namespace aware wildcard mathing

Hello,

I have a following situation using Digester. There is an XML file with 
two namespaces, e.g.:
<s:search>
   <f:form>
     <f:field />
     <f:field />
   </f:form>
</s:search>

I have such RuleSet with correct namespace for prefix "f:".
   digester.addFactoryCreate("*/form", new FormCreator());
   digester.addFactoryCreate("*/field", new FieldCreator());

Such wildcard matching doesn't match "field" element unless I specify it 
  together with "form" element like this:
   digester.addFactoryCreate("*/form", new FormCreator());
   digester.addFactoryCreate("*/form/field", new FieldCreator());

There was one mail on 18 Sep 2003 explaining that:
------------------
digester.setNamespaceUri("http://acme.com";);
digester.addObjectCreate("foo/bar/baz", ...)

means that the pattern will match:
* a baz element in the acme.com namespace ONLY, when inside
* a bar element in any namespace or no namespace, when inside
* a foo element in any namespace or no namespace.
------------------

So if it is like this, what is wrong in my case?

BTW, I use digester 1.5.

Thanks a lot!
Vilmantas


-- 
Vilmantas Baranauskas
Phone: +49-711/13353-47    FAX: +49-711/1335353
D A N E T GmbH, Waldburgstrasse 17 - 19, D-70563 Stuttgart
Email:   vilmantas.baranauskas@danet.de


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: [digester] Namespace aware wildcard mathing

Posted by Simon Kitching <si...@ecnetwork.co.nz>.
Hmm.. looks to me like it should work.

If you post a runnable example, I would be willing to have a look.

You could also turn up digester logging, and see if you can spot the
problem yourself. Placing the following two files in the classpath
should do the trick:

filename: commons-logging.properties

org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog

filename: simplelog.properties
 org.apache.commons.logging.simplelog.defaultlog=debug 

This will turn on debug-level logging inside the Digester, resulting in
plenty of diagnostic output...

Regards,

Simon

On Wed, 2003-09-24 at 02:22, Vilmantas Baranauskas wrote:
> Hello,
> 
> I have a following situation using Digester. There is an XML file with 
> two namespaces, e.g.:
> <s:search>
>    <f:form>
>      <f:field />
>      <f:field />
>    </f:form>
> </s:search>
> 
> I have such RuleSet with correct namespace for prefix "f:".
>    digester.addFactoryCreate("*/form", new FormCreator());
>    digester.addFactoryCreate("*/field", new FieldCreator());
> 
> Such wildcard matching doesn't match "field" element unless I specify it 
>   together with "form" element like this:
>    digester.addFactoryCreate("*/form", new FormCreator());
>    digester.addFactoryCreate("*/form/field", new FieldCreator());
> 
> There was one mail on 18 Sep 2003 explaining that:
> ------------------
> digester.setNamespaceUri("http://acme.com";);
> digester.addObjectCreate("foo/bar/baz", ...)
> 
> means that the pattern will match:
> * a baz element in the acme.com namespace ONLY, when inside
> * a bar element in any namespace or no namespace, when inside
> * a foo element in any namespace or no namespace.
> ------------------
> 
> So if it is like this, what is wrong in my case?
> 
> BTW, I use digester 1.5.
> 
> Thanks a lot!
> Vilmantas
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org