以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 DTD/XML Schema 』  (http://bbs.xml.org.cn/list.asp?boardid=23)
----  [求助]请教一个xsd的问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=23&rootid=&id=60010)


--  作者:yuzhile
--  发布时间:3/15/2008 5:44:00 PM

--  [求助]请教一个xsd的问题
myeclipse 老是提示有错误:The prefix "xs" for element "xs:schema" is not bound,文件如下:
---------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/User" xmlns:tns="http://www.example.org/User" elementFormDefault="qualified">
<xs:complexType name="User">
 <xs:annotation>
  <xs:documentation>用户名</xs:documentation>
 </xs:annotation>
 <xs:sequence>
  <xs:element name="name"/>
  <xs:element name="Description"/>
  <xs:element name="ParentGroup" type="Identity" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="Role" type="Identity" minOccurs="0" maxOccurs="unbounded"/>
  <xs:element name="Property" minOccurs="0" maxOccurs="unbounded">
   <xs:complexType>
    <xs:attribute name="name" use="required"/>
    <xs:attribute name="value" use="required"/>
   </xs:complexType>
  </xs:element>
 </xs:sequence>
 <xs:attribute name="id" use="required"/>
</xs:complexType>

</schema>


--  作者:yuzhile
--  发布时间:3/16/2008 11:50:00 AM

--  
上个问题解决了,可是又出了新问题:src-resolve.4.2:Error resolving component 'Identity'

-----------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/User" xmlns:tns="http://www.example.org/User" elementFormDefault="qualified">
 <complexType name="User">
  <annotation>
   <documentation>用户名</documentation>
  </annotation>
  <sequence>
   <element name="Name"></element>
   <element name="Description"></element>
   <element name="ParentGroup" type="Identity" minOccurs="0" maxOccurs="unbounded"></element>
   <element name="Role" type="Identity" minOccurs="0" maxOccurs="unbounded"></element>
   <element name="Property" minOccurs="0" maxOccurs="unbounded">
    <complexType>
     <attribute name="name" use="required"></attribute>
     <attribute name="value" use="required"></attribute>
    </complexType>
   </element>
  </sequence>
 </complexType>
</schema>


--  作者:yuzhile
--  发布时间:3/16/2008 7:40:00 PM

--  
Identity是一个接口,请问怎么把它写成一个xml schema中一个类型
晕 ,刚接触XSD ,概念不是很清楚
------------------------------------------------------------------------------------------------------------------------
public interface Identity {
 public static final int WORKFLOW = 0;//工作流标识符
 public static final int BRAND = 1;//分支操作标识符
 public static final int STATUS = 2;//状态标识符
 public static final int SWITCH = 3;//切换开关标识符
 public static final int USER = 4;//用户标示符
 public static final int WORKUNIT = 5;//工作单元标识符
 public static final int ROLE = 6;//角色标识符
 public static final int GROUP = 7;//群组标识符
 public static final int VIEWCLASS = 255;
 public static final String XMLWORKFLOW = "XMLWorkFlow";
 public static final String XMLBRAND = "XMLBrand";
 public static final String XMLSWITCHER = "XMLSwitcher";
 public static final String XMLSTATUS = "XMLStatus";
 public static final String XMLWORKUNIT = "XMLWorkUnit";
 public static final String DBWORKFLOW ="DBWorkFlow";
 public static final String DBBRAND = "DBBrand";
 public static final String DBSWITCHER = "DBSwitcher";
 public static final String DBSTATUS = "DBStatus";
 public static final String DBWORKUNIT = "DBWorkUnit";
 public static final String XMLUSER = "XMLUser";
 public static final String XMLGROUP = "XMLGroup";
 public static final String XMLROLE = "XMLRole";
 
 ////////////////////////////////////////////////////
 public int getIdType();
 public String getIdName();
 public String getSubType();
 public Object newInstance() throws IdentityMappingError;
 
}

--  作者:yuzhile
--  发布时间:3/17/2008 8:07:00 AM

--  
这样中不中呢?
---------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/Identity" xmlns:tns="http://www.example.org/Identity" elementFormDefault="qualified">
 <complexType name="Identity">
   <sequence>
    <element name="WORKFLOW" type="integer" default="0"></element>
    <element name="BRAND" type="integer" default="1"></element>
    <element name="STATUS" type="integer" default="2"></element>
    <element name="SWITCH" type="integer" default="3"></element>
    <element name="USER" type="integer" default="4"></element>
    <element name="WORKUNIT" type="integer" default="5"></element>
    <element name="ROLE" type="integer" default="6"></element>
    <element name="GROUP" type="integer" default="7"></element>
    <element name="VIEWCLASS" type="integer" default="255"></element>
    <element name="XMLWORKFLOW" type="string" default="XMLWorkFlow"></element>
    <element name="XMLBRAND" type="string" default="XMLBrand"></element>
    <element name="XMLSTATUS" type="string" default="XMLStatus"></element>
    <element name="XMLWORKUNIT" type="string" default="XMLWorkUnit"></element>
    <element name="DBBRAND" type="string" default="DBBrand"></element>
    <element name="DBSWITCH" type="string" default="DBSwitch"></element>
    <element name="XMLUSER" type="string" default="XMLUser"></element>
    <element name="XMLGROUP" type="string" default="XMLGroup"></element>
    <element name="XMLROLE" type="string" default="XMLRole"></element>
   </sequence>
  </complexType>
</schema>
--  作者:yuzhile
--  发布时间:3/17/2008 10:24:00 AM

--  
不知道该怎么导入,郁闷,问题在命名空间

----------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.fswan.org/User"
 xmlns:tns="http://www.fswan.org/User"
  elementFormDefault="qualified">
 <import namespace="http://www.example.org/Identity" schemaLocation="C:\workspace\pow\src\org\fswan\workflow\Identity.xsd"></import> 
<complexType name="User">
  <annotation>
   <documentation>用户名</documentation>
  </annotation>
  <sequence>
   <element name="Name"></element>
   <element name="Description"></element>
   <element name="ParentGroup" type="Identity" minOccurs="0" maxOccurs="unbounded"></element>
   <element name="Role" type="Identity" minOccurs="0" maxOccurs="unbounded"></element>
   
   <element name="Property" minOccurs="0" maxOccurs="unbounded">
    <complexType>
     <attribute name="name" use="required"></attribute>
     <attribute name="value" use="required"></attribute>
    </complexType>
   </element>
  </sequence>
 </complexType>
 
</schema>


--  作者:yuzhile
--  发布时间:3/17/2008 10:48:00 AM

--  
搞定,我真是太伟大了
----------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.fswan.org/User"
 xmlns:tns="http://www.fswan.org/User"
 xmlns:id="http://www.example.org/Identity"
  elementFormDefault="qualified">
 <import namespace="http://www.example.org/Identity" schemaLocation="file:\\\C:\workspace\pow\src\org\fswan\workflow\Identity.xsd"></import>
 <complexType name="User">
  <annotation>
   <documentation>用户名</documentation>
  </annotation>
  <sequence>
   <element name="Name"></element>
   <element name="Description"></element>
   <element name="ParentGroup" type="id:Identity" minOccurs="0" maxOccurs="unbounded"></element>
   <element name="Role" type="id:Identity" minOccurs="0" maxOccurs="unbounded"></element>
   
   <element name="Property" minOccurs="0" maxOccurs="unbounded">
    <complexType>
     <attribute name="name" use="required"></attribute>
     <attribute name="value" use="required"></attribute>
    </complexType>
   </element>
  </sequence>
 </complexType>
 
</schema>


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
62.500ms