Great little tool for those working with XML

Posted by Mark Davies on 12-Aug-2014 23:54

Hi all,

I'm sure a lot of you had to import an XML file at some stage, and in most cases this is an XML file from another vendor and in some cases you might not even receive the associated XSD file with it.

You would then spend quite a while building a dataset and temp-tables to get this loaded and that is just a bit of a pain to do. I was surprised to find out that not a lot of people know about a little tool in OpenEdge that will define the datasets and temp-tables for you - as long as you have an XSD.

The oldest version of OpenEdge I have installed is OE10.1C and cannot tell you exactly when this tool was added, but I will take a guess that it was in the first releases of OE10 since that was where the dataset made its debut.

The tool is available in your %DLC%/bin folder and is called bproxsdto4gl.bat and you just need to pass it an XSD file:

eg:

bproxsdto4gl MyXMLFile.XSD

This will then generate a MyXMLFile.i include that you can add to your program/class or copy out and use it however you want.

What about if you do not have an XSD, just a plan XML file? There is another solution for that - not in OpenEdge, but a website that will generate an XSD file from an XML file - it has helped me a lot in the past:

http://freeformatter.com/xsd-generator.html

You basically just copy your XML file into the editor on this site and have it generate the XSD file, then you run the OpenEdge utility to create the .i file with the dataset and temp-tables and then load the data into your dataset with the READ-XML function and viola - you have the XML file in a dataset, ready to use with easy FOR EACHes.


Just another helpful thing with the website supplied in this post - it will also allow you to validate an XML file with an XSD file - also very useful when you need to create an XML file and need to validate the file against a vendor's XSD file.

Hope this will help someone out there!

All Replies

This thread is closed