hi,
I wrote function to validate my xml file against specified schema, it works fine in most of the cases, but some times validation failed because following parse Error.
The process cannot access the file because it is being used by another process.
can any budy help me, to find out its unexpected behaviours or I missed somthing in my code.
I have close file pointer before validation process. If i missed somthing in my code then it has to failed every time, but this is not the case.
Please sagest me.
I am using C++ on windows.
Code:
//clientNamespace = Client namespace
// fullSchemaFileN ame = Schema file path
// strDataFileName = XML file path
[HTML]
MSXML2::IXMLDOM Document2Ptr docMainXML;
MSXML2::IXMLDOM SchemaCollectio n2Ptr schemaCache;
docMainXML.Crea teInstance(__uu idof(MSXML2::Fr eeThreadedDOMDo cument40)
schemaCache.Cre ateInstance(__u uidof(MSXML2::X MLSchemaCache40 ))
docMainXML->async=false;
schemaCache->add(_bstr_t(cl ientNamespace.c _str()),_varian t_t(fullSchemaF ileName.c_str() ));
docMainXML->schemas = _variant_t((MSX ML2::IXMLDOMSch emaCollection2P tr)schemaCache, true);
VARIANT_BOOL isValidated = docMainXML->load(strDataFi leName.c_str()) ;
if(isValidated == FALSE)
{
MSXML2::IXMLDOM ParseErrorPtr p = docMainXML->parseError;
throw XMLDocumentExce ption(cs("Reaso n:%s Line:%ld",(cons t char*)p->reason,p->line),_QL_);
}[/HTML]
Thank you
Abhinay
I wrote function to validate my xml file against specified schema, it works fine in most of the cases, but some times validation failed because following parse Error.
The process cannot access the file because it is being used by another process.
can any budy help me, to find out its unexpected behaviours or I missed somthing in my code.
I have close file pointer before validation process. If i missed somthing in my code then it has to failed every time, but this is not the case.
Please sagest me.
I am using C++ on windows.
Code:
//clientNamespace = Client namespace
// fullSchemaFileN ame = Schema file path
// strDataFileName = XML file path
[HTML]
MSXML2::IXMLDOM Document2Ptr docMainXML;
MSXML2::IXMLDOM SchemaCollectio n2Ptr schemaCache;
docMainXML.Crea teInstance(__uu idof(MSXML2::Fr eeThreadedDOMDo cument40)
schemaCache.Cre ateInstance(__u uidof(MSXML2::X MLSchemaCache40 ))
docMainXML->async=false;
schemaCache->add(_bstr_t(cl ientNamespace.c _str()),_varian t_t(fullSchemaF ileName.c_str() ));
docMainXML->schemas = _variant_t((MSX ML2::IXMLDOMSch emaCollection2P tr)schemaCache, true);
VARIANT_BOOL isValidated = docMainXML->load(strDataFi leName.c_str()) ;
if(isValidated == FALSE)
{
MSXML2::IXMLDOM ParseErrorPtr p = docMainXML->parseError;
throw XMLDocumentExce ption(cs("Reaso n:%s Line:%ld",(cons t char*)p->reason,p->line),_QL_);
}[/HTML]
Thank you
Abhinay
Comment