Search code examples
xmlssisxsdxsd-validationfpml

Error while setting up the mapping in xml source


I am using a xml file to read which contains multiple namespaces. And i have XSD file for that which i am using. But there was an error saying that

"Error at Data Flow Task [XML Source [1]]: There was an error setting up the mapping. 
 The '{http://www.fpml.org/2005/FpML-4-2}:header' element is not declared.
 (Microsoft Visual Studio)"

But when i check the xsd file it contains the definition for that.

My files are as follows.

 <?xml version="1.0" encoding="UTF-8"?>
 <xs:schema xmlns="http://link"  
            xmlns:ns1="http://link2" 
            xmlns:ns2="http://link"  
            xmlns:xs="http://www.w3.org/2001/XMLSchema"  
            targetNamespace="http://targetnamaspace">

   <xs:import namespace="http://link"  schemaLocation="XmlPositions1.xsd"/>
   <xs:import namespace="http://link2" schemaLocation="XmlPositions2.xsd"/>

and my xml file is as below

 <?xml version="1.0" encoding="utf-8"?>
 <ns0:message xmlns:ns0="http://target" version="4-2"  
              xmlns:ns1="http://link2" 
              xmlns:ns2="http://link"  
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
              xsi:type="ns0:SoaMethodsResult">
      <ns1:header>
         <ns1:messageId messageIdScheme=""></ns1:messageId>
         <ns1:sentBy partyIdScheme="http://reference">SOPHIS</ns1:sentBy>
         <ns1:creationTimestamp>2014-03-21T22:20:40+01:00</ns1:creationTimestamp>

Please let m know if you have any question. Thanks for helping me out!


Solution

  • Where is the part of your schema documents where you import a schema document for namespace http://www.fpml.org/2005/FpML-4-2?

    If there is such a part, it's not working (but because you don't show it to us, no one here can tell you why it's not working).

    If there is no such part, your problem is that you're not importing that namespace.