RegisterParser() public static method

Pegisters parser, using default namespace and schema location as defined by the NamespaceParserAttribute.
/// If is . ///
public static RegisterParser ( INamespaceParser parser ) : void
parser INamespaceParser /// The parser instance. ///
return void
        public void CanLoadSchemaImportingOtherSchemaByRelativePath()
        {
            string schemaLocation = TestResourceLoader.GetAssemblyResourceUri(this.GetType(), "NamespaceParserRegistryTests_TestSchema.xsd");

            NamespaceParserRegistry.RegisterParser(new TestNamespaceParser(), "http://www.example.com/brief", schemaLocation);
            XmlReader vr = XmlUtils.CreateValidatingReader(new StringResource(
                                                               @"<?xml version='1.0' encoding='UTF-8' ?>
                            <brief class='foo' />
                            ").InputStream, NamespaceParserRegistry.GetSchemas(), null);
            ConfigXmlDocument newDoc = new ConfigXmlDocument();

            newDoc.Load(vr);
        }
 public void RegisterParserWithEmptyNamespaceWithoutDefaultValues()
 {
     NamespaceParserRegistry.RegisterParser(
         typeof(NotImplementedXmlObjectDefinitionParser), string.Empty, null);
 }
 public void RegisterParserWithBadParserType()
 {
     NamespaceParserRegistry.RegisterParser(GetType());
 }
 public void RegisterParserWithNullType()
 {
     NamespaceParserRegistry.RegisterParser((Type)null);
 }
示例#5
0
 public void RegisterParserWithEmptyNamespaceWithoutDefaultValues()
 {
     Assert.Throws <ArgumentNullException>(() => NamespaceParserRegistry.RegisterParser(typeof(NotImplementedXmlObjectDefinitionParser), string.Empty, null));
 }
示例#6
0
 public void RegisterParserWithBadParserType()
 {
     Assert.Throws <ArgumentException>(() => NamespaceParserRegistry.RegisterParser(GetType()));
 }
示例#7
0
 public void RegisterParserWithNullType()
 {
     Assert.Throws <ArgumentNullException>(() => NamespaceParserRegistry.RegisterParser((Type)null));
 }