I upgraded libxml2 version and a bug encountered in this release: regexp error : Memory allocation failed : adding transition This line appears many times, upon I stop debug. Many usefull data: 1) The XSD used includes another XSD's. 2) The XSD path have spaces in the path, not in the file name. 3) The included XSD's are in the same location as the XSD used. 4) This piece of code works fine with 2.6.17, but now it don't works. 5) I attach an XML example and the XSD's (ORM_O01.xsd is used).6) The path used for the xsd is "C:\Documents and Settings\samueldg\Escritorio\HL7-2.3\ORM_O01.xsd" (without cuotes).
Any help? Thanks in advance. Regards, The piece of code is: bool CMsgHL7::f_parsear() { bool ret = true; try { xmlDocPtr x_doc = 0; xmlCharEncoding x_encode; x_encode = XML_CHAR_ENCODING_8859_1; x_doc = xmlReadDoc( BAD_CAST m_xml.c_str(), 0, // Uri xmlGetCharEncodingName( x_encode ), // Encode 0 // Opciones ); if( !x_doc ) { xmlErrorPtr x_error = 0; x_error = xmlGetLastError(); setError( 1, x_error->message ); ret = false; } else { xmlNsPtr x_ns = 0; xmlNodePtr x_raiz = xmlDocGetRootElement( x_doc ); xmlSchemaParserCtxtPtr x_sh_parser_ctxt; // Metemos el namespace adecuadox_ns = xmlNewNs( x_raiz, BAD_CAST CHL7Util::getNSURI().c_str(), 0 );
if( x_ns ) { CHL7Util::asignarNs( x_raiz, x_ns ); // Recursive asign. } ret = f_cargar_xmldoc( x_doc ); // Load the x_doc into my // internals. x_sh_parser_ctxt = xmlSchemaNewParserCtxt( CHL7Util::getXSDURL( reinterpret_cast< const char * >( x_raiz->name ) ).c_str() ); if( !x_sh_parser_ctxt ) { xmlErrorPtr x_error = 0; x_error = xmlGetLastError(); setError( 1, x_error->message ); ret = false; } else { xmlSchemaPtr x_sh = 0; // El esquema xmlSchemaSetParserErrors(x_sh_parser_ctxt, (xmlSchemaValidityErrorFunc) fprintf, (xmlSchemaValidityWarningFunc) fprintf, stderr); //************************** // HERE IS THE ERROR, in the xmlSchemaParse call. //************************** x_sh = xmlSchemaParse( x_sh_parser_ctxt ); if( !x_sh ) { xmlErrorPtr x_error = 0; x_error = xmlGetLastError(); setError( 1, x_error->message ); ret = false; } else { xmlSchemaValidCtxtPtr x_sh_ctxt = xmlSchemaNewValidCtxt( x_sh ); if( !x_sh_ctxt ) { xmlErrorPtr x_error = 0; x_error = xmlGetLastError(); setError( 1, x_error->message ); ret = false; } else { int res = xmlSchemaValidateDoc(x_sh_ctxt, x_doc); if( res ) { xmlErrorPtr x_error = 0; x_error = xmlGetLastError(); setError( 1, x_error->message ); ret = false; } xmlSchemaFreeValidCtxt(x_sh_ctxt); } xmlSchemaFree( x_sh ); } xmlSchemaFreeParserCtxt( x_sh_parser_ctxt ); } xmlFreeDoc(x_doc);//xmlCleanupParser(); // Posiblemente haga falta descomentar esta línea.
} } catch( ... ) { setError( 1, "Excepción no controlada en CMsgHL7::f_parsear()" ); ret = false; } return ret; } -- Samuel Díaz García Director Gerente ArcosCom Wireless, S.L.L. CIF: B11828068 c/ Romero Gago, 19 Arcos de la Frontera 11630 - Cadiz http://www.arcoscom.com mailto:samueldg arcoscom com msn: samueldg arcoscom com Móvil: 651 93 72 48 Tlfn.: 956 70 13 15 Fax: 956 70 34 83
Attachment:
files_used.zip
Description: application/zip-comressed
Attachment:
samueldg.vcf
Description: Vcard