Microsoft XML 2.5 SDK


 

IXMLDOMEntity::get_notationName Method

[This is preliminary documentation and subject to change.]

Contains the notation name.

Visual Basic Syntax

strValue = oXMLDOMEntity.notationName

C/C++ Syntax

HRESULT get_notationName(

    BSTR *name);

Parameters

name

[out]
For unparsed entities, the name of the notation for the entity (the name following NDATA). For parsed entities, contains the empty string.

C/C++ Return Values

S_OK

Value returned if successful.

S_FALSE

Value when returning null.

E_INVALIDARG

Value returned if name is null.

Remarks

Note that the name of the entity is available using the nodeName property.

C/C++ Example

BOOL DOMEntityNotationName()
{
   BOOL bResult = FALSE;
   IXMLDOMEntity *pIXMLDOMEntity = NULL;
   BSTR bstrName ;
   HRESULT hr;

   try
   {
      pIXMLDOMEntity = GetFirstEntity();

      if(pIXMLDOMEntity)
      {
hr =   pIXMLDOMEntity->get_notationName(&bstrName);
         ::MessageBox(NULL, bstrName, _T("Notation name"), MB_OK);
         bResult = TRUE;
         ::SysFreeString(bstrName);
         pIXMLDOMEntity->Release();
      }
   }
   catch(...)
   {
      if(pIXMLDOMEntity)
         pIXMLDOMEntity->Release();
      DisplayErrorToUser();
   }
   return bResult;
}
IXMLDOMEntity* GetFirstEntity()
{
   IXMLDOMNamedNodeMap *pIXMLDOMNamedNodeMapEntities = NULL;
   IXMLDOMEntity *pIXMLDOMEntity = NULL;
   IXMLDOMNode *pIXMLDOMNode = NULL;
IXMLDOMDocument *pIXMLDOMDocument = NULL;
   HRESULT hr;

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

      if(pIXMLDOMDocumentType)
      {
hr = pIXMLDOMDocumentType->get_entities (&pIXMLDOMNamedNodeMapEntities);
         if(SUCCEEDED(hr) && pIXMLDOMNamedNodeMapEntities)
         {
            hr = pIXMLDOMNamedNodeMapEntities->nextNode(&pIXMLDOMNode);
            if(SUCCEEDED(hr) && pIXMLDOMNode)
            {
hr = pIXMLDOMNode->QueryInterface(IID_IXMLDOMEntity, (void**)&pIXMLDOMEntity );
               SUCCEEDED(m_hr) ? 0 : throw m_hr;
               pIXMLDOMNode->Release();
            }
            pIXMLDOMNamedNodeMapEntities->Release();
         }
         pIXMLDOMDocumentType->Release();
      }
   }
   catch(...)
   {
      if(pIXMLDOMNode)
         pIXMLDOMNode->Release();
      if(m_pIXMLDOMNamedNodeMapEntities)
         m_pIXMLDOMNamedNodeMapEntities->Release();
      if(m_pIXMLDOMDocumentType)
         m_pIXMLDOMDocumentType->Release();
      DisplayErrorToUser();
   }
   // Release pIXMLDOMEntity after finished using it.
   // Release pIXMLDOMDocument after finished using it.
   return pIXMLDOMEntity;
}