MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlSAX2StartDocument

Function xmlSAX2StartDocument

ThirdParty/libxml2/vtklibxml2/SAX2.c:812–855  ·  view source on GitHub ↗

* xmlSAX2StartDocument: * @ctx: the user data (XML parser context) * * called when the document start being processed. */

Source from the content-addressed store, hash-verified

810 * called when the document start being processed.
811 */
812void
813xmlSAX2StartDocument(void *ctx)
814{
815 xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
816 xmlDocPtr doc;
817
818 if (ctx == NULL) return;
819
820#ifdef LIBXML_HTML_ENABLED
821 if (ctxt->html) {
822 if (ctxt->myDoc == NULL)
823 ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL);
824 if (ctxt->myDoc == NULL) {
825 xmlSAX2ErrMemory(ctxt);
826 return;
827 }
828 ctxt->myDoc->properties = XML_DOC_HTML;
829 ctxt->myDoc->parseFlags = ctxt->options;
830 } else
831#endif
832 {
833 doc = ctxt->myDoc = xmlNewDoc(ctxt->version);
834 if (doc != NULL) {
835 doc->properties = 0;
836 if (ctxt->options & XML_PARSE_OLD10)
837 doc->properties |= XML_DOC_OLD10;
838 doc->parseFlags = ctxt->options;
839 doc->standalone = ctxt->standalone;
840 } else {
841 xmlSAX2ErrMemory(ctxt);
842 return;
843 }
844 if ((ctxt->dictNames) && (doc != NULL)) {
845 doc->dict = ctxt->dict;
846 xmlDictReference(doc->dict);
847 }
848 }
849 if ((ctxt->myDoc != NULL) && (ctxt->myDoc->URL == NULL) &&
850 (ctxt->input != NULL) && (ctxt->input->filename != NULL)) {
851 ctxt->myDoc->URL = xmlPathToURI((const xmlChar *)ctxt->input->filename);
852 if (ctxt->myDoc->URL == NULL)
853 xmlSAX2ErrMemory(ctxt);
854 }
855}
856
857/**
858 * xmlSAX2EndDocument:

Callers 1

startDocumentFunction · 0.85

Calls 5

htmlNewDocNoDtDFunction · 0.85
xmlSAX2ErrMemoryFunction · 0.85
xmlNewDocFunction · 0.85
xmlDictReferenceFunction · 0.85
xmlPathToURIFunction · 0.85

Tested by

no test coverage detected