How to Use XML DSO to Embed Data from XML File into your HTML PagesThe XML DSO (XML Data Source Object) is an ActiveX control. This is built into the browser so that you can use this ActiveX control to embed data from an XML file in to your html web pages.
To use this XML DSO, you have to initialize the XML-DSO object using the <object> tag. This XML-DSO also has a unique CLASSID that also has to be given in the <object> tag. The following is the tag that is to be used in your web page, <OBJECT ID="GiveSomeID" CLASSID="CLSID:550dda30-0541-11d2-9ca9-0060b0ec3d39"> </OBJECT> By using this object tag you can extract data from an external file or you can use the data that is embedded in the html file itself in XML format. Let us take a look on how to extract data from an external XML file and embed it into your html pages using the XML-DSO object. Consider an XML file (external.xml) given below which is the external file that will be used for our example. <?xml version="1.0" ?> To embed the data from the above xml file you have to use JavaScript to load that external file while the web page loads. The JavaScript function can be something like this: <script language="JavaScript"> Include the above code in the <head> section of your web page. The complete code for the html page that includes the XML DSO and the above JavaScript is given below: <html> In the above code we are using the <div> tag with the attribute datafld to specify the XML tag that contains the data that is to be displayed in the web page. With the above code the data in the XML file is displayed in two rows since there are two items in the external.xml file. Note that the attribute datasrc of the <table> is set to “#dataXML” which is the id of the XML DSO object used in the code. Similarly you can use the XML-DSO object to create web pages that need to display very little content from an external XML file. This is one of the easiest ways to display XML data in your web page. Try this!
|
|
|||
|
||||
“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”
Copyright - © 2004 - 2019 - All Rights Reserved.