<bf:head-routing key="1" value="1" to="test2"/>
<!-- 声明一个标签,名字为head-routing,他的类型为headRouting-->
<xsd:element name="head-routing" type="headRouting"></xsd:element>
<!-- 定义head-routing的类型,这里定义它有key,value,to,patten四个属性 -->
<xsd:complexType name="headRouting">
<xsd:attribute name="key" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="value" type="xsd:string" use="required"></xsd:attribute>
<xsd:attribute name="to" type="xsd:IDREF" use="required"></xsd:attribute>
<xsd:attribute name="patten" type="xsd:string" default="string"></xsd:attribute>
</xsd:complexType>
<bf:stop id="test1" ref="testNode">
<bf:head-routing key="1" value="1" to="test2"/>
</bf:stop>
<xsd:element name="stop">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="beans:identifiedType">
<xsd:group ref="stopElements"/>
<xsd:attributeGroup ref="stopAttributes"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:extension base="beans:identifiedType"> 定义了该标签的id属性,注意这里引用的是spring-beans中的type,
<xsd:group ref="stopElements"/>中定义了<bf:stop>标签允许的子标签
<xsd:attributeGroup ref="stopAttributes"/> 定义了<bf:stop>标签允许的属性
<xsd:group name="stopElements">
<xsd:sequence>
<xsd:element ref="description" minOccurs="0"/>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="head-routing"/>
<!-- 有更多的子标签继续在这里添加,例如<xsd:element ref="properties"/> -->
</xsd:choice>
</xsd:sequence>
</xsd:group>
<xsd:attributeGroup name="stopAttributes">
<xsd:attribute name="ref" type="xsd:IDREF" use="required">
<xsd:annotation>
<xsd:appinfo>
<!-- 这里是使用了Spring tool xsd中的标签,格式校验-->
<tool:annotation kind="ref">
<tool:expected-type type="com.lizo.node.Station"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<!-- 有更多的子标签继续在这里添加,例如<xsd:attribute name="value" type="xsd:string"/> -->
<beans
..
xmlns:bf="http://www.lizo.com/schema/bf"
xsi:schemaLocation="
...
http://www.lizo.com/schema/bf
http://www.lizo.com/schema/bf.xsd
">
<bf:stop id="test123" ref="testNode">
<bf:head-routing key="1" value="1" to="test1"/>
<bf:head-routing key="3" value="4" to="test2"/>
</bf:stop>
public class BusinessFlowNamespaceHandlerSupport extends NamespaceHandlerSupport {
public void init() {
//注册用于解析<bf:stop>的解析器
registerBeanDefinitionParser("stop", new BusinessFlowBeanDefinitionParser());
}
}
public interface BeanDefinitionParser {
BeanDefinition parse(Element element, ParserContext parserContext);
}
RootBeanDefinition nodeWrapDefinition = new RootBeanDefinition();
//该BeanDefinition对应的是什么类
nodeWrapDefinition.setBeanClass(StationRoutingWrap.class);
//name是解析标签后获得的值
nodeWrapDefinition.getPropertyValues().addPropertyValue("name", name);
RuntimeBeanReference refBean = new RuntimeBeanReference(ref);
nodeWrapDefinition.getPropertyValues().addPropertyValue("station", refBean);
ManagedList routingConditions = new ManagedList();
....
nodeWrapDefinition.getPropertyValues().add("routing", routing);
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有