10 basic XML knowledge (Microsoft's XML Parser)

Source: Internet
Author: User

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:

  • Javascript, VBScript, Perl, VB, Java, C ++, etc.
  • W3C XML 1.0 and XML DOM
  • DTD and XML document verification

If the browser uses JavaScript as the scripting language, you can use the following code to create an XML document object:

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:

set xmlDoc=CreateObject("Microsoft.XMLDOM")

If you use the VBScript language in an ASP program, you can use the following code:

set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")

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:

<script type="text/javascript">            var xmlDoc = new ActiveXObject("Microsoft.XMLDOM")            xmlDoc.async="false"            xmlDoc.load("note.xml")            // ....... processing the document goes here            </script>

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:

<script type="text/javascript">            var text="<note>"            text=text+"<to>Tove</to><from>Jani</from>"            text=text+"

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.

Display XML data in Javascript

You can use JavaScript to display XML data.

JavaScript (or VBScript) can import data from XML documents and display the data on the HTML page.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.