Spring.net customer namespace parser
Posted
by ListenToRick
on Stack Overflow
See other posts from Stack Overflow
or by ListenToRick
Published on 2009-08-18T12:27:48Z
Indexed on
2010/04/19
22:03 UTC
Read the original article
Hit count: 208
namespaceparse
|spring.net
I have a customer parser which looks like this:
[NamespaceParser(
Namespace = "http://mysite/schema/cache",
SchemaLocationAssemblyHint = typeof(CacheNamespaceParser ),
SchemaLocation = "/cache.xsd"
)
]
public class CacheNamespaceParser : NamespaceParserSupport
{
public override void Init()
{
RegisterObjectDefinitionParser("cache", new CacheParser ());
}
}
public class CacheParser : AbstractSimpleObjectDefinitionParser
{
protected override Type GetObjectType(XmlElement element)
{
return typeof(CacheDefinition);
}
protected override void DoParse(XmlElement element, ObjectDefinitionBuilder builder)
{
}
protected override bool ShouldGenerateIdAsFallback
{
get { return true; }
}
}
in the web config i have the following configuration....
<spring>
<parsers>
<parser type="Spring.Data.Config.DatabaseNamespaceParser, Spring.Data"/>
<parser type="App.Web.CacheNamespaceParser, WebApp" />
</parsers>
When I run the project I get the following error:
An error occurred creating the configuration section handler for spring/parsers: Invalid resource name. Name has to be in 'assembly:<assemblyName>/<namespace>/<resourceName>' format.
I put a break point in the CacheNamespaceParser init method and it is called.
If I remove from the web config all is well!
Any ideas whats wrong
© Stack Overflow or respective owner