Alvin Poh

Tag: document

How To Generate XSD from XML / Convert XML to XSD

I had to complete a project that involved working with a web service. Problem was, I had the XML files, but needed the XML Schema Definition (XSD) schemas, and coming up with them manually would have been too tedious and would have took too much time. So I went online, and found 2 reliable methods. Oh, and they are free!

Generate XSD from XML Tool

The first is Trang. You can get it here from the official Trang site, or here where I’ve had it mirrored: Download Trang

Using it is simple: Just extract it, then go to your command-line, and run it against any XML document that you may have. Trang is written in Java, so it’s cross-platform and compatible with any platform that can run the Java Virtual Machine. To use it, just use it in this syntax:

trang.jar <your XML> <your desired XSD>

An example:

trang.jar YourDocument.xml YourSchema.xsd

Viola! You’ll find your XSD automatically generated!

Generate XSD from XML Online

If you don’t want to go through Trang, you can use an online tool. The only online XML to XSD tool that I found was this one: Generate XSD from XML Online

It’s pretty good too, and can give you a quick XSD from your XML document.

Best XML Book for Beginners

If you’re interested in XML and want to learn more about it, I highly recommend this XML book: XML: Visual QuickStart Guide

Have fun! 😀

How To Make and Run Batch Files In Terminal In Mac OSX

I use batch files sometimes when I was using Windows because it saves a lot of time when you need to run a batch of commands frequently. With a batch file, you save all the commands into one file, and just run the batch file, instead of your gazillion commands individually.

I was facing the same situation in Mac OSX when I realised that I didn’t know how to create a batch file in Mac OSX. Turns out it’s pretty easy. Mac OSX is unix-based, so I could use the unix equivalent (which is called a script too). What you need to do is to put all the commands you want into a plain text document, and save it with a name (without the .txt extension preferably, but that really doesn’t matter…it just looks more right that way).

In Windows, that’s all that you need to do, but for the Mac, you’ll need to make sure that you edit your batch file’s permissions so it is executable. So for example, if your batch file is named batchfile, one way to change its permissions is to right-click on it, click on “Show Info”, and then change the permissions under “Permissions” to show 755.

What 755 does is to give permissions of 7 to you, 5 to your user group, and 5 to everyone else. With a permission of 7, you can write to the file and execute it. With a permission of 5, you can execute the file but not write to it.

Another way is for you to change permissions of the file is to go into Terminal, and enter this command that changes its permissions. You’ll need to be in the directory that batchscript is in for the following command to work (or you’ll need to specify its full path):

chmod 755 batchscript

Now to run your batch file, you just need to either specify the full path to the batch file, or if you are already in the directory where it is located, you can type:


Note that you have to put the “./” in front of your filename, in order to tell Terminal to look for the file in the current directory.

And with that, you’ll have a working batch file in Mac OSX!

How To Convert Open Office document (.odf) to Microsoft Office Document Format With A Converter

If you have an Open Office document and want to convert it to Word or other Microsoft Office formats so that you can read it, then this is for you.

convert odf to microsoft office

Sometimes you might get a document in ODF format, which is the Open Office document format. This is a problem for some people because they might just have Microsoft Office, and not Open Office. The Open Office ODF converter exists because people don’t want to download and install the entire Open Office suite just to open one file.

You’ll need this handy program then. It converts from .odt to .doc and other formats.

Copyright © 2015 Alvin Poh

Web Hosting by VodienUp ↑