2009-06-26 31 views

答えて

3

ロード時に検証することができます。これは、Windows/MSXML SDKからサンプルコードです:

IXMLDOMSchemaCollectionPtr pXS; 
    IXMLDOMDocument2Ptr   pXD = NULL; 
    IXMLDOMParseErrorPtr   pErr = NULL; 
    _bstr_t      strResult = ""; 

    HRESULT hr = pXS.CreateInstance(__uuidof(XMLSchemaCache50)); 
    hr = pXS->add("urn:namespace", "myschema.xsd"); 

    // Create a DOMDocument and set its properties. 
    hr = pXD.CreateInstance(__uuidof(DOMDocument50)); 

    // Assign the schema cache to the DOMDocument's 
    // schemas collection. 
    pXD->schemas = pXS.GetInterfacePtr(); 

    // Load books.xml as the DOM document. 
    pXD->async = VARIANT_FALSE; 
    pXD->validateOnParse = VARIANT_TRUE; 
    pXD->resolveExternals = VARIANT_TRUE; 
    hr = pXD->load("TheXmlDocument.xml"); 

    // check hr and pXD->errorCode here 

あなたがこのサンプルおよび他の多くを取得することができますdownload the MSXML6 SDK。注:Vistaにはインストールされません。あなたがVistaを実行する場合は、Windows SDKを取得します。

関連する問題