/// <summary>
 /// Creates a spine out of all resources in the resources. The generated spine
 /// consists of all XHTML pages in order of their href.
 /// </summary>
 /// <param name="resources"></param>
 private static Spine generateSpineFromResources(Resources resources)
 {
     Spine result = new Spine();
     List<String> resourceHrefs = new List<String>(resources.getAllHrefs());
     foreach (String resourceHref in resourceHrefs)
     {
         Resource resource = resources.getByHref(resourceHref);
         if (resource.getMediaType() == MediatypeService.NCX)
         {
             result.setTocResource(resource);
         }
         else if (resource.getMediaType() == MediatypeService.XHTML)
         {
             result.addSpineReference(new SpineReference(resource));
         }
     }
     return result;
 }