XML DOM » Node » baseName

Compability: Internet Explorer

Syntax:
document.basename

This is a read-only property that returns the base name for a node.

The baseName property is a read-only property that returns the base name for a node. Where this is a namespace qualified name, only the right-hand part of it is returned, i.e. for an element such as <dg:title> it would return 'title'. This property always returns a non-empty string. In the following example a file called 'CDs.xml' is loaded whose root node is a tag <CDs> . The root element of an XML document is referred to by the documentElement property, and the code uses this along with the baseName property to get its base name and store it in a variable before writing it to the page.

Examples

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

Dim strBaseName
strBaseName = objXMLDoc.documentElement.baseName
document.write(strBaseName)
Output:
CDs
Language(s): VBScript