The XML Parser can read, update, create, and operate an XML document.
Use XML Parser
Microsoft's XML parser is bundled with ie5.0 + browser.
Once ie5.0 is installed, the XML parser is obtained. In addition to being called by the browser, this browser can also be called in scripts or programs. This parser supports programming models unrelated to programming languages and supports the following technologies:
- W3C XML 1.0 and XML DOM
- DTD and XML document verification
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
If the browser uses VBScript as the script language, you can use the following code to create an XML document object:
If you use the VBScript language in an ASP program, you can use the following code:
Load the XML document into the parser
You can use the script code to load the XML document into the parser.
The following code loads an XML document into the Parser:
The second line of code creates an instance of the Microsoft XML parser.
The third line of code disables asynchronous loading to ensure that the XML parser does not parse the XML file before fully loading the XML file.
The fourth line tells the parser that the name of the XML document to be loaded is note. xml.
Load pure XML documents into the parser by characters
The parser can load XML text from a text string.
The following code loads a text string into the Parser:
Note that the "loadxml ()" method is used to load strings (instead of the "load ()" method used previously). "loadxml ()" is used to load strings, "load ()" is used to load XML documents.