Partager via


notationName Property

 

Contains the notation name.

Script Syntax

strValue = oXMLDOMEntity.notationName;  

Visual Basic Syntax

strValue = oXMLDOMEntity.notationName  

C/C++ Syntax

HRESULT get_notationName(  
    BSTR *name);  

Parameters

name[out, retval]
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 returned when no notation is specified.

E_INVALIDARG
Value returned if the nameparameter is Null.

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 when finished using it.
    // Release pIXMLDOMDocument when finished using it.
    return pIXMLDOMEntity;
}

Remarks

String. The property is read-only. For unparsed entities, the notationName property contains the name of the notation for the entity (the name following NDATA). For parsed entities, it contains the empty string. Note that the name of the entity is available using the nodeName property.

Versioning

Implemented in:

MSXML 3.0, MSXML 6.0

Applies to

IXMLDOMEntity

See Also

nodeName Property1