相关疑难解决方法(0)

xsd和xsi有什么区别?

XML Schema Document和XML Schema Instance之间究竟有什么区别?

  • xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

请详细说明.

xml xsd xsi xsitype

22
推荐指数
2
解决办法
2万
查看次数

是否可以检索XML命名空间名称URI?

我的WSDL上有以下标记:

<?xml version='1.0' encoding='UTF-8'?>
<definitions name="" targetNamespace="http://xxxxx/ws"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:s0="http://xxxxx/ws"
             xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/">
  <types>
    <xsd:schema attributeFormDefault="qualified" 
                elementFormDefault="qualified"
                targetNamespace="http://xxxxx/ws/comments" 
                xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
                xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
                xmlns:s0="http://xxxxx/ws" 
                xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/" 
                xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
                xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
                xmlns:tns="http://xxxxx/ws" 
                xmlns:tnsc="http://xxxxx/ws/comments" 
                xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                xmlns:y="http://new.webservice.namespace">
Run Code Online (Sandbox Code Playgroud)

此后,类型被限定为s0,s1 ...名称空间中的类型.

问题是命名空间端点(="http:// xxxxx/ws")是否需要是有效的URL?
如果端点不再存在 - 是否意味着我们需要再次为Web服务重新生成存根代理?

注意:Web Service本身的端点与命名空间的端点不同,但仍然存在.

xsd wsdl web-services wsdl2java

9
推荐指数
1
解决办法
4284
查看次数

如何在XSD中使用xsi:type限制XML元素的值?

我想基于属性值验证元素的文本值.例如

<Device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Parameter xsi:type="xsd:unsignedInt">-100</Parameter>
  <Parameter xsi:type="xsd:boolean"></Parameter>
  <Parameter>hello</Parameter>
</Device>
Run Code Online (Sandbox Code Playgroud)

以上都应该失败.对于布尔值,除"true"或"false"(甚至空字符串)外,不应接受任何内容

我的XML是复杂得多用很多Object和Parameter节点,这是我的xsd这是递归地验证所有的节点

    <xs:complexType name="deviceType">
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="Object"/>
                    <xs:element ref="Parameter"/>
            </xs:choice>
    </xs:complexType>

    <xs:complexType name="objType">
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="Object"/>
                    <xs:element ref="Parameter"/>
            </xs:choice>
            <!-- Add all valid attributes for 'Object' type here -->
            <xs:attribute name="Id" use="required"/>
            <xs:attribute name="Flag" use="required"/>
            <xs:anyAttribute processContents="lax"/>
    </xs:complexType>

    <xs:complexType name="paramType" mixed="true">
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="Object"/>
                    <xs:element ref="Parameter"/>
            </xs:choice>
            <xs:attribute name="Id" use="required"/>
            <xs:attribute name="Flag" use="required"/>
            <xs:anyAttribute processContents="lax"/>
    </xs:complexType>
Run Code Online (Sandbox Code Playgroud)

但是我面临这个错误.

Type 'xsd:unsignedInt' is …
Run Code Online (Sandbox Code Playgroud)

xml xsd

2
推荐指数
1
解决办法
4326
查看次数

标签 统计

xsd ×3

xml ×2

web-services ×1

wsdl ×1

wsdl2java ×1

xsi ×1

xsitype ×1