Skip to main content
Solved

converting excel file into XSD fomat?


Forum|alt.badge.img

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

Best answer by jdh

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.

View original
Did this help you find an answer to your question?

6 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • June 17, 2020

Is your excel file a schema description or data?

FieldTypeIDIntNAMEString (50)

 

 

vs

IDNAME1John Doe2Jane Smith

Forum|alt.badge.img
  • Author
  • June 17, 2020
jdh wrote:

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,


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • Best Answer
  • June 17, 2020

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.


Forum|alt.badge.img
  • Author
  • June 17, 2020
jdh wrote:

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


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • June 18, 2020
ppp19 wrote:

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


Forum|alt.badge.img
  • Author
  • June 18, 2020
jdh wrote:

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,


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings