/* * DocumentContext.c : implementation of the DocumentContext interface * as defined by * Document Object Model (Core) Level 1 * http://www.w3.org/TR/WD-DOM/level-one-core.html * * Daniel.Veillard@w3.org * * $Id: DocumentContext.c,v 1.1 1998/06/14 03:22:00 daniel Exp $ */ #include "config.h" #include #include #include "Document.h" #include "DocumentContext.h" /* * Currently a Document Context is empty ! Waiting for DOM2 ... */ domDocumentContextPtr createDocumentContext(domDocumentPtr doc) { domDocumentContextPtr ret; if (doc == NULL) return(NULL); if (doc->contextInfo != NULL) return(doc->contextInfo); ret = (domDocumentContextPtr) malloc(sizeof(domDocumentContext)); if (ret == NULL) return(NULL); doc->contextInfo = ret; ret->document = doc; return(ret); } /* * Destroying a Context, a piori one doesn't destroy the Document itself */ void destroyDocumentContext(domDocumentContextPtr ctxt) { if (ctxt == NULL) return; if (ctxt->document != NULL) ctxt->document->contextInfo = NULL; ctxt->document = (void *) 0xdeadbeef; free(ctxt); }