Hello,
I need to know how to validate and XML file against an XSD. Here is the code that I have, but it fails on me. Can anyone help?
HRESULT hr = m_plDomDocument.CreateInstance(__uuidof(DOMDocument40));//part of the XML DOM requirements
IXMLDOMSchemaCollectionPtr m_pSchema.CreateInstance("Msxml2.XMLSchemaCache.4.0"
if(m_pSchema)
m_pSchema->add("x-schema:test","test.xsd" //fails here with the add statement
if (FAILED(hr))
{
_com_error er(hr);
WriteErrorsToLog(er.ErrorMessage());
}
// specify xml file name
m_strFileName = finder.GetFileName();
// convert xml file name string to something COM can handle (BSTR)
_bstr_t bstrFileName;
bstrFileName = m_strFileName.AllocSysString();
// call the IXMLDOMDocumentPtr's load function to load the XML document
variant_t vResult;
try
{
vResult = m_plDomDocument->load(bstrFileName);
.
.
.
}
Any ideas?
I need to know how to validate and XML file against an XSD. Here is the code that I have, but it fails on me. Can anyone help?
HRESULT hr = m_plDomDocument.CreateInstance(__uuidof(DOMDocument40));//part of the XML DOM requirements
IXMLDOMSchemaCollectionPtr m_pSchema.CreateInstance("Msxml2.XMLSchemaCache.4.0"
if(m_pSchema)
m_pSchema->add("x-schema:test","test.xsd" //fails here with the add statement
if (FAILED(hr))
{
_com_error er(hr);
WriteErrorsToLog(er.ErrorMessage());
}
// specify xml file name
m_strFileName = finder.GetFileName();
// convert xml file name string to something COM can handle (BSTR)
_bstr_t bstrFileName;
bstrFileName = m_strFileName.AllocSysString();
// call the IXMLDOMDocumentPtr's load function to load the XML document
variant_t vResult;
try
{
vResult = m_plDomDocument->load(bstrFileName);
.
.
.
}
Any ideas?