cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with XSD Schema

Former Member
0 Kudos

Hi people,

In our project we are working a POC to integrate MDM. For it, the MDM people request the XSD that generated XI.

We send this XSD:


<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
     <xsd:complexType name="NombreDT">
          <xsd:sequence>
               <xsd:element name="campo1" type="xsd:string"></xsd:element>
               <xsd:element name="campo2" type="xsd:string"></xsd:element>
               <xsd:element name="campo3" type="xsd:string"></xsd:element>
               <xsd:element name="campo4" type="xsd:string"></xsd:element>
               <xsd:element name="campo5" type="xsd:string"></xsd:element>
               <xsd:element name="campo6" type="xsd:string"></xsd:element>
          </xsd:sequence>
     </xsd:complexType>
</xsd:schema>

The XML that we sent through scenario created in XI is:


<?xml version="1.0" encoding="UTF-8"?>
<NombreDT>
     <campo1>data1</campo1>
     <campo2>data2</campo2>
     <campo3>data3</campo3>
     <campo4>data4</campo4>
     <campo5>data5</campo5>
     <campo6>data6</campo6>
</NombreDT>

When MDM wants to import the XML to MDM's repository using the XSD as Schema, it shows the following error:


Logon Error: Failed to Parse XML file.
Error:
COM error: 80004005 Unspecified error
Source =      Description =

SAX2Error: errCode=80004005, PublicId =,

Error Message= The element "NombreDT" is used but not declared in DTD/Schema.

They have provided us a XSD and a XML that works to them correctly:

XSD:


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="DataSuper">
<xs:complexType>
<xs:sequence>
<xs:element ref="MiniData" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="MiniData">
<xs:complexType>
<xs:attribute name="code1" use="required" type="xs:integer"/>
<xs:attribute name="code2" use="required" type="xs:NCName"/>
<xs:attribute name="code3" use="required" type="xs:NMTOKEN"/>
<xs:attribute name="code4" use="required" type="xs:NMTOKEN"/>
<xs:attribute name="code5" use="required" type="xs:NCName"/>
</xs:complexType>
</xs:element>
</xs:schema>

XML:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<DataSuper>
<MiniData code1="22550" code2="ppp" code3="150" code4="30" code5="dat1"/>
<MiniData code1="22551" code2="out" code3="400" code4="30" code5="dat2"/>
<MiniData code1="22552" code2="out" code3="350" code4="30" code5="dat3"/>
<MiniData code1="22553" code2="ppp" code3="1505" code4="30" code5="dat1"/>
</DataSuper>

Is it the problem of the XSD generated in XI?

What is the difference between xsd:element and xs:element?

Can we generate in XI a XSD of the type xs:element?

King Regards

Accepted Solutions (0)

Answers (1)

Answers (1)

michael_theis
Active Contributor
0 Kudos

Hi coolbrain,

first of all the MDM XML parsing validation against an XSD is much stricter than the one on XI.

Regarding your first example:

In your XSD you define "NombreDT" as a complex type and not as an element. In your XML you use "NombreDT" as an element. The error message that you receive is correct, since the definition as a complex type is not automatically the definition for an element. To enable the parsing of your XML, the XSD has to look like:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<xsd:element name="NombreDT" type="NombreDT"/>
<xsd:complexType name="NombreDT">
<xsd:sequence>
<xsd:element name="campo1" type="xsd:string"></xsd:element>
<xsd:element name="campo2" type="xsd:string"></xsd:element>
<xsd:element name="campo3" type="xsd:string"></xsd:element>
<xsd:element name="campo4" type="xsd:string"></xsd:element>
<xsd:element name="campo5" type="xsd:string"></xsd:element>
<xsd:element name="campo6" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

Note the additional <xsl:element> definition right before the complex type!

As far as I know, there's no real difference between the xs or xsd namespace, as long as it is defined correctly in the very first schema tag.

Kind regards

Michael

Former Member
0 Kudos

Good job in articulating Michael!. I was thinking the same, the element definition is misisng in the XSD. Just the complex type is not sufficient.

Former Member
0 Kudos

Hi Michael & Jagathi,

The problem is that XI in the Message Type create the following XSD:


<?xml version="1.0" encoding="ISO-8859-1"?>
 
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="my_namespace">
	<xsd:import namespace="my_namespace" />
	<xsd:element name="my_Message_Type" type="my_Message_Type" />
</xsd:schema>

It is solved editing that XSD and to replace the line:


<xsd:import namespace="my_namespace" />

by the XSD of Data Type. The XSD must be:


<?xml version="1.0" encoding="ISO-8859-1"?>
 
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="my_namespace">
<xsd:complexType name="NombreDT">
          <xsd:sequence>
               <xsd:element name="campo1" type="xsd:string"></xsd:element>
               <xsd:element name="campo2" type="xsd:string"></xsd:element>
               <xsd:element name="campo3" type="xsd:string"></xsd:element>
               <xsd:element name="campo4" type="xsd:string"></xsd:element>
               <xsd:element name="campo5" type="xsd:string"></xsd:element>
               <xsd:element name="campo6" type="xsd:string"></xsd:element>
          </xsd:sequence>
     </xsd:complexType>
	<xsd:element name="my_Message_Type" type="my_Message_Type" />
</xsd:schema>

Thanks to all,

Good work.