You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Schachter, Michael" <MS...@Bluestone.com> on 2000/12/14 00:26:15 UTC
DTD Validation
Hi,
I have a question about using a DTD to validate struts-config.xml
Using a DTD for config file validation kind of breaks the added
functionality of using custom attributes for action mappings (see example).
Is this intentional?
Example (snippet from struts-config.xml)
<action-mappings>
<action path="/something"
type="something.SomeAction"
myAttribute="somethingAlso"/>
</action-mappings>
This throws a parser error due to the presence of a DTD. I apologize if
this was already discussed, if it was please kindly let me know.
Re: DTD Validation
Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
"Schachter, Michael" wrote:
> Hi,
>
> I have a question about using a DTD to validate struts-config.xml
>
> Using a DTD for config file validation kind of breaks the added
> functionality of using custom attributes for action mappings (see example).
> Is this intentional?
>
> Example (snippet from struts-config.xml)
>
> <action-mappings>
> <action path="/something"
> type="something.SomeAction"
> myAttribute="somethingAlso"/>
>
> </action-mappings>
>
> This throws a parser error due to the presence of a DTD. I apologize if
> this was already discussed, if it was please kindly let me know.
I'm not sure it has been.
The replacement mechanism is to use a nested <set-property> element:
<action path="/something" type="something.SomeAction">
<set-property property="myAttribute" value="somethingAlso"/>
</action>
All of the configuration elements that can usefully be subclassed support a
nested <set-property> element: <data-source>, <forward>, and <action>.
Craig