浏览器在发展,之前那版已经跑不动了
来版新的
-------------------------------------------------
var loadXML = function(fileRoute){
xmlDoc=null;
if (window.ActiveXObject){
xmlDoc = new ActiveXObject('Msxml2.DOMDocument');
xmlDoc.async=false;
xmlDoc.load(fileRoute);
}
else if (document.implementation && document.implementation.createDocument){
var xmlhttp = new window.XMLHttpRequest();
xmlhttp.open("GET",fileRoute,false);
xmlhttp.send(null);
var xmlDoc = xmlhttp.responseXML.documentElement;
}
else {xmlDoc=null;}
return xmlDoc;
}
window.onload = function(){
var TI =0;
var oxml= loadXML("team4.0.pdm");
var tables = oxml.getElementsByTagNameNS("collection","Tables")[0];
var itable=tables;
var html=[];
var indextable=[];
var refs= oxml.getElementsByTagNameNS("collection","References")[0];
var refIds=[];
var refsCount=refs.children.length;
for(var i=0;i var refId=refs.children[i].getElementsByTagNameNS("collection","Object2")[0].firstElementChild.getAttribute("Ref"); refIds.push(refId); } indextable.push(" indextable.push(" var indextableCount=0; while(TI itable = tables.children[TI]; indextableCount++; TI++; indextable.push(" var columns=itable.getElementsByTagNameNS("collection","Columns")[0].children; var tableName=itable.getElementsByTagNameNS("attribute","Name")[0].innerHTML; indextable.push(" var tableCode=itable.getElementsByTagNameNS("attribute","Code")[0].innerHTML; indextable.push(" try{ var tableComment=itable.getElementsByTagNameNS("attribute","Comment")[0].innerHTML; }catch(e){ var tableComment=" "; } var colsCount=columns.length; html.push(" html.push(tableName+"("+tableCode+")"); html.push(" html.push(" html.push(" html.push(" html.push("字段名称"); html.push(" html.push(" html.push("字段描述"); html.push(" html.push(" html.push("数据类型"); html.push(" html.push(" html.push("是否非空"); html.push(" html.push(" html.push("约束"); html.push(" html.push(" html.push("备注"); html.push(" html.push(" var ikeys=itable.getElementsByTagNameNS("collection","Keys"); var keyCount=ikeys.length; var akeys=[]; var ks=[]; for(var i=0;i var keyId=ikeys[i].getAttribute("Id"); try{ var refCol=ikeys[i].getElementsByTagNameNS("collection","Key.Columns")[0].firstElementChild.getAttribute("Ref"); akeys.push(refCol); }catch(e){} ks.push(keyId); } var pkeys=[]; ikeys=null; keyCount=null var ikeys=itable.getElementsByTagNameNS("collection","PrimaryKey"); var keyCount=ikeys.length; for(var i=0;i var keyId=ikeys[i].getAttribute("Ref"); var index=ks.join(",").indexOf(keyId); if(index>-1){ pkeys.push(akeys[ks.join(",").substr(0, index).split(",").length-1]); }; } for(var i=0;i var colId=columns[i].getAttribute("Id"); html.push(" var colCode=columns[i].getElementsByTagNameNS("attribute","Code")[0].innerHTML; html.push(" var colName=columns[i].getElementsByTagNameNS("attribute","Name")[0].innerHTML; html.push(" var dataType=columns[i].getElementsByTagNameNS("attribute","DataType")[0].innerHTML; html.push(" try{ var isNull=columns[i].getElementsByTagNameNS("attribute","Mandatory")[0].innerHTML; if(isNull=="1"){html.push(" }else{ if(isNull=="1")html.push(" } }catch(e){ html.push(" } if(pkeys.join(",").indexOf(colId)>-1){ html.push(" }else if(akeys.join(",").indexOf(colId)>-1){ html.push(" }else if(refIds.join(",").indexOf(colId)>-1){ html.push(" } else{ html.push(" } try{ var dataComment=columns[i].getElementsByTagNameNS("attribute","Comment")[0].innerHTML; }catch(e){ var dataComment=" " } html.push(" html.push(" } html.push(" document.getElementById("dataDictionary").innerHTML=html.join(""); } indextable.push("");
"); ");
编号 名称 描述 ");"+indextableCount+" ");
"+tableName+" ");
"+tableCode+" ");
");
");
");
");
");
");
");
");
");
");
");
");
");
");
");
");
");"+colCode+" ");
"+colName+" ");
"+dataType+" ");
非空 ");
");
");
PK ");
AK ");
FK ");
");
"+dataComment+" ");
document.getElementById("tableIndex").innerHTML=indextable.join("");
}
body{
font-family:宋体, Arial, Helvetica, sans-serif;
font-size:14px;
font-style:normal;
}
#dataDictionary table{
margin-bottom: 30px
}
#dataDictionary table tr td{
border-bottom: 1px #3399FF solid;
border-left : 1px #3399FF solid;
height: 19px;
}
#dataDictionary table tr .rightitd{
border-right : 1px #3399FF solid;
}
#dataDictionary table tr .trightitd{
border-right : 1px #3399FF solid;
border-top : 1px #3399FF solid;
color: #000066;
font-weight:400;
}
#dataDictionary table tr .topitd{
border-top : 1px #3399FF solid;
color: #000066;
font-weight:400;
}
#dataDictionary .tableName{
margin-bottom:5px;
font-weight:400;
color:#CC3300
}
#tableIndex table{
margin-bottom: 30px
}
#tableIndex table tr td{
border-bottom: 1px #3399FF solid;
border-left : 1px #3399FF solid;
height: 19px;
}
#tableIndex table tr .rightitd{
border-right : 1px #3399FF solid;
}
#tableIndex table tr .trightitd{
border-right : 1px #3399FF solid;
border-top : 1px #3399FF solid;
color: #000066;
font-weight:400;
}
#tableIndex table tr .topitd{
border-top : 1px #3399FF solid;
color: #000066;
font-weight:400;
}
#tableIndex .tableName{
margin-bottom:5px;
font-weight:400;
color:#CC3300
}
----------------------------------------------------