XML, like HTML, is a text markup language, unlike HTML, which is a Hypertext markup language used primarily for presentation. XML is an Extensible Markup language that is used primarily for data transfer.
XML Features:
1. Tree-like structure with only one root
2. Label name customization
3. Label name is sensitive, it is a double label element
4. Duplicate label cannot appear at the same level
Let's take a look at the following table:
Let's get to the NAME1 column in this table:
<title>Untitled Document</title><Scriptsrc= "Jquery-3.2.0.min.js"></Script></Head><Body><DivID= "Shuju"></Div></Body><Scripttype= "Text/javascript">$.ajax ({URL:"xmlchuli.php", DataType:"XML", Success:function(data) {varZi=$ (data). Find ("Minzu"). Children (); varStr= ""; for(varI=0; I<Zi.length;i++) { //Zi.eq (i). Find ("code"). Text (); varname1=Zi.eq (i). Find ("name1"). text (); STR=Str+"<div>"+name1+"</div>"; } $("#shuju"). html (str); }});</Script></Body></HTML>
Processing page:
<?PHPrequire"DBDA.class.php";$db=NewDbda ();$sql= "SELECT * FROM Minzu";$arr=$db->query ($sql);Echo"<minzu>";foreach($arr as $k=$v){ Echo"<n{$k}><code>{$v[0]} </code><name1>{$v[1]} </name1></n{$k}> ";}Echo"</minzu>";
Show Graph:
Ajax returns XML type