Analysis of custom tags

Explore the parsing process of custom tags

public BeanDefinition parseCustomElement(Element ele) {
		return parseCustomElement(ele, null);
	}
public BeanDefinition parseCustomElement(Element ele, BeanDefinition containingBd) {
		String namespaceUri = getNamespaceURI(ele);
		NamespaceHandler handler = this.readerContext.getNamespaceHandlerResolver().resolve(namespaceUri);
		if (handler == null) {
			error("Unable to locate Spring NamespaceHandler for XML schema namespace [" + namespaceUri + "]", ele);
			return null;
		}
		return handler.parse(ele, new ParserContext(this.readerContext, this, containingBd));
	}
In fact, the idea is very simple, nothing more than to obtain the corresponding namespace according to the corresponding bean, parse the corresponding processor according to the namespace, and then parse according to the user-defined processor.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324842455&siteId=291194637