首页 文章

找到以元素'Role'开头的无效内容

提问于
浏览
1

My Schema:

<xsd:element name="GetTasksForRolesResponse">
                        <xsd:complexType>
                          <xsd:sequence>
                            <xsd:element name="tuple" maxOccurs="unbounded">
                              <xsd:complexType>
                                <xsd:sequence>
                                  <xsd:element name="old">
                                    <xsd:complexType>
                                      <xsd:sequence>
                                        <xsd:element name="Role">
                                          <xsd:complexType mixed="true">
                                            <xsd:sequence>
                                              <xsd:element minOccurs="0" maxOccurs="unbounded" ref="ns:Task" xmlns:ns="http://schemas.cordys.com/task/1.0/"/>
                                            </xsd:sequence>
                                            <xsd:attribute type="xsd:string" name="dn" use="optional"/>                                         
                                            <xsd:attribute type="xsd:string" name="configTaskId" use="optional"/>
                                          </xsd:complexType>
                                        </xsd:element>
                                      </xsd:sequence>
                                    </xsd:complexType>
                                  </xsd:element>
                                </xsd:sequence>
                              </xsd:complexType>
                            </xsd:element>
                          </xsd:sequence>
                        </xsd:complexType>
                      </xsd:element>

My Content:

<GetTasksForRolesResponse
            xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns="http://schemas.cordys.com/task/1.0/runtime/">
            <tuple>
                <old>
                    <Role
                        xmlns="http://schemas.cordys.com/task/1.0/"
                        dn="cn=Analyst,cn=Cordys@Work,cn=cordys,cn=defaultInst,o=vanenburg.com"></Role>
                </old>
            </tuple>
        </GetTasksForRolesResponse>

请帮助我解决上述错误 .


Error 引起:org.xml.sax.SAXException:cvc-complex-type.2.4.a:找到以元素'Role'开头的无效内容 . 其中一个'{“http://schemas.cordys.com/task/1.0/runtime/ ":Role}' is expected. org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 77; cvc-complex-type.2.4.a: Invalid content was found starting with element 'Role'. One of '{" http://schemas.cordys.com/task/1.0/runtime/”:角色}'是预期的 .

1 回答

  • 0

    XML中的 Role 元素具有显式命名空间

    http://schemas.cordys.com/task/1.0/
    

    而验证器似乎期望它在命名空间中

    http://schemas.cordys.com/task/1.0/runtime/
    

相关问题