cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with nested xsd schema in Design

Former Member
0 Kudos

Hi experts,

I'm developing a new sender interface in which we receive an xml file.

Other party gave us xsd schema to use in interface design.

My problem is that they gave us 2 schemas, and Schema B is nested into Schema A, and Schema A has tag named "cfdi" and Schema B has tag named "tfd"

This are the first lines of schema A:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.sat.gob.mx/cfd/3" elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:element name="Comprobante">

This are the first lines of schema B:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tfd="http://www.sat.gob.mx/TimbreFiscalDigital" targetNamespace="http://www.sat.gob.mx/TimbreFiscalDigital" elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:element name="TimbreFiscalDigital">

I've tried to inserto Schema B as an element of Schema A, but I'm not sure that is the correct way to proceed, I've problem with the different names of tags (cfdi and tfd) can you help me?

Thanks

Fabio

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

have u tried to import both the XSD as external definition. R u facing any issue while doing so...

thanks

chirag

Former Member
0 Kudos

Hi Chirag,

I have not tried.

Now I have done that, and I have 2 External Definitions, but what are next steps?

How can I nest second ED into first?

thanks

Fabio

Former Member
0 Kudos

Hi

Two methods to insert one xsd into another.

<xsd:include schemaLocation="pathToFile"> 
should be used for including files of the same namespace.

<xsd:import namespace="namespace" schemaLocation="pathToFile"> 
should be used for include files in a different namespace.
Usually you will specify the namespace given as the targetNamespace
of the imported schema.

*source website: http://stackoverflow.com/questions/332792/can-i-have-one-xml-schema-xsd-include-another-xml-schema

regards

Ramesh

Answers (3)

Answers (3)

Former Member
0 Kudos

Problem solved!!

thank you

Former Member
0 Kudos

Assuming the third party has given you 2 xsds schema B and Schema A.

Your Schema A must contain a

<xsd:import namespace ="..." schemaLocation = "schemaB.xsd"/>

or

<xsd:include schemaLocation="schemaB.xsd"/>

If this is not the case, then the xsds are not nested. You need to edit them manually to get it right.

Once you are done with this you can import both of them into ESR and start using the schema A (base xsd) in your mappings. It will resolve the types in schema B automatically.

Jai

Former Member
0 Kudos

Hi Jaishankar,

thanks for help.

Third party gave me this example file:

<?xml version="1.0" encoding="UTF-8" ?>

- <cfdi:Comprobante xmlns:cfdi="http://www.sat.gob.mx/cfd/3" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" certificado="MIIE/TCCA" fecha="2011-11-18T11:46:00" folio="9000000348" formaDePago="Payable immediately" noCertificado="30001000000100000800" sello="H=" subTotal="22322.400000" tipoDeComprobante="ingreso" total="27903.000000" version="3.0" xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv3.xsd">

- <cfdi:Emisor nombre="DUCMOTOCICLETA, S DE RL DE CV" rfc="DUC0912109A2">

<cfdi:DomicilioFiscal calle="AVENIDA PRESIDENTE MASARIK" codigoPostal="11570" estado="Hidalgo" municipio="COL. CHAPULTEPEC MORALES" noExterior="111 1er." pais="Mexico" />

</cfdi:Emisor>

- <cfdi:Receptor rfc="XAXX010101000">

<cfdi:Domicilio pais="Mexico" />

</cfdi:Receptor>

- <cfdi:Conceptos>

<cfdi:Concepto cantidad="1.0000" descripcion="MOTO SBK 09 1198 RED EUR" importe="9301.000000" valorUnitario="9301.000000" />

</cfdi:Conceptos>

- <cfdi:Impuestos totalImpuestosTrasladados="5580.600000">

- <cfdi:Traslados>

<cfdi:Traslado importe="5580.600000" impuesto="IVA" tasa="20.000000" />

</cfdi:Traslados>

</cfdi:Impuestos>

- <cfdi:Complemento>

<tfd:TimbreFiscalDigital xmlns:tfd="http://www.sat.gob.mx/TimbreFiscalDigital" FechaTimbrado="2011-11-18T12:11:27" UUID="8C00B112-7E57-4EFA-892B-5EF1CE5604C1" noCertificadoSAT="30001000" selloCFD="HeyXTPZYbtHog=" selloSAT="w6Qk=" version="1.0" xsi:schemaLocation="http://www.sat.gob.mx/TimbreFiscalDigital http://www.sat.gob.mx/sitio_internet/TimbreFiscalDigital/TimbreFiscalDigital.xsd" />

</cfdi:Complemento>

</cfdi:Comprobante>

in which you can see that TimbreFiscalDigital (schema B) is into tag "Complemento" of "Comprobante" (schema A) and then they gave us Comprobante schema and TimbreFiscalDigital schema that start like this:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tfd="http://www.sat.gob.mx/TimbreFiscalDigital" targetNamespace="http://www.sat.gob.mx/TimbreFiscalDigital" elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:element name="TimbreFiscalDigital">

