public static string GetHtmlOfMarc(string strMARC, bool bSubfieldReturn) { StringBuilder strResult = new StringBuilder("\r\n<table class='marc'>", 4096); for (int i = 0; ; i++) { string strField = ""; string strNextFieldName = ""; int nRet = MarcUtil.GetField(strMARC, null, i, out strField, out strNextFieldName); if (nRet != 1) { break; } string strLineClass = ""; string strFieldName = ""; string strIndicatior = ""; string strContent = ""; if (i != 0) { // 取字段名 if (strField.Length < 3) { strFieldName = strField; strField = ""; } else { strFieldName = strField.Substring(0, 3); strField = strField.Substring(3); } // 取指示符 if (FilterItem.IsControlFieldName(strFieldName) == true) { strLineClass = "controlfield"; strField = strField.Replace(' ', '_'); } else { if (strField.Length < 2) { strIndicatior = strField; strField = ""; } else { strIndicatior = strField.Substring(0, 2); strField = strField.Substring(2); } strIndicatior = strIndicatior.Replace(' ', '_'); strLineClass = "datafield"; // 1XX字段有定长内容 if (strFieldName.Length >= 1 && strFieldName[0] == '1') { strField = strField.Replace(' ', '_'); strLineClass += " fixedlengthsubfield"; } } } else { strLineClass = "header"; strField = strField.Replace(' ', '_'); } /* * strContent = strField.Replace(new string((char)31,1), * "<span>|</span>"); * */ strContent = GetHtmlFieldContent(strField, bSubfieldReturn); // strResult.Append("\r\n<tr class='" + strLineClass + "'><td class='fieldname'>" + strFieldName + "</td>" + "<td class='indicator'>" + strIndicatior + "</td>" + "<td class='content'>" + strContent + "</td></tr>"); } strResult.Append("\r\n</table>"); return(strResult.ToString()); }