![]() |
|
These are examples from www.w3schools.com Viewing XML Files
- <!-- Edited with XML Spy v4.2 --> - <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
- <!-- Edited with XML Spy v4.2 --> - <CATALOG> - <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> - <CD> <TITLE>Hide your heart</TITLE> <ARTIST>Bonnie Tyler</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> </CATALOG> - <!-- Edited with XML Spy v4.2 --> - <breakfast_menu> - <food> <name>Belgian Waffles</name> <price>$5.95</price> <description>two of our famous Belgian Waffles with plenty of real maple syrup</description> <calories>650</calories> </food> - <food> <name>Strawberry Belgian Waffles</name> <price>$7.95</price> <description>light Belgian waffles covered with strawberries and whipped cream</description> <calories>900</calories> </food> - <food> <name>Berry-Berry Belgian Waffles</name> <price>$8.95</price> <description>light Belgian waffles covered with an assortment of fresh berries and whipped cream</description> <calories>900</calories> </food> - <food> <name>French Toast</name> <price>$4.50</price> <description>thick slices made from our homemade sourdough bread</description> <calories>600</calories> </food> - <food> <name>Homestyle Breakfast</name> <price>$6.95</price> <description>two eggs, bacon or sausage, toast, and our ever-popular hash browns</description> <calories>950</calories> </food> </breakfast_menu>
- <!-- Edited with XML Spy v4.2 --> <!DOCTYPE note (View Source for full doctype...)> - <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> - <!-- Edited with XML Spy v4.2 --> <!DOCTYPE note (View Source for full doctype...)> - <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
<head> <script type="text/javascript"
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM")
nodes=xmlDoc.documentElement.childNodes
<title>HTML using XML data</title>
<h1>W3Schools.com Internal Note</h1> <b>To: </b>
</body>
{ background-color: #ffffff; width: 100%; } CD { display: block; margin-bottom: 30pt; margin-left: 0; } TITLE { color: #FF0000; font-size: 20pt; } ARTIST { color: #0000FF; font-size: 20pt; } COUNTRY,PRICE,YEAR,COMPANY { Display: block; color: #000000; margin-left: 20pt; } XML and XSL
- <!-- Edited with XML Spy v4.2 --> - <HTML xmlns:xsl="http://www.w3.org/TR/WD-xsl"> - <BODY STYLE="font-family:Arial, helvetica, sans-serif; font-size:12pt; background-color:#EEEEEE"> - <xsl:for-each select="breakfast_menu/food"> - <DIV STYLE="background-color:teal; color:white; padding:4px"> - <SPAN STYLE="font-weight:bold; color:white"> <xsl:value-of select="name" /> </SPAN> - <xsl:value-of select="price" /> </DIV> - <DIV STYLE="margin-left:20px; margin-bottom:1em; font-size:10pt"> <xsl:value-of select="description" /> - <SPAN STYLE="font-style:italic"> ( <xsl:value-of select="calories" /> calories per serving) </SPAN> </DIV> </xsl:for-each> </BODY> </HTML> Data Binding
<body> <xml id="cdcat" src="cd_catalog.xml"></xml> <table border="1" datasrc="#cdcat"> <tr>
</table> </body>
<body> <xml id="cdcat" src="cd_catalog.xml"></xml> <table border="1" datasrc="#cdcat"> <thead>
<tfoot>
<tbody>
</table> </body>
View XML output from a database Displayed as HTML
<body> <xml src="cd_catalog.xml" id="xmldso" async="false"></xml> <br />Title:
</body>
<table
<thead>
<tr align="left">
</body>
<head> <script type="text/javascript"> function movenext() { x=xmldso.recordset if (x.absoluteposition < x.recordcount) { x.movenext() } } function moveprevious() { x=xmldso.recordset if (x.absoluteposition > 1) { x.moveprevious() } } </script> </head> <body>
<p>
<head> <script type="text/javascript"> function getPage() { var objHTTP = new ActiveXObject("Microsoft.XMLHTTP") objHTTP.Open('GET','note.xml',false) objHTTP.Send() document.all['A1'].innerText= objHTTP.status document.all['A2'].innerText= objHTTP.statusText document.all['A3'].innerText= objHTTP.responseText } </script> </head> <body onload="getPage()">
<p>
<p>
<p>
</body>
<head> <script type="text/vbscript"> function getPage() set http_obj=createObject("Microsoft.XMLHTTP") call http_obj.Open("GET","note.xml",false) call http_obj.Send() a1.innerText = http_obj.status a2.innerText = http_obj.statusText a3.innerText = http_obj.responseText end function </script> </head> <body onload="getPage()">
<p>
<p>
</body>
<body> <h2>
<p>
<p>
<p>
<body> <h2>
<p>
<p>
<p>
|
|
![]() |