以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 XML基础 』  (http://bbs.xml.org.cn/list.asp?boardid=1)
----  如何修改这个schema?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=1&rootid=&id=60658)


--  作者:lao_cai
--  发布时间:3/31/2008 11:40:00 AM

--  如何修改这个schema?
<xsd:schema targetNamespace="http://foo" attributeFormDefault="unqualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:foo="http://foo" >

  <xsd:element name="root">
    <xsd:complexType>
      <xsd:attribute ref="xx" />
    </xsd:complexType>
  </xsd:element>
  <xsd:attribute name="xx" type="xsd:string" />
</xsd:schema>

要求引用属性xx,如何修改???


--  作者:sumoku
--  发布时间:3/31/2008 9:28:00 PM

--  
属性可以引用的?在别的element中如果要使用再声明一个就好了吧

= =|| 不过,也许错误。

坐等高人解答。


--  作者:疯狂谷
--  发布时间:4/2/2008 2:38:00 PM

--  
问题出在targetNamespace这个上面!~~~
期待高手的出现!~
--  作者:lao_cai
--  发布时间:4/8/2008 8:33:00 PM

--  
我自己已找到了解决方法:
<xsd:schema targetNamespace="http://foo" attributeFormDefault="unqualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:foo="http://foo" >

  <xsd:element name="root">
    <xsd:complexType>
      <xsd:attribute ref="foo:xx" />
    </xsd:complexType>
  </xsd:element>
  <xsd:attribute name="xx" type="xsd:string" />
</xsd:schema>
因为属性xx是全局属性,因此被限定在命名空间,在引用时应在属性名前加名空间前缀。


--  作者:疯狂谷
--  发布时间:4/9/2008 5:49:00 PM

--  
http://bbs.xml.org.cn/dispbbs.asp?boardID=23&ID=60817
对照了一下这个,偶也知道了!~~~
--  作者:疯狂谷
--  发布时间:4/9/2008 5:51:00 PM

--  
<xsd:schema targetNamespace="http://foo" attributeFormDefault="unqualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:foo="http://foo" >

  <xsd:element name="root">
    <xsd:complexType>
      <xsd:attribute name="xx" type="xsd:string"/>
    </xsd:complexType>
  </xsd:element>  
</xsd:schema>


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