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 you have installed IE5.0, you will get an XML parser. This browser can also be called in the script or in the program in addition to the internal calls inside the browser. This parser is characterized by supporting programming models that are independent of programming language, and he 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 a scripting language, you can create an XML document object using the following code:
VAR Xmldoc = New ActiveXObject ("Microsoft.xmldom")
If the browser uses VBScript as a scripting language, you can create an XML document object with the following code:
Set Xmldoc = CreateObject ("Microsoft.xmldom")
If you use the VBScript scripting language in the ASP program, you can use the following code form:
Set Xmldoc = Server.createObject ("Microsoft.xmldom")
Load the XML document into the parser
Use script code to load an XML document into a parser.
The following code can load an XML document into the parser:
VAR Xmldoc = New ActiveXObject ("Microsoft.xmldom")
XMLDoc.async = "false"
XMLDoc.Load ("Note.xml")
// ....... processing the docuument goes here
script>
The second line of code creates an instance of the Microsoft XML parser.
The third line of code turns off asynchronous load, ensuring that the XML parser is paid to the XML document before loading the XML document.
The fourth line tells the parser to load the XML document name is Note.xml.
Load the pure XML document by the character load parser
The parser can load XML text from a text string.
The following code demonstrates the copy of the text string to the parser:
Var text = "
TEXT = TEXT
Text = text "
TEXT = TEXT
Don't forget me this weekend! body> "Text = text " Note>"
VAR Xmldoc = New ActiveXObject ("Microsoft.xmldom")
XMLDoc.async = "false"
XMLDoc.LoadXml (Text)
// ....... processing the docuument goes here
script>
Note that the loaded string is used "LOADXML ()" method) (not the previous "LOAD ()" method), "LOADXML ()" is used to load the string, "LOAD ()" is Used to load an XML document. Use the JavaScript language to display XML data
You can use the JavaScript language to display XML data.
JavaScript (or VBScript) can import data from the XML document and display these data in the HTML page.
Let's take a look at how XML and HTML make each other, first look at an XML document (Note.xml), then we look at a JavaScript script code that contains imported XML documents displayed in the HTML page. HTML Document (Note.htm).
Go see how he works, try it.
You can learn more about JavaScript in our Dom School.