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
Best Answer
Its look like attributes parameter SchemaLocation is wrong. Try something like this:
It have to work if your cache.xsd is in the root of assembly.