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

CharacterData.deleteData(offset, count)

The deleteData method is used to remove the specified range of characters from string data. The two parameters specify the index of the initial character of the substring to delete, and the number of characters respectively. If this range goes beyond the end of the string, only those characters to the end of the string are deleted. The data and length properties are both immediately updated by this method.

In the following example we use the 'albums.xml' file and delete the word 'The ' from the 'title' of the first 'album' 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
Elem.deleteData 5, 4
document.write(Elem.data)

Output:
Boil Breakfast Early



 


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