Ramesh
Ramesh

Reputation: 529

Invalid content was found starting with element 'Role'

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>

Please help me with the above error.


Error Caused by: org.xml.sax.SAXException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'Role'. One of '{"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/":Role}' is expected.

Upvotes: 1

Views: 6697

Answers (1)

Jim Garrison
Jim Garrison

Reputation: 86774

The Role element in your XML has an explicit namespace

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

while the validator seems to be expecting it to be in namespace

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

Upvotes: 0

Related Questions