master.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.gworks.cn/waf_profile"
xmlns:tns="http://www.gworks.cn/waf_profile" elementFormDefault="qualified">
<element name="profile">
<complexType>
<sequence>
<element name="aspect">
<complexType>
<sequence minOccurs="1" >
<any processContents="strict" />
</sequence>
<attribute name="id" type="string" use="required"></attribute>
<attribute name="class" type="string" use="required"></attribute>
<attribute name="desc" type="string" use="optional"></attribute>
</complexType>
</element>
</sequence>
<attribute name="name" type="string" use="required"></attribute>
</complexType>
</element>
</schema>
Can I write a XML file against this schema like this:
<?xml version="1.0" encoding="UTF-8"?>
<profile name="开发" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.gworks.cn/waf_profile"
xsi:schemaLocation="http://www.gworks.cn/waf_profile http://www.gworks.cn/waf_profile.xsd">
<aspect id="security" class="cn.gworks.waf.config.SecurityConfig" desc="安全配置">
<security xsi:schemaLocation="http://www.gworks.cn/config_security http://www.gworks.cn/config_security.xsd">
<authService impl="com.bgzchina.ccms.security.SSOAuthService" enabled="true">
<certificate>
<field name="Token" isKey="true" />
</certificate>
</authService>
<authService impl="com.bgzchina.ccms.security.NoAuthService" enabled="true">
<certificate>
<field name="username" isKey="true" />
</certificate>
</authService>
</security>
</aspect>
</profile>
where the child element "security" has its own schema defined.