예제 #1
0
/* ---------------------------------------------------------------------------- */
private	char *	xml_element_value( struct xml_element * eptr, char * nptr )
{
	struct	xml_element * aptr;
	if (!( aptr = document_element( eptr, nptr ) ))
		return( (char *) 0);
	else	return( aptr->value );
}
예제 #2
0
/*	---------------------------------------------------	*/
public	struct	xml_element * xsd_type( struct xml_element * xsd, char * nptr )
{
	struct	xml_element * wptr=(struct xml_element *) 0;
	struct	xml_element * tptr=(struct xml_element *) 0;
	struct	xml_atribut * aptr;
	char 		    * vptr;
	if ( check_debug() ) { printf("xsd:type( %s )\n",nptr); }
	for (	wptr = document_element( xsd, _XSD_COMPLEX );
		wptr != (struct xml_element *) 0;
		wptr = wptr->next )
	{
		if ( strcasecmp( wptr->name, _XSD_COMPLEX ) )
			continue;
		else if (!( aptr = document_atribut( wptr, _XSD_NAME ) ))
			continue;
		else if (!( aptr->value ))
			continue;
		else if (!( vptr = occi_unquoted_value( aptr->value ) ))
			continue;
		else if (!( strcmp( vptr, nptr ) ))
		{
			liberate( vptr );
			return( wptr );
		}
		else
		{
			liberate( vptr );
			continue;
		}
	}
	if ( check_debug() ) { printf("xsd:failure( attribute %s )\n",nptr); }
	return( wptr );
}
예제 #3
0
int
usf_reader_c::probe_file(mm_text_io_c *in,
                         uint64_t) {
  try {
    auto doc = mtx::xml::load_file(in->get_file_name());
    return doc && std::string{ doc->document_element().name() } == "USFSubtitles" ? 1 : 0;

  } catch(...) {
  }

  return 0;
}
예제 #4
0
int
usf_reader_c::probe_file(mm_text_io_c *in,
                         uint64_t) {
  try {
    auto doc = mtx::xml::load_file(in->get_file_name(), pugi::parse_default | pugi::parse_declaration | pugi::parse_doctype | pugi::parse_pi | pugi::parse_comments, 10 * 1024 * 1024);
    return doc && std::string{ doc->document_element().name() } == "USFSubtitles" ? 1 : 0;

  } catch(...) {
  }

  return 0;
}
예제 #5
0
int
usf_reader_c::probe_file(mm_text_io_c *in,
                         uint64_t) {
  try {
    std::string line, content;

    in->setFilePointer(0);

    while ((content.length() < 1000) && in->getline2(line, 1000))
      content += line;

    if (   (content.find("<?xml") == std::string::npos)
        && (content.find("<!--")  == std::string::npos))
      return 0;

    auto doc = mtx::xml::load_file(in->get_file_name(), pugi::parse_default | pugi::parse_declaration | pugi::parse_doctype | pugi::parse_pi | pugi::parse_comments, 10 * 1024 * 1024);
    return doc && std::string{ doc->document_element().name() } == "USFSubtitles" ? 1 : 0;

  } catch(...) {
  }

  return 0;
}