OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

IXMLDOMSchemaCollectionPtr->add() crashed on me



I tried to use DOM to do the XML validation with XSD and I used IXMLDOMSchemaCollection according
to the MSXML4.0 reference.

I followed the example closely, and I just pick the W3C XML Schema to put into
IXMLDOMSchemaCollectionPtr->add(), but add() always crashed on me. In fact, I tried with some of
my own XSDs, and it crashed right at add() too.

When using the debugger, I could see that the raw_add() was returning me a huge -ve value for hr,
seems like some sort of memory wasn't allocated or something.

I'm listing part of my source code below, it must be something that I missed. Please help.

Thanks!


IXMLDOMDocument2Ptr pIXMLDOMDocument2Ptr;
hr = CoCreateInstance(CLSID_DOMBuilderDocument, NULL, CLSCTX_INPROC_SERVER,
IID_IXMLDOMBuilderDocument, (void **) &pIXMLDOMDocument2Ptr);
if (NULL == pIXMLDOMDocument2Ptr)
{
return(false);
}

IXMLDOMSchemaCollectionPtr pIXMLDOMSchemaCollection=NULL;
VARIANT varValue;

hr=pixmldomdocument2ptr->put_async(variant_false);
if(SUCCEEDED(hr))
{
hr=CoCreateInstance(CLSID_XMLSchemaCache, NULL, CLSCTX_SERVER, 
IID_IXMLDOMSchemaCollection, 
(lpvoid*)(&pixmldomschemacollection));
SUCCEEDED(hr) ? 0 : throw hr;

if (pIXMLDOMSchemaCollection)
{
// -------------
// CRASHING SPOT
// -------------
hr = pixmldomschemacollection->add(_t("http://www.w3.org/2001/xmlschema"),
_variant_t(_T("XMLSchema.xsd")));

if (hr)
{
varValue.vt = VT_DISPATCH;
varValue.pdispVal = pIXMLDOMSchemaCollection;
hr=pixmldomdocument2ptr->putref_schemas(varvalue);
}
}
}



=====
Izabella Ford
izabellaford@yahoo.com

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/