-->

The prefix “xs” for element “xs:schema” is not bou

2019-03-30 00:42发布

问题:

Following is the xsd that i am trying to use while generating a client for SOAP Service, Eclipse is throwing an error : The prefix "xs" for element "xs:schema" is not bound.

<xs:schema version="1.0" 
           targetNamespace="bdo.com.ph/RemitAPI">
  <xs:element name="CheckServiceResponse" 
              nillable="true" type="xs:string"/>
  <xs:element name="apiRequest" nillable="true" type="tns:APIRequest"/>
  .............................
      <xs:element name="referenceNo" type="xs:string" form="qualified"/>
    </xs:sequence>
  </xs:complexType>
</xs:schema> 

I got this xsd from a webservice

回答1:

 xmlns:xs="http://www.w3.org/2001/XMLSchema"  

was not added in the Schema XSD. adding it made me proceed to the next step.

xmlns:tns="http://www.bdo.com.ph/RemitAPI  

was not there in the XSD, though it was present in the enclosing WSDL.

When extracting an XSD from a WSDL to local machine, the namespace references in the XSD do not get picked up from the WSDL, they need to be declared in the XSD.



回答2:

This happens mainly because of the missing namespacedeclaration.

   "<elem "namespace" ..xsi:nil=true.>"

will work. Basically the XML validator expects a namespace to validate against.