commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: [digester] validating against system dtd?
Date Fri, 19 Sep 2003 01:14:12 GMT
On Fri, 19 Sep 2003, Matthijs Wensveen wrote:

> Date: Fri, 19 Sep 2003 00:55:42 +0200
> From: Matthijs Wensveen <>
> Reply-To: Jakarta Commons Users List <>
> To: Jakarta Commons Users List <>
> Subject: Re: [digester] validating against system dtd?
> I have a similar problem, but maybe a bit more complex.
> The XML I want to digest consists of elements defined in one or more
> namespaces. For example:
> <cfg:configuration cfg:xmlns="..">
>     <p:properties name="myProps">
>         <p:property key="key1" value="value1" />
>         <p:property key="key2" value="value2" />
>     </p:properties>
>     <cp:connectionpool>
>         <cp:db... etc....
>     </cp:connectionpool>
> <cfg:configuration>
> Is there a way to validate each namespace separately. Because for each
> application we use different xml with similar elements, this would be
> very useful. Maybe this is a question for another (more xml specific)
> mailing list, at least I couldn't find anything useful on the net.
> If the answer includes separating the validation process from the rest
> that's fine (maybe even better so I can turn validation on or off).

Digester knows how to deal with namespaces, but you need to tell it to do
so.  Basically, that means calling setNamespaceAware(true) and then making
sure that your rules are associated with the appropriate namespace URi.
Examples of this are in the Digester API Javadocs (see the Package
Description for the org.apache.commons.digester package)

Scroll down to the section on "Namespace Aware Parsing".

> Regards,
> Matthijs.


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

View raw message