½«Êý×éת»¯ÎªXMLÊý¾Ý
/* Author: ÑîÓî yangyu@sina.cn */
/*
Ó÷¨Ê¾Àý£º
$cls_xml = new cls_xml();
if ($array){
$cls_xml->array2xml($array);
echo $cls_xml->getXml();
}else{
echo '';
}
*/
class cls_xml{
var $xml;
public function array2xml($array,$encoding='gb2312'){
$this->xml = '<?xml version="1.0" encoding="'.$encoding.'"?><list>';
$this->xml.= $this->_array2xml($array).'</list>';
}
public function getXml(){
return $this->xml;
}
public function _array2xml($array){
$xml = '';
foreach($array as $key => $val){
is_numeric($key) && $key = "item id=\"$key\"";
$xml. = "<$key>";
$xml. = is_array($val) ? $this->_array2xml($val) : $this->_cdata($val);
list($key,) = explode(' ',$key);
Ïà¹ØÎĵµ£º
protected void Button1_Click(object sender, EventArgs e)
{
//Ϊresponse(star)½Úµã ºÍ Cabins(f) cabin½Úµã·Ö±ðÌí¼Ó¸ö
&nbs ......
XML Schema ²Î¿¼ÊÖ²á
XSD ÔªËØ
ÔªËØ
½âÊÍ
all
¹æ¶¨×ÓÔªËØÄܹ»ÒÔÈÎÒâ˳Ðò³öÏÖ£¬Ã¿¸ö×ÓÔªËؿɳöÏÖÁã´Î»òÒ»´Î¡£
annotation
annotation ÔªËØÊÇÒ»¸ö¶¥²ãÔªËØ£¬¹æ¶¨ schema µÄ×¢ÊÍ¡£
any
ʹ´´×÷Õß¿ÉÒÔͨ¹ýδ±» schema ¹æ¶¨µÄÔªËØÀ´À©Õ¹ XML Îĵµ¡£
anyAttribute
Ê ......
XML Schema union ÔªËØ
¶¨ÒåºÍÓ÷¨
union ÔªËض¨Òå¶à¸ö simpleType ¶¨ÒåµÄ¼¯ºÏ¡£
ÔªËØÐÅÏ¢
³öÏÖ´ÎÊý
Ò»´Î
¸¸ÔªËØ
simpleType
ÄÚÈÝ
annotation¡¢simpleType
Óï·¨
<union
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType ......
/// <summary>
/// Ö§³ÖXMLÐòÁл¯µÄ·ºÐÍ Dictionary
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
[XmlRoot("SerializableDictionary")]
public class SerializableDictionary<TKey, TValue& ......
»ñÈ¡Spring¿ò¼Ü¹ÜÀíµÄÀàʵÀýµÄ·½·¨ÓжàÖÖ,ÈçÏ£º
·½·¨Ò»£ºÔÚ³õʼ»¯Ê±±£´æApplicationContext¶ÔÏó
´úÂ룺
ApplicationContext ac = new FileSystemXmlApplicationContext("applicationContext.xml");
ac.getBean("beanId");
˵Ã÷£º
ÕâÖÖ·½Ê½ÊÊÓÃÓÚ²ÉÓÃSpring¿ò¼ÜµÄ¶ÀÁ¢Ó¦ÓóÌÐò£¬ÐèÒª³ÌÐòͨ¹ýÅäÖÃÎļþÊÖ¹¤³õʼ»¯ ......