XML DOM textContent Property
Complete Attr Object Reference
Definition and Usage
The textContent property sets or returns the textual content of an attribute.
Syntax
Example
The following code fragment loads "books.xml"
into xmlDoc using
loadXMLDoc() and returns the textual content of the category attributes:
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName('book');
for(i=0;i<x.length;i++)
{
document.write(x.item(i).attributes[0].textContent);
document.write("<br />");
}
|
The output of the code above will be:
Try-It-Yourself Demos
textContent - Get the textual content of an attribute
textContent - Set the textual content of an attribute
Complete Attr Object Reference
The Altova MissionKit is a suite of intelligent XML tools, including:
XMLSpy® – industry-leading XML editor
- Support for all XML-based technologies
- Graphical editing views, powerful debuggers, code generation, & more
MapForce® – graphical data mapping tool
- Drag-and-drop data conversion with code generation
- Support for XML, DBs, EDI, Excel® 2007, text, Web services
StyleVision® – visual stylesheet designer
- Drag-and-drop stylesheet design for XML & databases
- Output to HTML, PDF, RTF, Word 2007, & more
And more…
Try before you buy with a free fully functional 30-day trial
Download today
|