Internet Explorer supports two ways of loading XML into a document object: the load( )
method and the loadXML( ) method. The load( ) method loads an XML file and the loadXML( ) method loads a text string that contains XML code.
The following code loads that a text string into Microsoft's XML parser:
<script type="text/javascript">
var txt= "<note>"
var = txt + "<to>Rasik</to><from>Bapotra<from>"
txt = txt + "<heading>Reminder</heading>"
txt = txt + "<body>Don't forget me this weekend!</body>"
txt = txt + "</note>"
var xmldoc=new ActiveXObject("Microsoft.XMLDOM")
xmlDoc.async= "false"
xmlDoc.loadXML(txt)
document.write("The first child elment in the txt contains: " +
xmlDoc.documentElement.childNodes(0).text)
document.write(" br / >" )
document.write("The second child element in the text contains: " +
xmlDoc.documentElement.childNodes(1).text)
</script>
</body>
</html>
August 24, 2009
0 Loading XML Text into the Browser
Posted by raj on 6:25 AM
0 comments:
Post a Comment