GetParser() public static method

Returns a parser for the given namespace.
public static GetParser ( string namespaceURI ) : INamespaceParser
namespaceURI string /// The namespace for which to lookup the parser implementation. ///
return INamespaceParser
Beispiel #1
0
        public void AutoRegistersAllWellknownNamespaceParsers_3_0()
        {
            string[] namespaces = { "http://www.springframework.net/wcf" };

            foreach (string ns in namespaces)
            {
                Assert.IsNotNull(NamespaceParserRegistry.GetParser(ns),
                                 string.Format("Parser for Namespace {0} could not be auto-registered.", ns));
            }
        }
        /// <summary>
        /// Parses an element in a custom namespace.
        /// </summary>
        /// <param name="ele"></param>
        /// <param name="containingDefinition">if a nested element, the containing object definition</param>
        /// <returns>the parsed object definition or null if not supported by the corresponding parser.</returns>
        public IObjectDefinition ParseCustomElement(XmlElement ele, IObjectDefinition containingDefinition)
        {
            String           namespaceUri = ele.NamespaceURI;
            INamespaceParser handler      = NamespaceParserRegistry.GetParser(namespaceUri);

            if (handler == null)
            {
                Error("Unable to locate Spring NamespaceHandler for XML schema namespace [" + namespaceUri + "]", ele);
                return(null);
            }
            return(handler.ParseElement(ele, new ParserContext(this, containingDefinition)));
        }
Beispiel #3
0
        public void AutoRegistersAllWellknownNamespaceParsers_Common()
        {
            string[] namespaces =
            {
                "http://www.springframework.net/tx",
                "http://www.springframework.net/aop",
                "http://www.springframework.net/db",
                "http://www.springframework.net/database",
                "http://www.springframework.net/remoting",
                "http://www.springframework.net/nms",
                "http://www.springframework.net/validation",
                "http://www.springframework.net/nvelocity"
            };

            foreach (string ns in namespaces)
            {
                Assert.IsNotNull(NamespaceParserRegistry.GetParser(ns),
                                 string.Format("Parser for Namespace {0} could not be auto-registered.", ns));
            }
        }