RT. You need to write a simple web page, but you need multi-language versions. Therefore, I want to create multiple XML files as text libraries in different languages to facilitate later maintenance. But I have just come into contact with HTML and I don’t know how to call the content of the XML file in HTML?
For example:
Contents such as "menu" and "tools" should be displayed on the web page. Therefore, create a file named CN.xml and write "Menu" and "Tools" in it. Create another file named EN.xml and write "Menu" and "Tools" in it. In the Chinese version of HTML, where the "menu" needs to be displayed, the "menu" text is called from CN.xml and displayed. In the English version of HTML, where the "menu" needs to be displayed, the "Menu" text is called from EN.html and displayed.
http://expert.csdn.net/Expert/topic/2040/2040475.xml?temp=. 6216089
http://www.cnblogs.com/winsor-w/archive/2007/03/05/664552.html The above is wrong..
http://www. cnblogs.com/huacw/archive/2011/03/24/1994074.html
http://techpool.iteye.com/blog/649024
2L personal test valid (IE environment)
I have seen what 2L and 3L provided, but it is not the same as what I want. I don’t need to use the span function. Examples on the Internet basically use xml to store multiple object information of a certain class, but my xml contains either such data or a simple text library, such as the following:
;/data>
I want to call the text "menu" in html. How should I call it?
<script src="/Scripts/jquery-1.8.0.min.js" type="text/javascript"></script><script>var xml='<?xml version="1.0" encoding="GB2312" ?><Resource><data name="1">menu</data><data name="2">tool</data></Resource>';$(xml).find("data").each(function(i) {console.log(this)alert($(this).text()) });</script>
<script src=scripts/jquery-1.8.3.min.js></script><script src=scripts/jquery.xpath.min.js></script><script>$(function() { $('#x2').html($('xml').xpath('//.[@name=2]').text()); $('#x1').html($('xml').xpath('//.[@name=1]').text());});</script><xml><?xml version="1.0" encoding="GB2312" ?><Resource> <data name="1">menu</data> <data name="2">tool</data></Resource></xml><div id=x2></div><div id=x1></div>
<script src=scripts/jquery-1.8.3.min.js></script><script src=scripts/jquery.xpath.min.js></script><script>$(function() { $('#x2').html($('xml').xpath('//.[@name=2]').text()); $('#x1').html($('xml').xpath('//.[@name=1]').text());});</script><xml><?xml version="1.0" encoding="GB2312" ?><Resource> <data name="1">menu</data> <data name="2">tool</data></Resource></xml><div id=x2></div><div id=x1></div>
<script src="/Scripts/jquery-1.8.0.min.js" type="text/javascript"></script><script>var xml='<?xml version="1.0" encoding="GB2312" ?><Resource><data name="1">menu</data><data name="2">tool</data></Resource>';$(xml).find("data").each(function(i) {console.log(this)alert($(this).text()) });</script>
$('a[href=munu]').html($('xml ').xpath('//.[@name=1]').text());
<script src="/Scripts/jquery-1.8.0.min.js" type="text/javascript"></script><script>var xml='<?xml version="1.0" encoding="GB2312" ?><Resource><data name="1">menu</data><data name="2">tool</data></Resource>';$(xml).find("data").each(function(i) {console.log(this)alert($(this).text()) });</script>
<script src="/Common/Scripts/jquery-1.8.0.min.js" type="text/javascript"></script><script>var xml='<?xml version="1.0" encoding="GB2312" ?><Resource><data name="1">menu</data><data name="2">tool</data></Resource>';alert($(xml).find("data[name=1]").text());</script>
<script src="/Scripts/jquery-1.8.0.min.js" type="text/javascript"></script><script>var xml='<?xml version="1.0" encoding="GB2312" ?><Resource><data name="1">menu</data><data name="2">tool</data></Resource>';$(xml).find("data").each(function(i) {console.log(this)alert($(this).text()) });</script>
<script src="/Common/Scripts/jquery-1.8.0.min.js" type="text/javascript"></script><script>var xml='<?xml version="1.0" encoding="GB2312" ?><Resource><data name="1">menu</data><data name="2">tool</data></Resource>';$('a[href=munu]').html($(xml).find("data[name=1]").text());</script>
Thanks to the two masters slwsss and xuzuning, but I didn’t understand how to use this thing in the end. ...Later I found that it is easier to solve it with php, which is suitable for a complete novice like me