All I want to do is convert my schema!



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.

Comments

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

  1. […] 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. james Avatar
    james

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

  3. bitti Avatar
    bitti

    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. Doug Avatar
    Doug

    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. Rohan Mahy Avatar
    Rohan Mahy

    Thank you, thank you.

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

  6. nico Avatar

    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. 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. Randal Bogdan Avatar

    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. evansville locksmith Avatar

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

  10. Neil Prowse Avatar

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

  11. bogaz turu Avatar

    very good \o/

  12. 3d tv Avatar

    Terrific page and some useful information!!!

  13. Inflatable Rafts Avatar

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

  14. sevylor inflatable canoes Avatar

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

  15. Owen Luecht Avatar

    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. weight loss product reviews Avatar

    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. Bathroom Renovations Sydney Avatar

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

  18. QROPS Avatar

    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. SkinCareRx Avatar

    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. New York Bankruptcy Lawyers Avatar

    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. Bankruptcy Lawyers NYC Avatar

    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. generic propecia Avatar

    Rather useful topic

  23. halo reach ranks Avatar

    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. lanyards Avatar

    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. goxatyhi Avatar

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

  26. english tuition Avatar

    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. Antonio y Cleopatra Cigars Avatar

    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. hsie tutors Avatar

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

  29. customized dog tag Avatar

    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. siteground review Avatar

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

  31. New Zealand QROPS Avatar

    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. lincoln radio Avatar

    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. buying Vigrx Plus Avatar

    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. Justin Bieber Avatar

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

  35. Steven Seagal Avatar

    nice, i’ll be back soon

  36. funny facebook status Avatar

    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. pioneer vsx-1020-k review Avatar

    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. Car Hire Malaga Airport Avatar

    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. Budapest Reseguide Avatar

    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. fheifhei Avatar

    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. Dell Avatar

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

  42. Dell Avatar

    first class piece exceptionally useful

  43. Beyonce Avatar

    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. phone jammer kit Avatar

    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. Andrew Pelt Avatar

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

  46. Andrew Pelt Avatar

    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. resor erbjudanden Avatar

    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. zero friction marketing Avatar

    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. reseguider Avatar

    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. bali reseguide Avatar

    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! 🙂