Quick References
      ADO
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      VBScript
      WML
      WMLScript
      WSH
      XHTML
      XML DOM
      XSLT

Features
      Knowledge Base
      Tutorials

Partners
     ZVON.ORG
     XML
     Planet Source Code
     VisualBuilder
     Web Design
     Your HTML Source
     XML/XSLT Forums
     ASPAlliance
     Scripts
     
     Programmers Heaven
     Tek-Tips Forums
     Developer Fusion
     Code Project











METHOD:  CharacterData::substringData

CharacterData.substringData(offset, count)

The substringData method returns a substring of this string consisting of the specified range of characters. If the range goes beyond the last character in the string, only those characters up to and including the last are copied.

In the following example, the 'currencies.xml' file is loaded and a substring created from the text of the last 'currency' element. The substring starts with the fifth and ends with the last character of the string (the 'count' parameter is slightly generous and goes beyond the end of the string). The substring is then displayed.

XML:
<currencies>
   <currency>CHF Swiss Francs</currency>
   <currency>DEM German Deutsche Marks</currency>
   <currency>GBP United Kingdom Pounds</currency>
   <currency>JPY Japanese Yen</currency>
   <currency>USD United States Dollars</currency>
</currencies>

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

Set Elem = objXMLDoc.documentElement.lastChild
Set Text = Elem.firstChild
Substr = Text.substringData(4, 30)
document.write(Substr)

Output:
United States Dollars



 


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