Microsoft XML Parser

Source: Internet
Author: User
Tags xml parser

An XML parser can read, update, create, and manipulate an XML document.

--------------------------------------------------------------------------------

Using the XML parser
Microsoft's XML parser is bundled with the Ie5.0+ browser.

Once you install the IE5.0, you get the XML parser. This browser can also be invoked in scripts or programs in addition to being called internally by the browser. The parser is designed to support programming languages that are not designed to be independent, and he supports the following technologies:

JavaScript, VBScript, Perl, VB, Java, C + +, etc.
The Consortium XML 1.0 and XML DOM
DTD and XML document validation
If your 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 your browser uses VBScript as the scripting language, you can use the following code to create an XML Document object:

Set Xmldoc=createobject ("Microsoft.XMLDOM")

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

Set Xmldoc=server.createobject ("Microsoft.XMLDOM")

--------------------------------------------------------------------------------

Loading an XML document into a parser
Use scripting code to load an XML document into a parser.

The following code can load 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 turns off asynchronous loading, making sure that the XML parser does not parse the XML document until it is fully loaded into the XML document.

The last line tells the parser that the XML document you want to load is named Note.xml.

--------------------------------------------------------------------------------

Load a pure XML document into the parser by character
The parser can load XML text from a text string.

The following code demonstrates loading a text string into the parser:

<script type= "Text/javascript" >
var text= "<note>"
text=text+ "<to>Tove</to><from>Jani</from>"
text=text+ "text=text+ "<body>don ' t forget me this weekend!</body>"
text=text+ "</note>"
var xmldoc = new ActiveXObject ("Microsoft.XMLDOM")
Xmldoc.async= "false"
Xmldoc.loadxml (text)
... processing the document goes here
</script>

Note that the string used here is the "Loadxml ()" method) (rather than the previously used "load ()" method), "Loadxml ()" is used to load the string, and "load ()" is used to load the XML document.

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.