Redland
view release on metacpan or search on metacpan
redland/raptor/src/raptor_libxml.c view on Meta::CPAN
va_end(args);
}
void
raptor_libxml_validation_warning(void* user_data, const char *msg, ...)
{
va_list args;
raptor_sax2* sax2=(raptor_sax2*)user_data;
int prefix_length=strlen(xml_validation_warning_prefix);
int length;
char *nmsg;
va_start(args, msg);
raptor_libxml_update_document_locator(sax2, sax2->locator);
length=prefix_length+strlen(msg)+1;
nmsg=(char*)RAPTOR_MALLOC(cstring, length);
if(nmsg) {
strcpy(nmsg, xml_validation_warning_prefix);
strcpy(nmsg+prefix_length, msg);
if(nmsg[length-2]=='\n')
nmsg[length-2]='\0';
}
raptor_libxml_call_handler(sax2->warning_data,
sax2->warning_handler, sax2->locator,
nmsg ? nmsg : msg,
args);
if(nmsg)
RAPTOR_FREE(cstring,nmsg);
va_end(args);
}
void
raptor_libxml_init(raptor_sax2* sax2, raptor_uri *base_uri)
{
xmlSAXHandler *sax=&sax2->sax;
sax->internalSubset = raptor_libxml_internalSubset;
sax->isStandalone = raptor_libxml_isStandalone;
sax->hasInternalSubset = raptor_libxml_hasInternalSubset;
sax->hasExternalSubset = raptor_libxml_hasExternalSubset;
sax->resolveEntity = raptor_libxml_resolveEntity;
sax->getEntity = raptor_libxml_getEntity;
sax->getParameterEntity = raptor_libxml_getParameterEntity;
sax->entityDecl = raptor_libxml_entityDecl;
sax->attributeDecl = NULL; /* attributeDecl */
sax->elementDecl = NULL; /* elementDecl */
sax->notationDecl = NULL; /* notationDecl */
sax->unparsedEntityDecl = raptor_libxml_unparsedEntityDecl;
sax->setDocumentLocator = raptor_libxml_set_document_locator;
sax->startDocument = raptor_libxml_startDocument;
sax->endDocument = raptor_libxml_endDocument;
sax->startElement= raptor_sax2_start_element;
sax->endElement= raptor_sax2_end_element;
sax->reference = NULL; /* reference */
sax->characters= raptor_sax2_characters;
sax->cdataBlock= raptor_sax2_cdata; /* like <![CDATA[...]> */
sax->ignorableWhitespace= raptor_sax2_cdata;
sax->processingInstruction = NULL; /* processingInstruction */
sax->comment = raptor_sax2_comment; /* comment */
sax->warning=(warningSAXFunc)raptor_libxml_warning;
sax->error=(errorSAXFunc)raptor_libxml_error;
sax->fatalError=(fatalErrorSAXFunc)raptor_libxml_fatal_error;
#ifdef RAPTOR_LIBXML_XMLSAXHANDLER_EXTERNALSUBSET
sax->externalSubset = raptor_libxml_externalSubset;
#endif
#ifdef RAPTOR_LIBXML_XMLSAXHANDLER_INITIALIZED
sax->initialized = 1;
#endif
}
void
raptor_libxml_init_sax_error_handlers(xmlSAXHandler *sax) {
sax->warning=(warningSAXFunc)raptor_libxml_warning;
sax->error=(errorSAXFunc)raptor_libxml_error;
sax->fatalError=(fatalErrorSAXFunc)raptor_libxml_fatal_error;
#ifdef RAPTOR_LIBXML_XMLSAXHANDLER_INITIALIZED
sax->initialized = 1;
#endif
}
void
raptor_libxml_init_generic_error_handlers(raptor_parser *rdf_parser)
{
xmlGenericError = (xmlGenericErrorFunc)raptor_libxml_generic_error;
xmlGenericErrorContext = rdf_parser;
}
void
raptor_libxml_free(xmlParserCtxtPtr xc) {
libxml2_endDocument(xc);
xmlFreeParserCtxt(xc);
}
/* end if RAPTOR_XML_LIBXML */
#endif
( run in 0.627 second using v1.01-cache-2.11-cpan-39bf76dae61 )