Busy making things: tinycast, github, links, photos, @mc.

All I want to do is convert my schema!

Posted: January 16th, 2007 | Author: | Filed under: Django, Java, Open Source, Projects, Python, Web Services | 53 Comments »

I’m working on a django in which I want to store GPS track information in GPX format. The bests way to store that in django is with an XMLField. An XMLField is basically just a TextField with validation via a RELAX NG Compact schema.

There is a schema for GPX. Great! The schema is an XSD though, but that’s okay, it’s a schema for XML so it should be pretty easy to just convert that to RELAX NG compact, right?

Wrong.

I pulled out my handy dandy schema swiss army knife, Trang but was shocked to find out that while it can handle Relax NG (both verbose and compact), DTD, and an XML file as input and even XSD as an output, there was just no way that I was going to be able to coax it to read an XSD. Trang is one of those things (much like Jing that I rely on pretty heavily that hasn’t been updated in years. That scares me a bit, but I keep on using ‘em.

With Trang out of the picture, I struck out with various google searches (which doesn’t happen very often). the conversion section of the RELAX NG website. The first thing that struck my eye was the Sun RELAX NG Converter. Hey, Sun’s got it all figured out. I clicked the link and was somewhat confused when I ended up at their main XML page. I scanned around and even searched the site but was unable to find any useful mention of their converter. A quick google search for sun “relax ng converter” yielded nothing but people talking about how cool it was and a bunch of confused people (just like me) wondering where they could get it.

At this point I was grasping at straws so I pulled up The Internet Archive version of the extinct Sun RELAX NG Converter page. That tipped me off to the fact that I really needed to start tracking down rngconf.jar. A google search turned up several Xdoclet and Maven cvs repositories. I grabbed a copy of the jar but it wouldn’t work without something called Sun Multi-Schema XML Validator.

That’s the phrase that pays, folks.

A search for Sun “Multi-Schema XML Validator” brought me to the java.net project page and included a prominent link to nightly builds of the multi-schema validator as well as nightly builds of rngconv. These nightly builds are a few months old, but I’m not going to pick nits at this point.

After downloading msv.zip and rngconv.zip and making sure all the jars were in the same directory I had the tools I needed to convert the XSD in hand to RELAX NG Compact. First I converted the XSD to RELAX NG Verbose with the following command: java -jar rngconv.jar gpx.xsd > gpxverbose.rng. That yielded the following RELAX NG (very) Verbose schema. Once I had that I could fall back to trusty Trang to do the rest: trang -I rng -O rnc gpxverbose.rng gpx.rng. It errored out on any(lax:##other) so I removed that bit and tried again. After a lot more work than should have been required, I had my RELAX NG Compact schema for GPX.

My experience in finding the right tools to convert XSD to RELAX NG was so absurd that I had to write it up, if only to remind myself where to look when I need to do this again in two years.


53 Comments on “All I want to do is convert my schema!”

  1. 1 From GPX to PostGIS at Matt Croydon::Postneo 2.0 said at 11:11 pm on January 20th, 2007:

    [...] Now that I have a RELAX NG Compact schema of GPX, it’s time to figure out how to get my data in to PostGIS. so I can do geospatial queries. I installed PostGIS on my Ubuntu box with these instructions. If I recall correctly, the latest version didn’t work but the previous release did. [...]

  2. 2 james said at 10:13 am on January 31st, 2007:

    thank you, thank you, thank you. I went down the same path but ran out of ideas just before “the phrase that pays”

  3. 3 bitti said at 4:21 am on March 29th, 2007:

    Thanks for getting through this hurdle. It’s unbelivable that a conversion between common Standard Formats is still such a problem.

    I now just using this shell script to get my Schemas converted:

    #!/bin/bash

    for i in $*
    do
    BN=$(basename $i .xsd)
    java -jar $PATH_TO_RNGCONV/rngconv.jar ${i} > /tmp/${BN}.rng
    java -jar $PATH_TO_TRANG/trang.jar -I rng -O rnc /tmp/${BN}.rng ${BN}.rnc
    done

  4. 4 Doug said at 12:45 am on September 24th, 2007:

    Likewise, thank you, thank you, thank you!
    I found your blog at just the right time!

    I just encountered a reference to some groups
    alternative XSLT based transformation called XSDtoRNG.xsl
    but was not sure it isn’t specific to their own particular
    schema.

    I was starting to get worried.

  5. 5 Rohan Mahy said at 11:14 pm on February 13th, 2008:

    Thank you, thank you.

    FYI: The XSDtoRND.xsl Doug referred to is available here: http://morphml.org:8080/NeuroMLValidator/NeuroMLFiles/Schemata/XSDtoRNG.xsl

  6. 6 nico said at 1:49 pm on December 9th, 2009:

    Try the later version :
    http://debeissat.nicolas.free.fr/XSDtoRNG.php
    It is not exhaustive, RelaxNG does not support type inheritance for example, but it works for simple schemas, and the structure of the resulting schema is very close to the input one.

  7. 7 Jan Wicijowski said at 7:41 am on October 7th, 2010:

    RelaxNG compact for AIML…

    I wanted to edit AIML XML files using emacs nxml. It seems to be a pretty comfortable environment, yet it uses RelaxNG compact schema definition. Let’s call it .rnc. AIML XSD schema is available right away, but the conversion process is a pain. T…

  8. 8 Randal Bogdan said at 2:27 pm on November 8th, 2010:

    This domain seems to get a good ammount of visitors. How do you advertise it? It gives a nice individual spin on things. I guess having something authentic or substantial to say is the most important factor.

  9. 9 evansville locksmith said at 2:08 pm on November 12th, 2010:

    Just thought I would comment and say great theme, did you make it for yourself? Looks superb!

  10. 10 Neil Prowse said at 8:29 pm on November 12th, 2010:

    It may be coming out of left field, but also affects things.

  11. 11 bogaz turu said at 8:16 pm on November 13th, 2010:

    very good \o/

  12. 12 3d tv said at 12:34 pm on November 15th, 2010:

    Terrific page and some useful information!!!

  13. 13 Inflatable Rafts said at 10:47 pm on November 25th, 2010:

    What do you get if you cross an elephant with the abominable snowman? A jumbo yeti.

  14. 14 sevylor inflatable canoes said at 11:42 pm on November 25th, 2010:

    Michelle Burford~ Maybe the most any of us can expect of ourselves isnt perfection but progress.

  15. 15 Owen Luecht said at 4:30 pm on December 21st, 2010:

    Hy,Awsome info and proper to your level. I don’t know if it is actually the best place to ask but do you guys have any ideea where to use some professional writers? Thanks

  16. 16 weight loss product reviews said at 11:39 pm on January 19th, 2011:

    Excellent issues?I would word that as somebody who actually doesn’t write on blogs so much (actually, this may be my first submit), I don’t suppose the term ‘lurker’ may be very becoming to a non-posting reader. It’s not your fault in the least , but possibly the blogosphere may get a hold of a greater, non-creepy name for the 90% people that enjoy reading the content .

  17. 17 Bathroom Renovations Sydney said at 2:58 pm on January 20th, 2011:

    Got some extra sites for more reading? Shoot me an email if you can, please.

  18. 18 QROPS said at 1:50 am on January 21st, 2011:

    Just right points?I’d be aware that as somebody who truly doesn’t write on blogs much (if truth be told, this may be my first post), I don’t suppose the time period ‘lurker’ is very becoming to a non-posting reader. It’s now not your fault in the least , however perhaps the blogosphere may get a hold of a greater, non-creepy identify for the 90% of us that experience studying the content material .

  19. 19 SkinCareRx said at 11:34 am on January 21st, 2011:

    I believe that may be an interesting element, it made me think a bit. Thank you for sparking my thinking cap. Occasionally I get so much in a rut that I just really feel like a record.

  20. 20 New York Bankruptcy Lawyers said at 11:54 am on January 22nd, 2011:

    Thanks for making the sincere effort to talk about this. I think very sturdy about it and would like to read more. If it’s OK, as you achieve extra extensive wisdom, could you thoughts including extra articles similar to this one with more information? It will be extremely helpful and helpful for me and my friends.

  21. 21 Bankruptcy Lawyers NYC said at 11:40 am on January 24th, 2011:

    I admire the dear knowledge you be offering for your articles. I will bookmark your blog and have my kids check up here generally. I am quite certain they will be informed lots of new stuff here than anybody else!

  22. 22 generic propecia said at 7:01 pm on January 24th, 2011:

    Rather useful topic

  23. 23 halo reach ranks said at 2:05 am on January 25th, 2011:

    Hey, I simply hopped over in your site by the use of StumbleUpon. Not something I’d in most cases read, however I appreciated your feelings none the less. Thanks for making something worth reading.

  24. 24 lanyards said at 6:03 am on January 25th, 2011:

    I like the precious data you offer to your articles. I will bookmark your blog and have my children check up here generally. I am moderately sure they’re going to be told lots of new stuff here than anybody else!

  25. 25 goxatyhi said at 1:13 pm on January 25th, 2011:

    TO8lO4 stbfgfmvvaso, [url=http://zqbueyaswheq.com/]zqbueyaswheq[/url], [link=http://gaiinknopclr.com/]gaiinknopclr[/link], http://ifjgsacisjem.com/

  26. 26 english tuition said at 5:21 am on January 26th, 2011:

    Your weblog is fine. I just wish to comment on the design. Its too loud. Its doing way an excessive amount of and it takes away from what youve received to say which I feel is basically important. I dont know if you happen to didnt suppose that your phrases could maintain everyones attention, however you had been wrong. Anyway, in my language, there arent a lot good source like this.

  27. 27 Antonio y Cleopatra Cigars said at 4:15 am on January 27th, 2011:

    I’ve been studying your entries all over my morning break, and I must admit the whole article has been very enlightening and very well written. I assumed I’d allow you to realize that for some reason this blog does not view neatly in Web Explorer 8. I desire Microsoft might prevent converting their software. I’ve a query for you. Might you mind exchanging weblog roll hyperlinks? That might be actually neat!

  28. 28 hsie tutors said at 11:30 am on January 27th, 2011:

    Really nice and helpful post. I always appreciate topics like these being discussed to aware people. thanks for sharing.

  29. 29 customized dog tag said at 2:26 am on January 28th, 2011:

    Thanks for making the trustworthy try to explain this. I believe very strong approximately it and would like to be informed more. If it’s OK, as you reach extra extensive knowledge, would you mind including extra posts very similar to this one with additional info? It will be extraordinarily helpful and useful for me and my colleagues.

  30. 30 siteground review said at 9:02 pm on February 1st, 2011:

    Only wanna state that this is invaluable , Thanks for taking your time to write this.

  31. 31 New Zealand QROPS said at 11:41 am on February 4th, 2011:

    I’m speechless. This is a superb weblog and really engaging too. Nice work! That’s not in point of fact so much coming from an novice publisher like me, but it’s all I may just say after diving into your posts. Nice grammar and vocabulary. Not like different blogs. You really recognize what you?re speaking about too. Such a lot that you made me need to discover more. Your blog has develop into a stepping stone for me, my friend.

  32. 32 lincoln radio said at 10:24 am on February 5th, 2011:

    Thanks for making the honest strive to give an explanation for this. I feel very sturdy about it and want to be informed more. If it’s OK, as you attain extra in depth wisdom, would you thoughts including extra posts similar to this one with more information? It would be extraordinarily useful and helpful for me and my colleagues.

  33. 33 buying Vigrx Plus said at 2:13 am on February 6th, 2011:

    Unusual this put up is totaly unrelated to what I used to be looking google for, however it was listed on the first page. I suppose your doing something proper if Google likes you sufficient to place you at the first web page of a non related search.

  34. 34 Justin Bieber said at 6:57 pm on February 8th, 2011:

    very good luck along with your blog! you won me as being a follower

  35. 35 Steven Seagal said at 7:50 pm on February 8th, 2011:

    nice, i’ll be back soon

  36. 36 funny facebook status said at 5:41 am on February 9th, 2011:

    I’ve been reading your entries all over my morning holiday, and I must admit the whole article has been very enlightening and rather well written. I thought I would can help you recognize that for a few explanation why this weblog does now not view neatly in Internet Explorer 8. I want Microsoft may stop changing their software. I have a query for you. Might you mind exchanging blog roll hyperlinks? That will be in reality neat!

  37. 37 pioneer vsx-1020-k review said at 7:06 am on February 9th, 2011:

    Thank you for making the trustworthy attempt to speak about this. I believe very strong approximately it and would like to read more. If it’s OK, as you achieve more intensive knowledge, may you mind including more articles very similar to this one with more information? It would be extraordinarily useful and helpful for me and my friends.

  38. 38 Car Hire Malaga Airport said at 6:22 am on February 10th, 2011:

    I am always researching online for articles that can help me get further ahead with responsibilities. Thanks a million for http://www.postneo.com/2007/01/16/all-i-want-to-do-is-convert-my-schema!

  39. 39 Budapest Reseguide said at 9:43 am on February 10th, 2011:

    i’ve begun to visit this cool site a few times now and i have to tell you that i find it quite good actually. continue doing what you’re doing! =p

  40. 40 fheifhei said at 7:15 am on February 11th, 2011:

    Concise and well crafted, appreciate the data. Do you care if I post a number of this on my site if I include a reference to this site?

  41. 41 Dell said at 9:49 am on February 11th, 2011:

    Well, I will oftentimes appear right here ! I guarantee that!

  42. 42 Dell said at 10:55 am on February 11th, 2011:

    first class piece exceptionally useful

  43. 43 Beyonce said at 11:37 am on February 11th, 2011:

    a buddy just referred me to this web page, upon searching i found out that this websites is quite revolutionary and educational. You’ll find unusual blog pages now that has considerably more interaction in between visitors. Happy to land on these cool content.!!|.

  44. 44 phone jammer kit said at 11:42 am on February 11th, 2011:

    Thank you for making the sincere strive to give an explanation for this. I feel very sturdy approximately it and want to be told more. If it’s OK, as you reach more extensive knowledge, might you thoughts adding more posts similar to this one with more information? It would be extremely useful and useful for me and my colleagues.

  45. 45 Andrew Pelt said at 5:50 pm on February 11th, 2011:

    Hi there may I use some of the information here in this post if I provide a link back to your site?

  46. 46 Andrew Pelt said at 2:53 pm on February 14th, 2011:

    Where did you got this much info on your blog from?? Also can i take the initiave to take the feeds from your blog for my yoga website?? But cant find the RSS feeds link here!!

  47. 47 resor erbjudanden said at 3:34 pm on February 14th, 2011:

    i’ve checked this site a couple of times now and i have to say that i find it quite exeptional actually. keep it up! =)

  48. 48 zero friction marketing said at 3:13 am on February 16th, 2011:

    What would many of us do without the magnificent ideas you write about on this web site? Who has got the tolerance to deal with essential topics for the health of common visitors like me? My partner and i and my buddies are very lucky to have your web site among the ones we generally visit. It is hoped you know how much we enjoy your effort! Best wishes through us all.

  49. 49 reseguider said at 4:53 am on February 16th, 2011:

    continue with the the nice work on the blog. I appreciate it. Could use some more frequent updates, but i am sure you got better things to do like we all have to do unfortunately. :p

  50. 50 bali reseguide said at 6:44 pm on February 16th, 2011:

    i have checked this site a few times now and i have to say that i find it quite great actually. keep the nice work up! :)

  51. 51 web hosting in delhi said at 2:17 am on February 18th, 2011:

    Good day, I simply hopped over on your website online by means of StumbleUpon. Now not something I might normally learn, however I appreciated your thoughts none the less. Thank you for making something price reading.

  52. 52 Emma Mae said at 4:02 am on February 20th, 2011:

    I’m happy I found this blog, I couldnt discover any information on this topic matter prior to. I also run a site and if you want to ever serious in a little bit of guest writing for me if achievable really feel free to let me know, i’m always appear for people to verify out my site. Please stop by and leave a comment sometime!

  53. 53 Vincent Page said at 10:00 am on February 22nd, 2011:

    I simply wanted to write a quick note so as to express gratitude to you for these pleasant points you are sharing at this site. My time consuming internet research has at the end of the day been paid with awesome insight to share with my neighbours. I would declare that many of us site visitors are definitely blessed to exist in a fabulous place with many special professionals with beneficial hints. I feel truly lucky to have seen your weblog and look forward to many more cool minutes reading here. Thanks a lot again for everything.