[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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@y... __________________________________________________ Do You Yahoo!? Make international calls for as low as $.04/minute with Yahoo! Messenger http://phonecard.yahoo.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|