| Advertise Here |
|
Parsing the DOMUsing the XML parserTo read and update - create and manipulate - an XML document, you need an XML parser. The Microsoft XML parser is a COM component that comes with Microsoft Internet Explorer 5.0. Once you have installed IE 5.0, the parser is available to scripts inside HTML documents and ASP files. The Microsoft XMLDOM parser features a language-neutral programming model that:
If you are using JavaScript in IE 5.0, you can create an XML document object with the following code:
If you are using VBScript you create the XML document object with the following code:
If you are using VBScript in an Active Server Page (ASP), you can use the following code:
Loading an XML file into the parserThe following code loads an existing XML document (note.xml) into the XML parser:
The first line of the script creates an instance of the Microsoft XML parser. The third line tells the parser to load an XML document called note.xml. The second line assures that the parser will halt execution until the document is fully loaded. Loading pure XML text into the parserThe following code loads a text string into the XML parser:
Note that the "loadXML" method (instead of the "load" method) is used to load a text string. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Jump to : Top Of Page or HOME |