PROPERTY:  CharacterData::length

CharacterData.length

The length property is read-only and contains the length of the data string in characters.

The following example uses the 'albums.xml' file and displays the value and length of the first 'title' element.

XML:
<Albums>
   <Album ref="CD142" category="Folk">
      <title>Boil The Breakfast Early</title>
      <artist>The Chieftains</artist>
   </Album>
   <Album ref="CD720" category="Pop">
      <title>Come On Over</title>
      <artist>Shania Twain</artist>
   </Album>
   <Album ref="CD024" category="Country">
      <title>Red Dirt Girl</title>
      <artist>Emmylou Harris</artist>
   </Album>
</Albums>

Code (VBScript):
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("albums.xml")

Set Elem = objXMLDoc.documentElement.firstChild.firstChild.firstChild
Length = Elem.length
document.write(Elem.data)
document.write("<br>Length is characters: " & Length)

Output:
Boil The Breakfast Early
Length in characters is: 24



Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information