|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
培训的第一阶段,学习的是HTML/CSS/JavaScript基础。xml 上面是例子运转对了局:
上面是经由过程函数getSaveData()前往的全部xml数据的数组
- Array( [name] => 华联 [address] => 北京长安街-9999号 [desc] => 连锁超市 [cat_food] => Array ( [attrs] => Array ( [id] => food ) [goods_food11] => Array ( [name] => food11 [price] => 12.90 [attrs] => Array ( [id] => food11 ) ) [goods_food12] => Array ( [name] => food12 [price] => 22.10 [desc] => Array ( [value] => 好器材保举 [attrs] => Array ( [creator] => hahawen ) ) [attrs] => Array ( [id] => food12 ) ) ) [cat_1] => Array ( [goods_tel21] => Array ( [name] => tel21 [price] => 1290 [attrs] => Array ( [id] => tel21 ) ) ) [cat_coat] => Array ( [attrs] => Array ( [id] => coat ) [goods_coat31] => Array ( [name] => coat31 [price] => 112 [attrs] => Array ( [id] => coat31 ) ) [goods_coat32] => Array ( [name] => coat32 [price] => 45 [attrs] => Array ( [id] => coat32 ) ) ) [special_hot] => Array ( [attrs] => Array ( [id] => hot ) [goods_0] => Array ( [name] => hot41 [price] => 99 ) ))
复制代码 上面是经由过程setValue()函数,给给根节点添加信息,添加后显示出了局xml文件的内容
- <?xml version="1.0" encoding="GB2312" ?>
- <shop> <name>华联</name> <address>北京长安街-9999号</address> <desc>连锁超市</desc> <telphone>123456789</telphone> <cat id="food"> <goods id="food11"> <name>food11</name> <price>12.90</price> </goods> <goods id="food12"> <name>food12</name> <price>22.10</price> <desc creator="hahawen">好器材保举</desc> </goods> </cat> <cat> <goods id="tel21"> <name>tel21</name> <price>1290</price> </goods> </cat> <cat id="coat"> <goods id="coat31"> <name>coat31</name> <price>112</price> </goods> <goods id="coat32"> <name>coat32</name> <price>45</price> </goods> </cat> <special id="hot"> <goods> <name>hot41</name> <price>99</price> </goods> </special></shop>
复制代码 刚开始因为习惯于ASP格式的写法,总是在这些方面出现问题,自己还总是找不到问题所在,这就提醒了自己,在写代码的时候一定要认真,不能粗心地老是少个“;”或者字母大小写不分,要不然很可能找半天都找不到错误。 |
|