浏览器在发展,之前那版已经跑不动了
来版新的
-------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>PDMreport</title>
<script type="text/javascript">
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<refsCount;i++){
var refId=refs.children[i].getElementsByTagNameNS("collection","Object2")[0].firstElementChild.getAttribute("Ref");
refIds.push(refId);
}
indextable.push("<table cellpadding=\"0\" cellspacing=\"0\">");
indextable.push("<tr><td class=\"topitd\" style=\"width:50px\">编号</td><td class=\"topitd\" style=\"width:150px\">名称</td><td class=\"trightitd\" style=\"width:200px\">描述</td></tr>");
var indextableCount=0;
while(TI<tables.childElementCount){
itable = tables.children[TI];
indextableCount++;
TI++;
indextable.push("<tr><td>"+indextableCount+"</td>");
var columns=itable.getElementsByTagNameNS("collection","Columns")[0].children;
var tableName=itable.getElementsByTagNameNS("attribute","Name")[0].innerHTML;
indextable.push("<td>"+tableName+"</td>");
var tableCode=itable.getElementsByTagNameNS("attribute","Code")[0].innerHTML;
indextable.push("<td class=\"rightitd\">"+tableCode+"</td></tr>");
try{
var tableComment=itable.getElementsByTagNameNS("attribute","Comment")[0].innerHTML;
}catch(e){
var tableComment=" ";
}
var colsCount=columns.length;
html.push("<div class=\"tableName\">");
html.push(tableName+"("+tableCode+")");
html.push("</div>");
html.push("<table cellpadding=\"0\" cellspacing=\"0\">");
html.push("<tr>");
html.push("<td class=\"topitd\" style=\"width:150px\">");
html.push("字段名称");
html.push("</td>");
html.push("<td class=\"topitd\" style=\"width:150px\">");
html.push("字段描述");
html.push("</td>");
html.push("<td class=\"topitd\" style=\"width:120px\">");
html.push("数据类型");
html.push("</td>");
html.push("<td class=\"topitd\" style=\"width:80px\">");
html.push("是否非空");
html.push("</td>");
html.push("<td class=\"trightitd\" style=\"width:40px\">");
html.push("约束");
html.push("</td>");
html.push("<td class=\"trightitd\" style=\"width:200px\">");
html.push("备注");
html.push("</td>");
html.push("</tr>");
var ikeys=itable.getElementsByTagNameNS("collection","Keys");
var keyCount=ikeys.length;
var akeys=[];
var ks=[];
for(var i=0;i<keyCount;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<keyCount;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<colsCount;i++){
var colId=columns[i].getAttribute("Id");
html.push("<tr>");
var colCode=columns[i].getElementsByTagNameNS("attribute","Code")[0].innerHTML;
html.push("<td>"+colCode+"</td>");
var colName=columns[i].getElementsByTagNameNS("attribute","Name")[0].innerHTML;
html.push("<td>"+colName+"</td>");
var dataType=columns[i].getElementsByTagNameNS("attribute","DataType")[0].innerHTML;
html.push("<td>"+dataType+"</td>");
try{
var isNull=columns[i].getElementsByTagNameNS("attribute","Mandatory")[0].innerHTML;
if(isNull=="1"){html.push("<td>非空</td>");
}else{
if(isNull=="1")html.push("<td> </td>");
}
}catch(e){
html.push("<td> </td>");
}
if(pkeys.join(",").indexOf(colId)>-1){
html.push("<td class=\"rightitd\">PK</td>");
}else if(akeys.join(",").indexOf(colId)>-1){
html.push("<td class=\"rightitd\">AK</td>");
}else if(refIds.join(",").indexOf(colId)>-1){
html.push("<td class=\"rightitd\">FK</td>");
}
else{
html.push("<td class=\"rightitd\"> </td>");
}
try{
var dataComment=columns[i].getElementsByTagNameNS("attribute","Comment")[0].innerHTML;
}catch(e){
var dataComment=" "
}
html.push("<td class=\"rightitd\">"+dataComment+"</td>");
html.push("</tr>");
}
html.push("</table>");
document.getElementById("dataDictionary").innerHTML=html.join("");
}
indextable.push("</tr></table>");
document.getElementById("tableIndex").innerHTML=indextable.join("");
}
</script>
<style type="text/css">
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
}
</style>
</head>
<body>
<div id="tableIndex"></div>
<div id="dataDictionary"></div>
</body>
</html>
----------------------------------------------------