XML处理bak
<%
int subjectid = ParamUtil.getInteger(request, "subjectid", -1);
int templateId = ParamUtil.getInteger(request, "templateId", -1);
if (subjectid == -1) {
??out.println("无效参数!");
??return;
?}
SubjectContent11Manager subjectManager = (SubjectContent11Manager) WebAppContextUtil.getBean(application, "subjectContent11Manager");
SubjectContent11 subjectContent = subjectManager.getSubjectContent11(new Integer(subjectid));
if (subjectContent == null) {
??out.println("无效参数!");
??return;
?}
???Document doc = null;
???InputStream input = null;
???try {
????input = new ByteArrayInputStream(subjectContent.getContent().getBytes("gbk"));
???} catch (UnsupportedEncodingException uee) {
????input = new ByteArrayInputStream(subjectContent.getContent().getBytes());
???}
???SAXBuilder builder = new SAXBuilder();
???try {
????doc = builder.build(input);
???} catch (IOException ioe) {
????doc = null;
???} catch (JDOMException jdome) {
????doc = null;
???}
???if (doc == null) {
????throw new IOException("failed to parse the input stream");
???}
???Element root = doc.getRootElement();
???String InsertedContent = SubjectUtil.showInsertedContent(root);
???String InsertedCss = SubjectUtil.showInsertedCss(root);
%>