function $import(path,type,title,idname){
var s,i;
if(type=="js"){
var ss=document.getElementsByTagName("script");
for(i=0;i<ss.length;i++){
if(ss[i].src && ss[i].src.indexOf(path)!=-1)return ss[i];
}
......
function $import(path,type,title,idname){
var s,i;
if(type=="js"){
var ss=document.getElementsByTagName("script");
for(i=0;i<ss.length;i++){
if(ss[i].src && ss[i].src.indexOf(path)!=-1)return ss[i];
}
......
Collection主要是指像Array, ArrayList, List, Dictionary, HashTable这些数据类型,大家平时用的很多。如果一个类中有一个Collection类型的成员,在对这个类进行XML序列化的时候,应该如何处理?应该说在.net当中这是比较简单的,只要建立一个XmlSerializer类就可以帮你自动搞定,不过有的时候你可能需要对自动的序列化过程施加更多的控制,比如XML的结构是实现固定的,你必须按照要求去生成XML结构。
使用不同的属性可以灵活的控制生成的XML,这里我就不多介绍了,主要讲一下如何序列化比较复杂的Collection结构。下面的方法,对于所有实现了IEnumerable接口的Collection都有效。
我使用MSDN中的例子,不过没有使用数组或者ArrayList,而是使用了比较高级的数据类型List<T>,希望在讲解如何序列化XML的同时给使用List<T>的同学提供点参考。
序列化一个List<T>
下面的代码示范了如何序列化一个List<T>,实际上和序列化其它类一样,把这个类扔给Serialize()函数即可。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;
name ......
解析:
CMarkup xml;
CString strChanText, strChanType;
xml.Load("MyXml.xml");
xml.ResetMainPos();
if (!Chan.FindElem("TreeOrg"))
{
return;
}
if (xml.IntoElem())
{
xml.FindElem("Qchannels");
if (xml.IntoElem())
{
while (xml.FindElem("Chan"))
{
strChanText = xml.GetAttrib("iChanId");
strChanType = xml.GetAttrib("iChanType");
}
}
}
XML文件名称:MyXml.xml
内容:
<?xml vers ......
出处:http://www.dimuthu.org/blog/2008/08/18/xml-schema-nillabletrue-vs-minoccurs0/
【前言】一个月前研究过nillable="true"和 vs minOccurs="0"的区分,没有想到啊,今天就记不得了,看来真是好记性不如烂笔头啊,况且我还么的好记性。。。。
【总结】英文一眼看不出结论,说点汉语直接些,别说我土哈~
nillable="true":该元素的值可以为空,但是该元素不能省略,也就是说,只能:
<minzero xsi:nil="true"><minzero>
而不能直接将minzero这个元素去掉
(注意:xsi:nil="true"或者xsi:nil="1"应该就是表示这个元素为空)
minOccurs="0":该元素可以直接被省略掉,但是不能让该元素的值为空,也就是说,不能:
<minzero xsi:nil="true"><minzero>
In a WSDL, XML Schema is the section where it define the message format for each operations, which eventually become the real API that users are interested. And it is the most tricky part of the WSDL. Nowadays there are many tools that you can design and use WSDLs without any needs in knowing the meaning of a single line of the WSDL. But there are situations ......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<mce:style type="text/css"><!--
table,tr,td {
background-position: center;
border-width: 1px;
border-style: solid;
border-collapse: collapse;
border-color: blue;
text-align: center;
font-size: 20px;
}
table {
width: 800px;
margin-bottom: 20px;
}
tr {
height: 40px;
}
.bordertyle {
font-family: sans-serif;
text-align: center;
}
.btn {
margin-left: 30px;
margin-right: 30px;
}
label {
font-size: 20px;
font-family: sans-serif;
}
--></mce:style><style type="text/css" mce_bogus="1">
table,tr,td {
background-position: center;
bord ......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<mce:style type="text/css"><!--
table,tr,td {
background-position: center;
border-width: 1px;
border-style: solid;
border-collapse: collapse;
border-color: blue;
text-align: center;
font-size: 20px;
}
table {
width: 800px;
margin-bottom: 20px;
}
tr {
height: 40px;
}
.bordertyle {
font-family: sans-serif;
text-align: center;
}
.btn {
margin-left: 30px;
margin-right: 30px;
}
label {
font-size: 20px;
font-family: sans-serif;
}
--></mce:style><style type="text/css" mce_bogus="1">
table,tr,td {
background-position: center;
bord ......
第一步:将XML编辑器设置默认为Myeclipse edit
window__Preferences__General____Editors_____File Associations
找到*.xml,选择Myeclipse Xml editor,点default
第二步:配置dtd或者xsd文件
Window → Preferences... → MyEclipse → Files & Editors → XML → XML Catalog
里面配置一下就可以了。打开的XML文件必须要用dtd或schema引用部分。 ......