entities Property

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Reference

entities Property

Contains a list of the entities declared in the <!DOCTYPE> declaration.

[Script]

Script Syntax

var objXMLDOMNamedNodeMap = oXMLDOMDocumentType.entities;
[Visual Basic]

Visual Basic Syntax

Set objXMLDOMNamedNodeMap = oXMLDOMDocumentType.entities
[C/C++]

C/C++ Syntax

HRESULT get_entities(
    IXMLDOMNamedNodeMap **entityMap);

Parameters

entityMap [out, retval]
A list of the general entities, both external and internal, that are present in this document.

C/C++ Return Values

S_OK
The value returned if successful.
E_INVALIDARG
The value returned if the entityMap parameter is Null.

Example

IXMLDOMEntity *GetRootEntity()
{
   HRESULT hr;
   IXMLDOMNamedNodeMap *pIXMLDOMNamedNodeMapEntities = NULL;
   IXMLDOMEntity *pIXMLDOMEntity = NULL;
   IXMLDOMNode *pIXMLDOMNode = NULL;
   IXMLDOMDocument *pIXMLDOMDocument = NULL;
   IXMLDOMDocumentType *pIXMLDOMDocumentType = NULL;

   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(hr) ? 0 : throw hr;
               pIXMLDOMNode->Release();
               pIXMLDOMNode = NULL;
            }
            pIXMLDOMNamedNodeMapEntities->Release();
         }
         pIXMLDOMDocumentType->Release();
      }
   }
   catch(...)
   {
      if(pIXMLDOMNode)
         pIXMLDOMNode->Release();
      DisplayErrorToUser();
   }

   // Release pIXMLDOMEntity when finished using it.
   return pIXMLDOMEntity; 
}

Remarks

The property is read-only. In the following DOCTYPE declaration, for example, the node list in this property contains the entities "bat" and "bar".

<!DOCTYPE ex SYSTEM "ex.dtd" [
  <!ENTITY bat "bat">
  <!ENTITY bar "bar">
]>

To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

Applies to: IXMLDOMDocumentType