InputSource EntityOpen(Entity e) { FILE16 *f16; if(e->type == ET_external) { const char8 *url = EntityURL(e); if(!url || !(f16 = url_open(url, 0, "r", 0))) return 0; } else { f16 = MakeFILE16FromString((char *)e->text, -1, "r"); } return NewInputSource(e, f16); }
InputSource catalog_entity_open(Entity ent, void *arg) { Catalog catalog = arg; if(!ent->url) ent->url = ResolveExternalIdentifier(catalog, ent->publicid, ent->systemid, catalog->default_prefer); #if 0 fprintf(stderr, "catalog: %s %s -> %s\n", ent->publicid ? ent->publicid : "(no pubid)", ent->systemid ? ent->systemid : "(no sysid)", EntityURL(ent)); #endif return EntityOpen(ent); }
InputSource EntityOpen(Entity e) { FILE16 *f16; char8 *r_url; if(e->type == ET_external) { const char8 *url = EntityURL(e); if(!url || !(f16 = url_open(url, 0, "r", &r_url))) return 0; if(r_url && !e->base_url) EntitySetBaseURL(e, r_url); Free(r_url); } else { f16 = MakeFILE16FromString((char *)e->text, -1, "r"); } return NewInputSource(e, f16); }