<xs:annotation>

<xs:documentation>Complemento requerido para el Timbrado Fiscal Digital que da valides a un Comprobante Fiscal Digital.</xs:documentation>

In Comprobante Schema tag Complemento is defined in this way:

<xs:element name="Complemento" minOccurs="0">

<xs:annotation>

<xs:documentation>Nodo opcional donde se incluirá el complemento Timbre Fiscal Digital de manera obligatoria y los nodos complementarios determinados por el SAT, de acuerdo a las disposiciones particulares a un sector o actividad especifica. </xs:documentation>

</xs:annotation>

<xs:complexType>

<xs:sequence>

<xs:any minOccurs="0" maxOccurs="unbounded"/>

</xs:sequence>

</xs:complexType>

</xs:element>

If I edit Schema B into Schema A I have problems with tags of schema B (tfd) that are different from tags of schema A (cfdi).

Any ideas?

thanks

Edited by: Fabio Boni on Dec 16, 2011 12:09 PM

Edited by: Fabio Boni on Dec 16, 2011 12:11 PM

Edited by: Fabio Boni on Dec 16, 2011 12:13 PM

Former Member
0 Kudos

Fabio,

Is it possible you paste the complete xsd of both schemas here?

Regards

Jai

Former Member
0 Kudos

Hi,

comprobante is too long to post, but you can find it here:

http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv3.xsd

TimbreFiscalDigital is this:

<?xml version="1.0" encoding="UTF-8"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tfd="http://www.sat.gob.mx/TimbreFiscalDigital" targetNamespace="http://www.sat.gob.mx/TimbreFiscalDigital" elementFormDefault="qualified" attributeFormDefault="unqualified">

<xs:element name="TimbreFiscalDigital">

<xs:annotation>

<xs:documentation>Complemento requerido para el Timbrado Fiscal Digital que da valides a un Comprobante Fiscal Digital.</xs:documentation>

</xs:annotation>

<xs:complexType>

<xs:attribute name="version" use="required" fixed="1.0">

<xs:annotation>

<xs:documentation>Atributo requerido para la expresión de la versión del estándar del Timbre Fiscal Digital</xs:documentation>

</xs:annotation>

</xs:attribute>

<xs:attribute name="UUID" use="required" id="UUID">

<xs:annotation>

<xs:documentation>Atributo requerido para expresar los 36 caracteres del UUID de la transacción de timbrado</xs:documentation>

</xs:annotation>

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:whiteSpace value="collapse"/>

<xs:length value="36"/>

<xs:pattern value="[a-f0-9A-F]-[a-f0-9A-F]--[a-f0-9A-F]-[a-f0-9A-F]"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="FechaTimbrado" use="required">

<xs:annotation>

<xs:documentation>Atributo requerido para expresar la fecha y hora de la generación del timbre </xs:documentation>

</xs:annotation>

<xs:simpleType>

<xs:restriction base="xs:dateTime">

<xs:whiteSpace value="collapse"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="selloCFD" use="required">

<xs:annotation>

<xs:documentation>Atributo requerido para contener el sello digital del comprobante fiscal, que será timbrado. El sello deberá ser expresado cómo una cadena de texto en formato Base 64.</xs:documentation>

</xs:annotation>

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:whiteSpace value="collapse"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="noCertificadoSAT" use="required">

<xs:annotation>

<xs:documentation>Atributo requerido para expresar el número de serie del certificado del SAT usado para el Timbre</xs:documentation>

</xs:annotation>

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:whiteSpace value="collapse"/>

<xs:length value="20"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

<xs:attribute name="selloSAT" use="required">

<xs:annotation>

<xs:documentation>Atributo requerido para contener el sello digital del Timbre Fiscal Digital, al que hacen referencia las reglas de resolución miscelánea aplicable. El sello deberá ser expresado cómo una cadena de texto en formato Base 64.</xs:documentation>

</xs:annotation>

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:whiteSpace value="collapse"/>

</xs:restriction>

</xs:simpleType>

</xs:attribute>

</xs:complexType>

</xs:element>

</xs:schema>

Thanks

Fabio

Former Member
0 Kudos

Fabio,

Unfortunately the link is blocked by my company's firewall.

Regards

Jai

Former Member
0 Kudos

hi ,

I've tried to inserto Schema B as an element of Schema A, but I'm not sure that is the correct way to proceed, I've problem with the different names of tags (cfdi and tfd)

As per my knowledge that is not correct to insert Schema B as an element of Schema A because tag names and name spaces both are different .

are you imported both the XSD's through Import External defiinitions from tool?

thanks,

Edited by: bhavanisankar.solasu on Dec 16, 2011 11:33 AM