Forum Discussion
Thanks nmrao, we like to use xsd validation as we have lots of data fields declaration and restriction that we want to validate, and I thought it would be very tedious to test each field by plain groovy scripts.
Regards,
Marlon
I rewrite the schema file and break it into two separate files to allow the use of two different namespaces ("http://schemas.xmlsoap.org/soap/envelope/" and "http://tempuri.org/") in the xml file. I validate the original xml successfully using Eclipse with the two schema files below:
First Schema NewXMLSchema.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tns="http://tempuri.org/"
elementFormDefault="qualified">
<import schemaLocation="NewXMLSchema1.xsd" namespace="http://tempuri.org/" >
</import>
<element name="Envelope" type="s:Body" />
<complexType name="Body">
<sequence>
<element name="Body" type="tns:GetDataResponse" />
</sequence>
</complexType>
</schema>
The imported Schema NewXMLSchema1.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://tempuri.org/"
xmlns:tns="http://tempuri.org/"
elementFormDefault="qualified">
<complexType name="GetDataResponse" >
<sequence>
<element name="GetDataResponse" type="tns:GetDataResult"/>
</sequence>
</complexType>
<complexType name="GetDataResult" >
<sequence>
<element name="GetDataResult" type="string" />
</sequence>
</complexType>
</schema>
But when I tried to validate the original xml file in the soapui, i receive the following error message:
src-resolve: Cannot resolve the name 'tns:GetDataResponse' to a(n) 'type of definition' component.
Related Content
- 6 years ago