小编use*_*234的帖子

引用xml中的xsd文件

我是xml语言的新手,我有一个xml文件,我为该文件创建了xsd模式,但我的问题是如何在xml文件中引用这个模式.我的xml架构看起来像这样

<?xml version="1.0" encoding="utf-8"?>
 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:wmh="http://www.wmhelp.com/2003/eGenerator"
    elementFormDefault="qualified"
    targetNamespace="http://axis.com/service"
    xmlns="http://axis.com/service"
    version="1.0">

  <xs:element name="SWService" type="SWServiceType"/>
  <xs:element name="HWService" type="HWServiceType"/>


 <xs:complexType name="SWServiceType">
<xs:sequence>
  <xs:element name="Service" type="ServiceType" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
  </xs:complexType>

 <xs:complexType name="ServiceType">
 <xs:complexContent>
 <xs:extension base="IdType">
  <xs:sequence>
    <xs:element name="Description" type="xs:string" maxOccurs="1" minOccurs="0"/>
    <xs:element name="ServiceCustomers" type="ServiceCustomersType" maxOccurs="1" 
 minOccurs="0"/>
    <xs:element name="ServiceSuppliers" type="ServiceSuppliersType" maxOccurs="1" 
 minOccurs="0"/>
  </xs:sequence>
  <xs:attribute name="Name" type="xs:string" use="required"/>
  </xs:extension>
  </xs:complexContent>
   </xs:complexType>

    <xs:complexType name="HWServiceType">
  <xs:sequence>
    <xs:element name="element" type="elementGroupType" maxOccurs="1" minOccurs="0"/>
  </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ServiceCustomersType">
  <xs:sequence>
    <xs:element name="SoftWare" type="SoftWareType" maxOccurs="unbounded" 
  minOccurs="0"/>
  </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ServiceSuppliersType">
  <xs:sequence>
    <xs:element …
Run Code Online (Sandbox Code Playgroud)

xml xsd

6
推荐指数
1
解决办法
1467
查看次数

标签 统计

xml ×1

xsd ×1