易截截图软件、单文件、免安装、纯绿色、仅160KB

将数组转化为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);
 


相关文档:

xml shema帮助文档5

XML Schema union 元素
定义和用法
union 元素定义多个 simpleType 定义的集合。
元素信息
出现次数
一次
父元素
simpleType
内容
annotation、simpleType
语法
<union
id=ID
memberTypes="list of QNames"
any attributes
>
(annotation?,(simpleType ......

c# XML序列化与反序列化

原先一直用BinaryFormatter来序列化挺好,可是最近发现在WinCE下是没有办法进行BinaryFormatter操作,很不爽,只能改成了BinaryWriter和BinaryReader来读写,突然想到能不能用XML来序列化?于是在网上查了些资料便写了些实践性代码,做些记录,避免以后忘记。
序列化对象
    public class People
  ......

初学XML(二) XML解析器

XML解析器的作用:为应用程序从XML文件中解析出所需要的数据。
下面通过一个例子,来了解,如何用XML解析器,来解析一个XML文件中的数据。
1、Types.xml(显示吉他的类别)
<?xml version="1.0" encoding="UTF-8"?>
<types>
<name>电吉他
<music>玩摇滚</music>
</name>
......

C#小Tip:Xml操作简明手册 1


1)Xml文档示例(xmlsample.xml):
 
Code
<?xml version="1.0" encoding="iso-8859-1" ?>
<music>
  <song title="Oh,girl">
    <artist>The Chi-lites</artist>
    <genre>Soul</genre>
  &nb ......

JPetStore 5.0(iBATIS for java)中Item.xml的bug

Caused by: java.sql.SQLException: ORA-00918: column ambiguously defined
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in com/ibatis/jpetstore/persistence/sqlmapdao/sql/Item.xml. 
--- The error occurred while applying a parameter map.&nbs ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号