Recursion and Rails deployment (though not at the same time)

| | Comments (0)

I HATE recursion. Last night, out of pure boredom I started to write a class to generate an XSD from an XML document, which will naturally involve some type of tree-traversal. The base logic was:


level = 0
Start at the root

   Are there any children?
      Yes - Go to first child, increment level counter, and repeat
      No - Add tag to array of tags at level

When done, start with first element, extract attributes, check data type, etc and generate xs:blah tag. Write out to out.xsd.

Recursion and I have never really gotten along, and didn't fair any better here. I either got precisely one tag before the code stopped, or it get running, randomly jumping back the same place and starting over.

I may come back to look at it tomorrow if I get stuck on something at work.

As an aside, this is an absolute must-read for those interested in Rails deployment strategies (I've been told at work that I'm interested. Very interested indeed.).

Leave a comment

About this Entry

This page contains a single entry by Phil Ratzsch published on March 23, 2008 10:01 PM.

XSD, breakroom phosphate was the previous entry in this blog.

Ruby session error and leaving for Utah is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.