Create() 공개 메소드

Registers parsers specified in the (recommended, Spring.NET standard) parsers config section with the NamespaceParserRegistry.
public Create ( object parent, object configContext, XmlNode section ) : object
parent object /// The configuration settings in a corresponding parent /// configuration section. ///
configContext object /// The configuration context when called from the ASP.NET /// configuration system. Otherwise, this parameter is reserved and /// is . ///
section System.Xml.XmlNode /// The for the section. ///
리턴 object
		public void ParseSectionWithNoChildParserNamespaceElements()
		{
			const string xml = @"<?xml version='1.0' encoding='UTF-8' ?>
<parsers>
	<!-- now't in here -->
</parsers>";

			NamespaceParsersSectionHandler handler = new NamespaceParsersSectionHandler();
			handler.Create(null, null, BuildConfigurationSection(xml));
		}
		public void ParseSectionWithBadTypeForHandler()
		{
			const string xml = @"<?xml version='1.0' encoding='UTF-8' ?>
<parsers>
	<parser namespace='http://schemas.springframework.net/2' type='Rubbish' schemaLocation='assembly://Spring.Core.Tests/Spring.Context.Support/testobject.xsd'/>
</parsers>";

			NamespaceParsersSectionHandler handler = new NamespaceParsersSectionHandler();
			handler.Create(null, null, BuildConfigurationSection(xml));
		}
		public void ParseSectionWithHandlerThatDoesNotImplement_IXmlObjectDefinitionParser()
		{
			const string xml = @"<?xml version='1.0' encoding='UTF-8' ?>
<parsers>
	<parser namespace='http://schemas.springframework.net/2' type='Spring.Context.Support.NamespaceParsersSectionHandlerTests, Spring.Core.Tests' schemaLocation='assembly://Spring.Core.Tests/Spring.Context.Support/testobject.xsd'/>
</parsers>";

			NamespaceParsersSectionHandler handler = new NamespaceParsersSectionHandler();
			handler.Create(null, null, BuildConfigurationSection(xml));
		}
예제 #4
0
        public void ParseSectionWithEmptyType()
        {
            const string xml = @"<?xml version='1.0' encoding='UTF-8' ?>
<parsers>
	<parser namespace='http://schemas.springframework.net/3' type='' schemaLocation='assembly://Spring.Core.Tests/Spring.Context.Support/testobject.xsd'/>
</parsers>";

            NamespaceParsersSectionHandler handler = new NamespaceParsersSectionHandler();

            handler.Create(null, null, BuildConfigurationSection(xml));
        }
예제 #5
0
        public void ParseSectionWithNoChildParserNamespaceElements()
        {
            const string xml = @"<?xml version='1.0' encoding='UTF-8' ?>
<parsers>
	<!-- now't in here -->
</parsers>";

            NamespaceParsersSectionHandler handler = new NamespaceParsersSectionHandler();

            handler.Create(null, null, BuildConfigurationSection(xml));
        }
예제 #6
0
        public void ParseSectionWithHandlerThatDoesNotImplement_IXmlObjectDefinitionParser()
        {
            const string xml = @"<?xml version='1.0' encoding='UTF-8' ?>
<parsers>
	<parser namespace='http://schemas.springframework.net/2' type='Spring.Context.Support.NamespaceParsersSectionHandlerTests, Spring.Core.Tests' schemaLocation='assembly://Spring.Core.Tests/Spring.Context.Support/testobject.xsd'/>
</parsers>";

            NamespaceParsersSectionHandler handler = new NamespaceParsersSectionHandler();

            handler.Create(null, null, BuildConfigurationSection(xml));
        }
예제 #7
0
        public void WithParserElementThatIsMissingTheTypeAttribute()
        {
            const string xml = @"<?xml version='1.0' encoding='UTF-8' ?>
<parsers>
	<parser namespace='http://schemas.springframework.net/3'/>
</parsers>";

            NamespaceParsersSectionHandler handler = new NamespaceParsersSectionHandler();

            handler.Create(null, null, BuildConfigurationSection(xml));
        }
예제 #8
0
        public void ParseSectionWithBadTypeForHandler()
        {
            const string xml = @"<?xml version='1.0' encoding='UTF-8' ?>
<parsers>
	<parser namespace='http://schemas.springframework.net/2' type='Rubbish' schemaLocation='assembly://Spring.Core.Tests/Spring.Context.Support/testobject.xsd'/>
</parsers>";

            NamespaceParsersSectionHandler handler = new NamespaceParsersSectionHandler();

            Assert.Throws <TypeLoadException>(() => handler.Create(null, null, BuildConfigurationSection(xml)));
        }
		public void WithParserElementThatIsMissingTheTypeAttribute()
		{
			const string xml = @"<?xml version='1.0' encoding='UTF-8' ?>
<parsers>
	<parser namespace='http://schemas.springframework.net/3'/>
</parsers>";

			NamespaceParsersSectionHandler handler = new NamespaceParsersSectionHandler();
			handler.Create(null, null, BuildConfigurationSection(xml));
		}
		public void ParseSectionWithEmptyType()
		{
			const string xml = @"<?xml version='1.0' encoding='UTF-8' ?>
<parsers>
	<parser namespace='http://schemas.springframework.net/3' type='' schemaLocation='assembly://Spring.Core.Tests/Spring.Context.Support/testobject.xsd'/>
</parsers>";

			NamespaceParsersSectionHandler handler = new NamespaceParsersSectionHandler();
			Assert.Throws<ArgumentNullException>(() => handler.Create(null, null, BuildConfigurationSection(xml)));
		}