public void Feed2XML(PostsType posts, Writer out) throws Exception {
    JAXBContext context = JAXBContext.newInstance(posts.getClass());
    Marshaller marshaller = context.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
    marshaller.marshal(posts, out);

    // System.out.println("data: " + out);
  }
 private void completeLinks(PostsType posts) {
   for (PostType post : posts.getPost()) {
     if (post.getLinks() != null) {
       for (LinkType link : post.getLinks().getLink()) {
         if (!link.getUrl().matches("^http://.*")) {
           link.setUrl(
               "http://"
                   + post.getSource()
                   + link.getUrl().substring(link.getUrl().matches("^/.*") ? 1 : 0));
         }
       }
     }
   }
 }