2009-06-26 2 views

답변

3

로드 할 때 유효성을 검사 할 수 있습니다. 이는 윈도우/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을 얻으십시오.

관련 문제