Exemplo n.º 1
0
static void
task_list_io_xml_load (CTaskList  * self,
		       gchar const* path)
{
	xmlSAXHandler sax = {
		NULL, // internalSubset
		NULL, // isStandalone
		NULL, // hasInternalSubset
		NULL, // hasExternalSubset
		NULL, // resolveEntity
		NULL, // getEntity
		NULL, // entityDecl
		NULL, // notationDecl
		NULL, // attributeDecl
		NULL, // elementDecl
		NULL, // unparsedEntityDecl
		NULL, // setDocumentLocator
		NULL, // startDocument
		NULL, // endDocument
		NULL, // startElement
		NULL, // endElement
		NULL, // reference
		sax_characters_cb,
		NULL, // ignorableWhitespace
		NULL, // processingInstruction
		NULL, // comment
		sax_warning_cb,
		sax_error_cb,
		NULL, // fatalError (won't be called)
		NULL, // getParameterEntity
		NULL, // cdataBlock
		NULL, // externalSubset
		XML_SAX2_MAGIC, // initialized
		NULL, // _private
		sax_start_element_cb,
		sax_end_element_cb,
		NULL  // serror
	};
	struct ParserData pdata = {
		0,
		self,
		NULL
	};

	gchar* xml_path = task_list_io_xml_path (path);
	xmlSAXParseFileWithData (&sax,
				 xml_path,
				 0,
				 &pdata);
	g_free (xml_path);
}
Exemplo n.º 2
0
static void f_parse_xml(INT32 args)
{
  xmlDocPtr   doc = NULL;
  
  switch (THIS->parsing_method) {
      case PARSE_PUSH_PARSER:
        Pike_error("Push parser not implemented yet. Please bug [email protected] to implement it.");
        
      case PARSE_MEMORY_PARSER:
        doc = xmlSAXParseMemory(THIS->sax, THIS->input_data->str, THIS->input_data->len, 1);
        break;

      case PARSE_FILE_PARSER:
        doc = xmlSAXParseFileWithData(THIS->sax, THIS->input_data->str, 1, NULL);
        break;
  }
  if ( doc != NULL )
    xmlFreeDoc(doc);

  push_int(0);
}