nedcomp hosting homepage

Producten en Diensten
Dedicated servers
Datacenter informatie
Partners, resellers
Helpdesk informatie
Technische docs, tools
Support homepage
ASP componenten
Praktische ASP, ASP.NET
Visual route server
Whois (domein gegevens)
Software documentatie
Whitepapers
Zoeken
Nedcomp / algemeen

Zoeken
 

Copyright © Nedcomp Hosting
Telefoon nr :   +31 184 670111
Fax nummer :   +31 184 631384
E-mailadres :   info@nedcomp.nl
 

Microsoft XML Core Services (MSXML) 4.0 - DOM Reference

length Property (IXMLDOMNamedNodeMap)

Indicates the number of items in the collection.

[Script]

Script Syntax

lValue = oXMLDOMNamedNodeMap.length;

Example

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
var nodeBook, namedNodeMap;
xmlDoc.setProperty("SelectionLanguage", "XPath");
xmlDoc.async = false;
xmlDoc.load("books.xml");
nodeBook = xmlDoc.selectSingleNode("//book");
namedNodeMap = nodeBook.attributes;
alert(namedNodeMap.length);
[Visual Basic]

Visual Basic Syntax

lValue = oXMLDOMNamedNodeMap.length

Example

Dim xmlDoc As New Msxml2.DOMDocument40
Dim nodeBook As IXMLDOMElement
Dim namedNodeMap As IXMLDOMNamedNodeMap
xmlDoc.setProperty "SelectionLanguage", "XPath"
xmlDoc.async = False
xmlDoc.Load "books.xml"
Set nodeBook = xmlDoc.selectSingleNode("//book")
Set namedNodeMap = nodeBook.Attributes
MsgBox namedNodeMap.length
[C/C++]

C/C++ Syntax

HRESULT get_length(
    long *listLength);

Parameters

listLength [out, retval]
The number of items in the collection.

C/C++ Return Values

S_OK
The value returned if successful.
E_INVALIDARG
The value returned if listLength is Null.

Example

IXMLDOMNode *pIXMLDOMNode = NULL;
IXMLDOMNamedNodeMap *pIXMLDOMNamedNodeMap = NULL;
IXMLDOMElement *pIXMLDOMElement = NULL;
long lLength;
TCHAR strTemp[10];
HRESULT hr;
IXMLDOMDocument *pIXMLDOMDocument = NULL;

try
{
   // Create an instance of DOMDocument and initialize pIXMLDOMDocument.
   // Load/create an XML fragment.
   hr = pIXMLDOMDocument->get_documentElement(&pIXMLDOMElement);
   SUCCEEDED(hr) ? 0 : throw hr;

   if(pIXMLDOMElement)
   {
      hr = pIXMLDOMElement->get_attributes(&pIXMLDOMNamedNodeMap);
      if(SUCCEEDED(hr) && pIXMLDOMNamedNodeMap)
      {
         hr = pIXMLDOMNamedNodeMap->get_length(&lLength);
         if(SUCCEEDED(hr))
         {
            _itot(lLength, strTemp, 10);
            ::MessageBox(NULL, strTemp, _T("Number of Attributes"), MB_OK);
         }
         pIXMLDOMNamedNodeMap->Release();
         pIXMLDOMNamedNodeMap = NULL;
      }
      pIXMLDOMElement->Release();
      pIXMLDOMElement = NULL;
   }
}
catch(...)
{
   if(pIXMLDOMElement)
      pIXMLDOMElement->Release();
   if(pIXMLDOMNamedNodeMap)
      pIXMLDOMNamedNodeMap->Release();
   DisplayErrorToUser();
}
// Release pIXMLDOMDocument when finished with it.

Remarks

Long integer. The property is read-only.

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: IXMLDOMNamedNodeMap


Download de SDK