Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


how to use the schmas property to specify the xsd scham for valida

From: jim@-----------.---------.---
To: NULL
Date: 2/7/2008 3:32:00 PM

Hi All,

I have a question about the using schmas property in IXMLDOMDocument for 
validating xml against to xsd file. When I try to validate xml document. It 
aways use the xsd file which is specified by xmlshemalocation attribute in 
xml document. My goals are to use the schema property to specify the xsd 
programmatically. Are any way to specify the xsd file on the fly rather than 
using the one specifying by the schemalocation attribute in MSDOM API?  I am 
using MSXML DOM V4.0. Any idea would be great appreciated.

Below are the code I am using:

IXMLDOMSchemaCollection2Ptr pSchemaCache;
HRESULT hr = pSchemaCache.CreateInstance(CLSID_XMLSchemaCache40);

pSchemaCache->add( pCDBSetting->m_strInTargetName.c_str(), 
pCDBSetting->m_strInXSDFile.c_str() );

IXMLDOMDocument2Ptr pXMLDoc;

hr = pXMLDoc.CreateInstance(CLSID_DOMDocument40);

pXMLDoc->schemas = pSchemaCache.GetInterfacePtr();

pXMLDoc->async   = VARIANT_FALSE;

pXMLDoc->load(pCDBSetting->m_strValidationXMLDoc.c_str())

IXMLDOMParseErrorPtr pResult = pXMLDoc->validate();


Thanks in advance!

Jim



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent