Пример #1
0
void
gdf_frag_from_file(const char *fname, const char *xml_id, FILE *outfp)
{
  char const *fnlist[2];
  static struct frag fragdata;
  fragdata.xid = xml_id;
  fragdata.nesting = 0;
  fragdata.fp = outfp;
  fnlist[0] = fname;
  fnlist[1] = NULL;
  runexpatNSuD(i_list, fnlist, gdf_sH, gdf_eH, NULL, &fragdata);
}
Пример #2
0
/* Load the XML serialization of an XCL tree back into memory */
struct xcl_context *
xcl_load(const char *xcl_fn, int setup_formsets)
{
  const char *fname[2];
  struct xcl_context *xcp = xcl_create();
  char ns_char[2];
  xcp->sigs = sig_context_init();
  xcp->linkbase = new_linkbase();
  ns_char[0] = EXPAT_NS_CHAR; ns_char[1] = '\0';
  fname[0] = xcl_fn;
  fname[1] = NULL;
  curr_meta = NULL;
  if (!access(fname[0],R_OK))
    runexpatNSuD(i_list, fname, xcl_sH, xcl_eH, ns_char, xcp);
  else
    fprintf(stderr,"xcl_load: can't open XCL input %s\n", fname[0]);
  return xcp;
}
Пример #3
0
void
content(struct content_opts *cop, const char *input)
{
  char const *fnlist[2];
  static struct frag fragdata;

  if (access(input, R_OK))
    {
      extern const char *no_html;
      execl("/bin/cat", "cat", no_html, NULL);
      perror("execl failed");
      exit(0);
    }

  fragdata.cop = cop;
  fragdata.xid = cop->chunk_id;
  fragdata.nesting = 0;
  fragdata.fp = stdout;
  fnlist[0] = input;
  fnlist[1] = NULL;

  /* Setting fragdata.nesting here means that the normal end processing cannot
     occur in printEnd so after running expat we have to finish the wrapper
     manually later in this routine */
  if ((cop->echo || cop->wrap) && !cop->chunk_id)
    {
      printHTMLStart(&fragdata);
      fragdata.nesting = 1;
    }

  runexpatNSuD(i_list, fnlist, content_sH, content_eH, NULL, &fragdata);

  if ((cop->echo || cop->wrap) && !cop->chunk_id)
    fputs("</body></html>", fragdata.fp);

  exit(0);
}