Microsoft XML 2.5 SDK


 

IXMLDOMDocumentType::get_name Method

[This is preliminary documentation and subject to change.]

Contains the name of the document type.

Visual Basic Syntax

strValue = oXMLDOMDocumentType.name

C/C++ Syntax

HRESULT get_name(

    BSTR *rootName);

Parameters

rootName

[out]
When specified, this corresponds to the single root element of the document tree.

C/C++ Return Values

S_OK

Value returned if successful.

S_FALSE

Value when returning null.

C/C++ Return Value

Returns S_OK if successful, or an error code otherwise.

C/C++ Example

BOOL DOMDocGetDocType()
{
   BOOL bResult = FALSE;
   IXMLDOMDocumentType *pIXMLDOMDocumentType = NULL;
IXMLDOMDocument *pIXMLDOMDocument = NULL;
IXMLDOMDocumentType *pIXMLDOMDocumentType = NULL;
   BSTR bstrDTDName;
   HRESULT hr;

   try
   {
      // create an instance of DOMDocument and initialise pIXMLDOMDocument
      // load/create an XML fragment
      hr = pIXMLDOMDocument->get_doctype(&pIXMLDOMDocumentType);
      SUCCEEDED(hr) ? 0 : throw hr;

      if(pIXMLDOMDocumentType)
      {
         pIXMLDOMDocumentType->get_name(&bstrDTDName);
         ::MessageBox(NULL, bstrDTDName, _T("Doc Type"), MB_OK);
         bResult = TRUE;
   pIXMLDOMDocumentType->Release();
      }
   }
   catch(...)
   {
   if(pIXMLDOMDocumentType)
   pIXMLDOMDocumentType->Release();
      DisplayErrorToUser();
   }
return bResult;
}