ÕâÊÇһƪ½²½âÈçºÎʹÓÃXMLʵÏÖFlashÓëͨÐŵÄÈëÃż¶ÊµÀý½Ì³Ì¡£Í¨¹ý±¾ÀýµÄѧϰ£¬ÎÒÃǽ«Á˽âʹÓÃXML¿ª·¢Flash RIAsµÄ»ù±¾Á÷³Ì¡£
´ÓFlash Player 5¿ªÊ¼£¬¾Í¿ÉÒÔʹÓÃXML¶ÔÏóÀ´ÊµÏÖFlashÓëºǫ́ͨÐÅ¡£Flashä¯ÀÀÆ÷ÓëXMLÊý¾ÝÖ®¼äµÄÖ±½Ó½øÐÐÊý¾Ý½»»»£¬²¢ÇÒͬLoadVarsº¯ÊýÒ»Ñù£¬¶¼ÊÇÒÔ×Ö·û´®ÐÎʽ´«µÝµÄ¡£ºǫ́ÓïÑÔ×÷ΪXMLÊý¾ÝºÍÊý¾Ý¿âµÄÖн飬¸ºÔð½«Êý¾Ý¿âµÄÊý¾Ý¶¯Ì¬Éú³ÉXML£¬½«XML±ä¶¯µÄÊý¾Ý¸üлØÊý¾Ý¿â¡£ÈçÏÂͼËùʾ£º
XML¶ÔÏó¿É±ÈLoadVars¶ÔÏó¸ß¼¶¶àÁË£¬Ëü´¦ÀíµÄÊÇXMLÔªËØ£¬XMLÔªËر¾ÉíÓÐÒâÒå¶øÇÒ¸ñʽÁ¼ºÃ£¬ÀûÓÃÎÒÃǺ͵çÄÔʶ±ð£¬ ËüÔçÒѳÉΪÊý¾Ý½»»»¸ñʽµÄ±ê×¼¡£¶øLoadVarsÓÃÀ´´¦Àí±äÁ¿£¬LoadVarsÖеıäÁ¿ºÜÉÙÓÐʲôʵ¼ÊÒâÒ壬Èç¹ûÓÃÀ´¶ÁÈ¡Êý¾Ý¿âÖеÄÊý¾Ý£¬±äÁ¿»á ºÜ¶à¡£¶øXML¶ÔÏó¾Í¼òµ¥¶àÁË£¬ÓëXMLÏà¹ØµÄ¼¼ÊõºÜ¶à£¬±ÈÈçDOM¡¢SOM¡¢SMLT¡¢SAX2µÈ¡£¼´Ê¹Äã¶ÔÕâЩ¼¼Êõ²»Á˽⣬ÄãÒ²¿ÉÒÔÓúǫ́ÓïÑÔÊä³öÊý ¾ÝµÄ·½Ê½À´ÊµÏÖ¡£Èç¹ûÄã¶Ô¶øÇÒ·þÎñÆ÷¶Ë½Å±¾ÓïÑÔµÄÊä³öÊý¾ÝµÄ¸ñʽ²»Á˽⣬Çë¿´Ò»ÏÂhttp://www.riafan.com/article/flash/flash-exchange-date-with-server.html¡£
ʹÓÃXML¶ÔÏóÀ´ÊµÏÖFlashÓëºǫ́ͨÐÅ£¬Ö÷ÒªÊÇͨ¹ýXML¶ÔÏóµÄsendAndLoad·½·¨¡£¸Ã·½·¨ºÍLoadVarsµÄsendAndLoad·½·¨ ÀàËÆ£¬Ëü ......
ÕâÊÇһƪ½²½âÈçºÎʹÓÃXMLʵÏÖFlashÓëͨÐŵÄÈëÃż¶ÊµÀý½Ì³Ì¡£Í¨¹ý±¾ÀýµÄѧϰ£¬ÎÒÃǽ«Á˽âʹÓÃXML¿ª·¢Flash RIAsµÄ»ù±¾Á÷³Ì¡£
´ÓFlash Player 5¿ªÊ¼£¬¾Í¿ÉÒÔʹÓÃXML¶ÔÏóÀ´ÊµÏÖFlashÓëºǫ́ͨÐÅ¡£Flashä¯ÀÀÆ÷ÓëXMLÊý¾ÝÖ®¼äµÄÖ±½Ó½øÐÐÊý¾Ý½»»»£¬²¢ÇÒͬLoadVarsº¯ÊýÒ»Ñù£¬¶¼ÊÇÒÔ×Ö·û´®ÐÎʽ´«µÝµÄ¡£ºǫ́ÓïÑÔ×÷ΪXMLÊý¾ÝºÍÊý¾Ý¿âµÄÖн飬¸ºÔð½«Êý¾Ý¿âµÄÊý¾Ý¶¯Ì¬Éú³ÉXML£¬½«XML±ä¶¯µÄÊý¾Ý¸üлØÊý¾Ý¿â¡£ÈçÏÂͼËùʾ£º
XML¶ÔÏó¿É±ÈLoadVars¶ÔÏó¸ß¼¶¶àÁË£¬Ëü´¦ÀíµÄÊÇXMLÔªËØ£¬XMLÔªËر¾ÉíÓÐÒâÒå¶øÇÒ¸ñʽÁ¼ºÃ£¬ÀûÓÃÎÒÃǺ͵çÄÔʶ±ð£¬ ËüÔçÒѳÉΪÊý¾Ý½»»»¸ñʽµÄ±ê×¼¡£¶øLoadVarsÓÃÀ´´¦Àí±äÁ¿£¬LoadVarsÖеıäÁ¿ºÜÉÙÓÐʲôʵ¼ÊÒâÒ壬Èç¹ûÓÃÀ´¶ÁÈ¡Êý¾Ý¿âÖеÄÊý¾Ý£¬±äÁ¿»á ºÜ¶à¡£¶øXML¶ÔÏó¾Í¼òµ¥¶àÁË£¬ÓëXMLÏà¹ØµÄ¼¼ÊõºÜ¶à£¬±ÈÈçDOM¡¢SOM¡¢SMLT¡¢SAX2µÈ¡£¼´Ê¹Äã¶ÔÕâЩ¼¼Êõ²»Á˽⣬ÄãÒ²¿ÉÒÔÓúǫ́ÓïÑÔÊä³öÊý ¾ÝµÄ·½Ê½À´ÊµÏÖ¡£Èç¹ûÄã¶Ô¶øÇÒ·þÎñÆ÷¶Ë½Å±¾ÓïÑÔµÄÊä³öÊý¾ÝµÄ¸ñʽ²»Á˽⣬Çë¿´Ò»ÏÂhttp://www.riafan.com/article/flash/flash-exchange-date-with-server.html¡£
ʹÓÃXML¶ÔÏóÀ´ÊµÏÖFlashÓëºǫ́ͨÐÅ£¬Ö÷ÒªÊÇͨ¹ýXML¶ÔÏóµÄsendAndLoad·½·¨¡£¸Ã·½·¨ºÍLoadVarsµÄsendAndLoad·½·¨ ÀàËÆ£¬Ëü ......
×î½üÏîÄ¿ÖÐÒªÓõ½Ò»Ð©web xmlÊý¾ÝµÄ·ÃÎÊ·ÖÎö£¬²ÉÓÃmsxml
1.msxmlÊÇ΢ÈíÌṩµÄ£¬ÔÚ·Ç¿ª·¢»·¾³ÖУ¬ÐèҪע²á
2.xmlÎļþ£¬Ò»°ãÔÚµÚÒ»¾äÓбàÂ뷽ʽ£¬Ò»°ãĬÈÏÊÇutf-8£¬ÊôÓÚÒ»ÖÖunicode
3.´ÓÍøÂç²É¼¯µÄxmlÊý¾Ý£¬ÐèҪʹÓÃwinnetº¯Êý¿â
4.winnet²É¼¯×ÔÍøÂçµÄÊý¾Ý£¬Ä¬ÈϵĶ¼ÊÇCP_ACP¸ñʽµÄ£¬¼òµ¥Ëµ¾ÍÊÇANSI»òUNICODE£¬UTF8µÄ±àÂ뷽ʽÊÇCP_UTF8£¬Õâô¿´xmlÊý¾Ý£¬×Ö·ûÊÇÕý³£µÄ£¬µ«ÊǺº×Ö¶¼ÊÇÂÒÂë
5.½â¾öutf-8ÂÒÂë·½·¨£º
UNICODE -> ANSI : CT2A or MultiByteToWideChar
ANSI -> UTF8: WideCharToMultiByte
wstring AStringToWString(const string& szSrc, UINT nCodePage)
{
wstring lstrResult;
if (!szSrc.empty())
{
int length = MultiByteToWideChar(nCodePage, 0, szSrc.c_str(), -1, NULL, 0);
wchar_t* lpwszTemp = new wchar_t[length + 1];
......
¶ÁXMLÎļþ
DataSet books = new DataSet();
books.ReadXml(MapPath("booklist.xml"));
booklist.DataSource = books;
booklist.DataBind(); ......
¶ÁXMLÎļþ
DataSet books = new DataSet();
books.ReadXml(MapPath("booklist.xml"));
booklist.DataSource = books;
booklist.DataBind(); ......
Ajax(Asynchronous JavaScript and XML)˵µ½µ×¾ÍÊÇÒ»ÖÖä¯ÀÀÆ÷Òì²½¶ÁÈ¡·þÎñÆ÷ÉÏXMLÄÚÈݵļ¼Êõ¡£ÏÖÔڵļ¼Êõ·²ÊǸúXML³¶ÉϹØϵ£¬ÔÙ¼ÓÉϸö¸ÅÄî×ö»Ï×Ó£¬¾ÍÏñ½ð×°ÁËÒ»Ñù£¬×§µÃ²»ÐС£ÃÅÍâ µÄÈË¿´µÃºÜÊÇÈÈÄÖ£¬ÃÅÀïµÄÈËÒ¡Ò¡Í·²»ÍâÈçÊÇ¡£XMLÄØ£¬¿çƽ̨µÄг±ÓïÑÔ£¿ÆäʵXML£½TXT¡£
XMLÖ»ÊÇ·ûºÏºÜ¶à¹æ·¶µÄÎı¾¡£Ëü±¾Éíʲô¶¼²»ÊÇ£¬Ö»ÊDZ£ ´æ×Ö·ûµÄÎļþ¡£¶øä¯ÀÀÆ÷Òì²½¶ÁÈ¡µÄÖ»ÊÇ·þÎñÆ÷ÉϵÄÎı¾ÄÚÈÝ£¬ËùÒÔÔÚAjax¿ª·¢Ê±ÍêÈ«²»±Ø¾ÐÄàÓÚXML¡£[°æȨËùÓУ¬www.jialing.net]
JSONµÄÀ´Àú
XML µÄ×÷ÓÃÊǸñʽ»¯Êý¾ÝÄÚÈÝ¡£Èç¹ûÎÒÃDz»ÓÃXML»¹ÓÐʲô¸üºÃµÄ·½·¨Âð£¿Õâ¸ö´ð°¸ÊÇJSON¡£½éÉÜJSON֮ǰÎÒÏȽéÉÜÒ»ÏÂJavaScriptÕâÃŽű¾Óï ÑÔ¡£½Å±¾ÓïÑÔ×ÔÉíÓж¯Ì¬Ö´ÐеÄÌ츳¡£¼´ÎÒÃÇ¿ÉÒÔ°ÑÏëÒªÖ´ÐеÄÓï¾ä·ÅÔÚ×Ö·û´®Àͨ¹ýeval()Õâ¸ö¶¯Ì¬Ö´Ðк¯ÊýÀ´Ö´ÐС£×Ö·û´®ÀïµÄÄÚÈÝ»áÏñÎÒÃÇдµÄ½Å±¾ Ò»Ñù±»Ö´ÐС£
ʾÀý1£º
<HTML>
<HEAD>
<TITLE>eval example 1</TITLE>
</HEAD>
<BODY>
<script>
str = "alert('hello')";
eval(str);
</script>
</BODY>
</HTML>
´ò¿ªÒ³Ãæ»áµ¯³öhello´°¿Ú¡£
ÎÒÃÇ¿ÉÒÔÔÚ×Ö·û´®ÖзÅÈκνű¾Óï¾ä£¬°üÀ¨ÉùÃ÷Óï¾ ......
Ajax(Asynchronous JavaScript and XML)˵µ½µ×¾ÍÊÇÒ»ÖÖä¯ÀÀÆ÷Òì²½¶ÁÈ¡·þÎñÆ÷ÉÏXMLÄÚÈݵļ¼Êõ¡£ÏÖÔڵļ¼Êõ·²ÊǸúXML³¶ÉϹØϵ£¬ÔÙ¼ÓÉϸö¸ÅÄî×ö»Ï×Ó£¬¾ÍÏñ½ð×°ÁËÒ»Ñù£¬×§µÃ²»ÐС£ÃÅÍâ µÄÈË¿´µÃºÜÊÇÈÈÄÖ£¬ÃÅÀïµÄÈËÒ¡Ò¡Í·²»ÍâÈçÊÇ¡£XMLÄØ£¬¿çƽ̨µÄг±ÓïÑÔ£¿ÆäʵXML£½TXT¡£
XMLÖ»ÊÇ·ûºÏºÜ¶à¹æ·¶µÄÎı¾¡£Ëü±¾Éíʲô¶¼²»ÊÇ£¬Ö»ÊDZ£ ´æ×Ö·ûµÄÎļþ¡£¶øä¯ÀÀÆ÷Òì²½¶ÁÈ¡µÄÖ»ÊÇ·þÎñÆ÷ÉϵÄÎı¾ÄÚÈÝ£¬ËùÒÔÔÚAjax¿ª·¢Ê±ÍêÈ«²»±Ø¾ÐÄàÓÚXML¡£[°æȨËùÓУ¬www.jialing.net]
JSONµÄÀ´Àú
XML µÄ×÷ÓÃÊǸñʽ»¯Êý¾ÝÄÚÈÝ¡£Èç¹ûÎÒÃDz»ÓÃXML»¹ÓÐʲô¸üºÃµÄ·½·¨Âð£¿Õâ¸ö´ð°¸ÊÇJSON¡£½éÉÜJSON֮ǰÎÒÏȽéÉÜÒ»ÏÂJavaScriptÕâÃŽű¾Óï ÑÔ¡£½Å±¾ÓïÑÔ×ÔÉíÓж¯Ì¬Ö´ÐеÄÌ츳¡£¼´ÎÒÃÇ¿ÉÒÔ°ÑÏëÒªÖ´ÐеÄÓï¾ä·ÅÔÚ×Ö·û´®Àͨ¹ýeval()Õâ¸ö¶¯Ì¬Ö´Ðк¯ÊýÀ´Ö´ÐС£×Ö·û´®ÀïµÄÄÚÈÝ»áÏñÎÒÃÇдµÄ½Å±¾ Ò»Ñù±»Ö´ÐС£
ʾÀý1£º
<HTML>
<HEAD>
<TITLE>eval example 1</TITLE>
</HEAD>
<BODY>
<script>
str = "alert('hello')";
eval(str);
</script>
</BODY>
</HTML>
´ò¿ªÒ³Ãæ»áµ¯³öhello´°¿Ú¡£
ÎÒÃÇ¿ÉÒÔÔÚ×Ö·û´®ÖзÅÈκνű¾Óï¾ä£¬°üÀ¨ÉùÃ÷Óï¾ ......
JAXB¸ÅÒª
JAXBΪJava Architecture for XML BindingµÄËõд£¬ÒâΪXML°ó¶¨µÄJAVA¿ò¼Ü¡£ËüÌṩÁËÒ»Ì׿ÉÒÔ¼òµ¥´æÈ¡XMLÊý¾ÝµÄAPI£¬Í¬Ê±£¬JAXB¿ÉÒÔ¸ù¾ÝXMLµÄschema×Ô¶¯Éú³É²Ù×÷XMLµÄJAVAÀà¡£ÀûÓÃJAXB£¬Ê¹ÓÃJAXB×Ô¶¯Éú³ÉµÄ²Ù×÷XMLµÄJAVAÀ࣬¿ÉÒÔ»ù±¾Éϲ»Óÿ¼ÂÇXML½á¹¹¶ø¼òµ¥µØ´æÈ¡XMLÊý¾Ý¡£
JAXBµÄÏÂÔØÓë°²×°
JAXBÖÁÉÙÐèÒªµ¼ÈëÒÔÏÂjarÎļþ¡£
activation.jar
jaxb-api.jar
jaxb-impl.jar
jaxb-xjc.jar
¸ù¾ÝÇé¿ö£¬¿ÉÄÜ»¹»áÐèÒªÆäËüjarÎļþ¡£
ÏÂÔØ£º
¿ÉÒÔͨ¹ý
http://java.sun.com/webservices/downloads/webservicespack.html
ÏÂÔØJAXB¡£
XMLÔÐÍ
Order.xml
<?xml version="1.0" encoding="utf-8" ?>
<project default="xjc-compile" basedir=".">
<property name="src.dir" location="src" />
<property name="lib.dir" location="lib/jaxb" />
<property name="xml-schema.dir" location="xml-schema" />
<property name="schema.name" value="Orders.xsd" />
<property name="p ......
Ò»¡¢¼òµ¥½éÉÜ
using System.Xml;
//³õʼ»¯Ò»¸öxmlʵÀý
XmlDocument xml=new XmlDocument();
//µ¼ÈëÖ¸¶¨xmlÎļþ
xml.Load(path);
xml.Load(HttpContext.Current.Server.MapPath("~/file/bookstore.xml"));
//Ö¸¶¨Ò»¸ö½Úµã
XmlNode root=xml.SelectSingleNode("/root");
//»ñÈ¡½ÚµãÏÂËùÓÐÖ±½Ó×Ó½Úµã
XmlNodeList childlist=root.ChildNodes;
//ÅжϸýڵãÏÂÊÇ·ñÓÐ×Ó½Úµã
root.HasChildNodes;
//»ñȡͬÃûͬ¼¶½Úµã¼¯ºÏ
XmlNodeList nodelist=xml.SelectNodes("/Root/News");
//Éú³ÉÒ»¸öнڵã
XmlElement node=xml.CreateElement("News");
//½«½Úµã¼Óµ½Ö¸¶¨½ÚµãÏ£¬×÷ΪÆä×Ó½Úµã
root.AppendChild(node);
//½«½Úµã¼Óµ½Ö¸¶¨½ÚµãÏÂij¸ö×Ó½ÚµãÇ°
root.InsertBefore(node,root.ChildeNodes);
//Ϊָ¶¨½ÚµãµÄн¨ÊôÐÔ²¢¸³Öµ
node.SetAttribute("id","11111");
//Ϊָ¶¨½ÚµãÌí¼Ó×Ó½Úµã
root.AppendChild(node);
//»ñÈ¡Ö¸¶¨½ÚµãµÄÖ¸¶¨ÊôÐÔÖµ
string id=node.Attributes["id"].Value;
//»ñÈ¡Ö¸¶¨½ÚµãÖеÄÎı¾
string content=node.InnerText;
//±£´æXMLÎļþ
string path=Server.MapPath("~/file/bookstore.xml");
xml.Save(path);
//or use :xml.Save(H ......