Skip to main content

Hi,

I am looking for learning the way we can convert excel files into XSD format. Any basic tutorials/videos that can help me to learn this quickly?

Regards,

Purvi

Is your excel file a schema description or data?

FieldTypeIDIntNAMEString (50)

 

 

vs

IDNAME1John Doe2Jane Smith

Is your excel file a schema description or data?

FieldTypeIDIntNAMEString (50)

 

 

vs

IDNAME1John Doe2Jane Smith

Hi @jdh, Yes that excel file is a schema at the moment.

Regards,


As far as I am aware there isn't an automatic xsd writer.

 

 

xsd however is just XML, so you could use an XMLTemplater to construct the relevant data.

 

 

Something along the lines of

Root (Creator):

<?xml version="1.0"?>

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

targetNamespace="https://www.w3schools.com"

xmlns="https://www.w3schools.com"

elementFormDefault="qualified">

<xs:sequence>

{fme:process-features("SUB")}

</xs:sequence>

</xs:schema>

 

 

SUB (your excel data):

 

<xs:element name="{fme:get-attribute("Field")}" type="{fme:get-attribute("Type")}"/>

 

Where type is generally one of

  • xs:string
  • xs:decimal
  • xs:integer
  • xs:boolean
  • xs:date
  • xs:time

so you may need to restructure your excel data (AttributeValueMapper)

If you have a nested data structure then you need to use complex elements, and will probably require multiple subtemplates.


As far as I am aware there isn't an automatic xsd writer.

 

 

xsd however is just XML, so you could use an XMLTemplater to construct the relevant data.

 

 

Something along the lines of

Root (Creator):

<?xml version="1.0"?>

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

targetNamespace="https://www.w3schools.com"

xmlns="https://www.w3schools.com"

elementFormDefault="qualified">

<xs:sequence>

{fme:process-features("SUB")}

</xs:sequence>

</xs:schema>

 

 

SUB (your excel data):

 

<xs:element name="{fme:get-attribute("Field")}" type="{fme:get-attribute("Type")}"/>

 

Where type is generally one of

  • xs:string
  • xs:decimal
  • xs:integer
  • xs:boolean
  • xs:date
  • xs:time

so you may need to restructure your excel data (AttributeValueMapper)

If you have a nested data structure then you need to use complex elements, and will probably require multiple subtemplates.

Thanks @jdh for your detailed answer. Do you have any workbench example template or tutorial to follow through this?

As I am really new to understand/create XML and XSD file format.

Regards,

Purvi


Thanks @jdh for your detailed answer. Do you have any workbench example template or tutorial to follow through this?

As I am really new to understand/create XML and XSD file format.

Regards,

Purvi

I've actually never written an xsd file. I would start with w3schools for an overview of the format. https://www.w3schools.com/xml/schema_intro.asp

 

For creating it in FME check out https://knowledge.safe.com/articles/30940/xml-writing-with-xmltemplater.html


I've actually never written an xsd file. I would start with w3schools for an overview of the format. https://www.w3schools.com/xml/schema_intro.asp

 

For creating it in FME check out https://knowledge.safe.com/articles/30940/xml-writing-with-xmltemplater.html

Thanks @jdh, I will follow through this link to work on this... :)

Regards,


Reply