views:

355

answers:

2

Hi,

I try to import some valid schema (for xmlspy and oxygen) with XMLMapper in delphi and I have this error

"Error Flux if:InfofileType unknown".

I use namespace and this type is define in another file.

Is there a way to solve this ?

(I also try with Delphi 2010 demo and it still not work)

<?xml version="1.0" encoding="UTF-8" ?> 
- <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:if="http://www.gtest.fr/Apps/InfoFile" xmlns:ca="http://www.gtest.fr/Apps/CommandAnswer" elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:import namespace="http://www.gtest.fr/Apps/InfoFile" schemaLocation="InfoFile.xsd" /> 
  <xs:import namespace="http://www.gtest.fr/Apps/CommandAnswer" schemaLocation="CommandAnswer.xsd" /> 
- <xs:element name="ServerAnswer">
- <xs:annotation>
  <xs:documentation>Reponse serveur socket</xs:documentation> 
  </xs:annotation>
- <xs:complexType>
- <xs:sequence>
  <xs:element name="InfoFile" type="if:InfoFileType" /> 
  <xs:element name="Command" type="ca:CommandAnswerType" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:schema>

reported in QC : http://qc.embarcadero.com/wc/qcmain.aspx?d=80124

+1  A: 

I would still try to grab a Delphi 2010 (trial) and see if it works there.
I know there has been significant work done there in D2009 and D2010. It was notoriously bad at doing imports and includes.
Much better now...
If you cannot solve this, I would recommend to manually edit the schemas to remove the include/import and build a big fat XSD without the external file. It should work better.
That's how I did with a rather intricate set of schemas that even .Net lib would choke on.

Update: Could you try to replace the if:InfoFile by another symbol to avoid any clash with the if reserved word; i.e. search 'n' replace if in the schemas by _if_ or anything else... The XML mapper is supposed to care of this but, ya know...

François
I will install demo of 2010 version and hope it will work.
Hugues Van Landeghem
Installed and it is the same :(
Hugues Van Landeghem
Pleas submit a bug report in QC with the schema files attached. In the meantime, you can either try to see if it imports with Delphi Prism (the .Net importer) and manually edit the code for Delphi, or tweak the schemas into 1 big XSD. I know it can be frustrating! Been there, done that :-(
François
@Francois : this is done now
Hugues Van Landeghem
A: 

Eric Thorniley finally give me the way to go here.

It seems XML Mapper does not understand the namespaces correctly. You can however coax it into life by adding an extra namespace definition into the imported files. This is, I am sure, not right.

So, for instance, in your Insurance.xsd you declare xmlns:Utils="http://www.gtest.fr/Apps/Utils"

If you add exactly the same definition into Utils.xsd, XML Mapper imports it correctly (I think!)

Ther is a fair chance that XML Spy would strip out my modifications - certainly Enterprise Architect ignores them completely.

Hugues Van Landeghem